detail.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <scroll-view scroll-y="true" class="scroll-view">
  6. <view class="list-scroll-view">
  7. <view class="one_1">
  8. <swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff"
  9. indicator-active-color="#FB1438" :interval="3000" :duration="1000">
  10. <swiper-item class="list" v-for="(item,index) in info.goods.file" :key="index">
  11. <image class="image" :src="item.url" mode="aspectFit">
  12. </image>
  13. </swiper-item>
  14. </swiper>
  15. <!-- 是否关注商品 -->
  16. <view class="goodsColect">
  17. <text @tap="toGoodscolect"
  18. :class="['iconfont',goodsColect?'icon-yduishoucangshixin-copy':'icon-yduishoucangkongxin']"></text>
  19. </view>
  20. <view class="acttags" v-if="info.goods.act_tags&&info.goods.act_tags.length>0">
  21. <text v-for="i in info.goods.act_tags" :key="i">{{i.label}}</text>
  22. </view>
  23. </view>
  24. <view class="one_2">
  25. <text v-if="info.specs[0].price"
  26. class="money"><text>特价¥</text>{{info.specs&&info.specs.length>0?info.specs[0].price:0}}</text>
  27. <text v-else
  28. class="money"><text>¥</text>{{info.specs&&info.specs.length>0?info.specs[0].sell_money:0}}</text>
  29. <text
  30. class="money"><text>¥</text>{{info.specs&&info.specs.length>0?info.specs[0].flow_money:0}}</text>
  31. </view>
  32. <view class="one_3" v-if="discount">
  33. <text v-if="discount.full_decrement" class="act">{{discount.full_decrement}}</text>
  34. <text v-if="discount.full_fold" class="act">{{discount.full_fold}}</text>
  35. </view>
  36. <view class="one_4">
  37. <view class="name">
  38. {{info.goods.name}}
  39. </view>
  40. <view class="brief">
  41. {{info.goods.shot_brief||''}}
  42. </view>
  43. <view class="money">
  44. <text>运费{{info.specs&&info.specs.length>0?info.specs[0].freight:0}}元</text>
  45. <text>{{info.goods.send_time}}内发货</text>
  46. </view>
  47. </view>
  48. <view class="one_5" @tap="toActivity">
  49. <view class="l">
  50. <text>{{info.act.length>0?`活动`:`暂无活动`}}</text>
  51. </view>
  52. <view class="r">
  53. <text class="iconfont icon-jiantouyou"></text>
  54. </view>
  55. </view>
  56. <view class="one_5" @tap="toSpec">
  57. <view class="l">
  58. 选择规格
  59. </view>
  60. <view class="r">
  61. <text class="iconfont icon-jiantouyou"></text>
  62. </view>
  63. </view>
  64. <view class="one_6" @tap="toEvaluate">
  65. <view class="l">
  66. <text>{{evaluate_num>0?`商品评价(${evaluate_num})`:`暂无评价`}}</text>
  67. </view>
  68. <view class="r">
  69. <text class="iconfont icon-jiantouyou"></text>
  70. </view>
  71. </view>
  72. <view class="one_7">
  73. <view class="one_7_1">
  74. <view class="shop_1">
  75. <image class="image"
  76. :src="info.shop.logo&&info.shop.logo.length>0?info.shop.logo[0].url:''"
  77. mode="aspectFit"></image>
  78. </view>
  79. <view class="shop_2">
  80. <view class="name">{{info.shop.name}}</view>
  81. <view class="num"><text>宝贝数:</text>{{info.shop.goods_num||0}}</view>
  82. </view>
  83. </view>
  84. <view class="one_7_2">
  85. <view class="score_1">
  86. <text>商品:</text>
  87. <text>{{info.shop.goods_score||5}}</text>
  88. <text>|</text>
  89. </view>
  90. <view class="score_1">
  91. <text>发货:</text>
  92. <text>{{info.shop.send_score||5}}</text>
  93. <text>|</text>
  94. </view>
  95. <view class="score_1">
  96. <text>服务:</text>
  97. <text>{{info.shop.service_score||5}}</text>
  98. </view>
  99. </view>
  100. <view class="one_7_3">
  101. <view class="btn">
  102. <button size="mini" @tap="toShop">进入店铺</button>
  103. </view>
  104. <view class="btn">
  105. <button size="mini" @tap="toShopcolect">{{shopColect==true?'已关注':'关注'}}</button>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="one_8">
  110. <rich-text :nodes="info.goods.brief"></rich-text>
  111. </view>
  112. </view>
  113. </scroll-view>
  114. </view>
  115. <view class="two">
  116. <uni-goods-nav :options="options" :button-group="buttonGroup" @click="toNavleft"
  117. @buttonClick="toNavright" />
  118. </view>
  119. </view>
  120. <!-- 跳转菜单 -->
  121. <view class="bar_1">
  122. <text @tap="toMenubar" class="iconfont icon-gengduo"></text>
  123. </view>
  124. <view class="bar_2" v-if="is_menu">
  125. <view class="list" v-for="(item,index) in barList" :key="index" v-if="item.is_use=='0'"
  126. @click="toPath(item)">
  127. <image class="image" :src="item.normal&&item.normal.length>0?item.normal[0].url:''"></image>
  128. <text class="name"> {{item.name}}</text>
  129. </view>
  130. </view>
  131. <!-- 规格 -->
  132. <uni-popup ref="specShow" background-color="#fff" type="bottom" :is-mask-click="false">
  133. <view class="popup">
  134. <view class="close">
  135. <text @click="toClose" class="iconfont icon-shanchu"></text>
  136. </view>
  137. <view class="info_1" v-if="popupShow=='1'">
  138. <view class="info_1">
  139. <scroll-view scroll-y="true" class="scroll-view">
  140. <view class="list-scroll-view">
  141. <view class="one">
  142. <view class="one_1">
  143. <view class="l">
  144. <image class="image"
  145. :src="specsInfo.file.length>0?specsInfo.file[0].url:info.goods.file[0].url"
  146. mode="aspectFill" @tap="diaView"></image>
  147. </view>
  148. <view class="r">
  149. <view class="money">
  150. <text v-if="specsInfo.price"
  151. class="money_1"><text>特价¥</text>{{specsInfo.price}}</text>
  152. <text v-if="!specsInfo.price"
  153. class="money_1"><text>¥</text>{{specsInfo.sell_money}}</text>
  154. <text class="money_1"><text>¥</text>{{specsInfo.flow_money}}</text>
  155. </view>
  156. <view class="other_1">
  157. <text>已选:</text>
  158. <text>{{specsInfo.name}}</text>
  159. </view>
  160. </view>
  161. </view>
  162. <view class="one_2">
  163. <view class="one_2_1">
  164. 规格
  165. </view>
  166. <view class="one_2_2">
  167. <view
  168. :class="['list',is_specs!=index&&item.num>0?'list':is_specs!=index&&item.num<=0?'huilist':is_specs==index&&item.num>0?'redlist':is_specs==index&&item.num<=0?'huiilist':'list']"
  169. v-for="(item,index) in info.specs" :key="index" @tap="toSpecs(item)">
  170. <text>{{item.name}}</text>
  171. </view>
  172. </view>
  173. </view>
  174. <view class="one_3">
  175. <view class="one_3_1">
  176. <text>数量</text>
  177. </view>
  178. <view class="one_3_1">
  179. <uni-number-box v-model="buy_num" @change="toCount" :min="1"
  180. :max="specsInfo.num">
  181. </uni-number-box>
  182. </view>
  183. <view class="one_3_1">
  184. <text>库存{{specsInfo.num||0}}</text>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. </scroll-view>
  190. </view>
  191. <view class="info_2">
  192. <view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="btn_type=='0'">
  193. <button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toMarket">加入购物车</button>
  194. </view>
  195. <view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="btn_type=='1'">
  196. <button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toBuy">立即购买</button>
  197. </view>
  198. <view :class="[specsInfo.can_group=='0'?'btns':'btn']" v-if="specsInfo.can_group=='0'">
  199. <button :disabled="is_zero" :class="[is_zero?'btncolor':'']" @tap="toGroup">参团</button>
  200. </view>
  201. </view>
  202. </view>
  203. <view class="info_3" v-else-if="popupShow=='2'">
  204. <scroll-view scroll-y="true" class="scroll-view">
  205. <view class="list" v-for="(item,index) in info.act" :key="index">
  206. <view class="list_1" @tap="toAct(item)">
  207. <view class="title_1">
  208. <view class="l">
  209. <text>{{item.tag||'暂无'}}</text>{{item.act_time.title}}
  210. </view>
  211. <view class="r">
  212. <text class="iconfont icon-jiantouyou"></text>
  213. </view>
  214. </view>
  215. <view class="title_2">
  216. <view class="text" v-if="item.type=='5'||item.type=='6'">{{item.text}}</view>
  217. <view class="time">{{item.config.time_start}}-{{item.config.time_end}}</view>
  218. </view>
  219. <view class="title_2" v-if="item.type=='2'">
  220. <view class="specList" v-for="(tag,indexx) in item.list" :key="indexx">
  221. <view class="name">规格:{{tag.spec_name}}</view>
  222. <view class="giftList" v-for="(tags,indexs) in tag.gift" :key="indexs"
  223. @tap.stop="tags.type=='0' && getDetail(tags)">
  224. <view class="left">
  225. <view class="goods">{{tags.goods_name}}{{tags.spec_name}}</view>
  226. <view class="goods">{{tags.desc}}</view>
  227. <view class="num">×{{tags.num}}</view>
  228. </view>
  229. <view class="right"><text class="iconfont icon-jiantouyou"></text>
  230. </view>
  231. </view>
  232. </view>
  233. </view>
  234. </view>
  235. </view>
  236. </scroll-view>
  237. </view>
  238. </view>
  239. </uni-popup>
  240. <view class="dialog" v-if="dialog.show==true" @tap="dialogClose">
  241. <view class="dialog_1" v-if="dialog.type=='1'">
  242. <swiper class="swiper" circular @change="diaSpecs" :current="is_specs">
  243. <swiper-item class="list" v-for="(item,index) in info.specs" :key="index">
  244. <view class="list_1">
  245. <image class="image" :src="item.file.length>0?item.file[0].url:info.goods.file[0].url"
  246. mode="aspectFit"></image>
  247. </view>
  248. <view class="name">
  249. <text>{{item.name}}</text>
  250. </view>
  251. </swiper-item>
  252. </swiper>
  253. </view>
  254. </view>
  255. </mobile-frame>
  256. </template>
  257. <script>
  258. export default {
  259. data() {
  260. return {
  261. // 系统设置
  262. config: {},
  263. // 商品id
  264. id: '',
  265. // 分享人id
  266. inviter: '',
  267. // 当前用户信息
  268. user: {},
  269. // 是否关注商品
  270. goodsColect: false,
  271. // 是否关注店铺
  272. shopColect: false,
  273. // 评价数
  274. evaluate_num: 2,
  275. // 商品详情
  276. info: {},
  277. // 优惠
  278. discount: {},
  279. // 底部菜单
  280. options: [ //
  281. {
  282. icon: 'shop',
  283. text: '店铺',
  284. type: 'shop',
  285. route: 'pagesHome/shop/index',
  286. },
  287. {
  288. icon: 'cart',
  289. text: '购物车',
  290. type: 'market',
  291. route: 'pages/market/index',
  292. },
  293. ],
  294. buttonGroup: [ //
  295. {
  296. text: '加入购物车',
  297. backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
  298. color: '#fff',
  299. type: '0'
  300. },
  301. {
  302. text: '立即购买',
  303. backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)',
  304. color: '#fff',
  305. type: '1'
  306. }
  307. ],
  308. // 系统菜单
  309. barList: [],
  310. is_menu: false,
  311. // 规格弹框
  312. popupShow: '1',
  313. // 规格信息
  314. is_specs: 0,
  315. btn_type: '1',
  316. specsInfo: {},
  317. // 是否零库存
  318. is_zero: false,
  319. // 购买数量
  320. buy_num: 1,
  321. // 规格弹出框
  322. dialog: {
  323. show: false,
  324. type: '1'
  325. },
  326. };
  327. },
  328. onLoad: async function(e) {
  329. const that = this;
  330. that.$set(that, `id`, e.id || '');
  331. that.$set(that, `inviter`, e.inviter || '');
  332. await that.searchConfig();
  333. await that.search();
  334. await that.configShare();
  335. },
  336. onShow: async function() {
  337. const that = this;
  338. await that.watchLogin();
  339. },
  340. onUnload: function() {
  341. // 页面卸载,重新部署分享内容
  342. const that = this;
  343. if (that.config) {
  344. // 赋值默认值
  345. that.$config.share = {
  346. title: that.config.title,
  347. path: '/pages/index/index',
  348. imageUrl: that.config.config.share[0].url
  349. }
  350. }
  351. },
  352. methods: {
  353. // 查询系统设置
  354. searchConfig() {
  355. const that = this;
  356. uni.getStorage({
  357. key: 'config',
  358. success: function(res) {
  359. let data = res.data;
  360. that.$set(that, `config`, data);
  361. if (data.bottom_menu && data.bottom_menu.list.length > 0) {
  362. let list = data.bottom_menu.list.sort((a, b) => {
  363. return a.sort - b.sort
  364. });
  365. that.$set(that, `barList`, list)
  366. }
  367. }
  368. })
  369. },
  370. // 查询用户信息
  371. watchLogin() {
  372. const that = this;
  373. uni.getStorage({
  374. key: 'token',
  375. success: async function(res) {
  376. let user = that.$jwt(res.data);
  377. if (user) that.$set(that, `user`, user);
  378. await that.searchOther();
  379. },
  380. fail: function(err) {
  381. console.log('暂无用户信息');
  382. }
  383. })
  384. },
  385. // 查询其他信息
  386. async searchOther() {
  387. const that = this;
  388. let user = that.user;
  389. let res;
  390. // 是否关注商品
  391. res = await that.$api(`/storeGoods/check`, `GET`, {
  392. customer: user._id,
  393. goods: that.id
  394. });
  395. if (res.errcode == '0') that.$set(that, `goodsColect`, res.data);
  396. // 是否关注店铺
  397. res = await that.$api(`/storeShop/check`, `GET`, {
  398. customer: user._id,
  399. shop: that.info?.shop?._id
  400. });
  401. if (res.errcode == '0') that.$set(that, `shopColect`, res.data)
  402. },
  403. // 查询商品信息
  404. async search() {
  405. const that = this;
  406. let id = that.id;
  407. if (id) {
  408. let res;
  409. res = await that.$api(`/viewGoods/goodsDetail`, `POST`, {
  410. id: id
  411. });
  412. if (res.errcode == '0') {
  413. let data = res.data;
  414. if (data.goods.brief) data.goods.brief = data.goods.brief.replace(/\<img/gi,
  415. '<img class="rich-img"');
  416. // 特价
  417. let act;
  418. act = data.act.find(i => i.type == '3')
  419. if (act) {
  420. for (let val of act.list) {
  421. for (let [index, arr] of data.specs.entries()) {
  422. if (val.spec == arr._id) arr.price = val.price
  423. }
  424. }
  425. }
  426. // 规格排序
  427. data.specs.sort(function(a, b) {
  428. let i, j;
  429. if (a.price) i = 'price'
  430. else i = 'sell_money'
  431. if (b.price) j = 'price'
  432. else j = 'sell_money'
  433. return a[i] - b[j];
  434. })
  435. that.$set(that, `info`, data);
  436. // 优惠
  437. act = data.act.find(i => i.type == '5')
  438. if (act) that.$set(that.discount, `full_decrement`, act.text);
  439. act = data.act.find(i => i.type == '6')
  440. if (act) that.$set(that.discount, `full_fold`, act.text);
  441. // 查询规格
  442. that.searchSpecs(data.specs);
  443. // 查询评价数
  444. that.searchRate(data);
  445. }
  446. } else {
  447. uni.showToast({
  448. title: '暂无商品信息',
  449. icon: 'none'
  450. })
  451. }
  452. },
  453. // 查询规格
  454. searchSpecs(e) {
  455. const that = this;
  456. if (e.length > 0) {
  457. let data = e.find(i => i.num > 0);
  458. let dataIndex = e.findIndex(i => i.id == data.id);
  459. if (data) {
  460. that.$set(that, `specsInfo`, data);
  461. that.$set(that, `is_specs`, dataIndex);
  462. }
  463. }
  464. },
  465. // 活动说明
  466. toActivity() {
  467. const that = this;
  468. if (that.info.act.length > 0) {
  469. that.$set(that, `popupShow`, '2')
  470. that.$refs.specShow.open();
  471. }
  472. },
  473. // 查看正品详情
  474. getDetail(e) {
  475. const that = this;
  476. uni.navigateTo({
  477. url: `/pagesHome/order/detail?id=${e.goods}`
  478. })
  479. },
  480. // 选择规格
  481. toSpecs(e) {
  482. const that = this;
  483. let specs = that.info.specs;
  484. let dataIndex = specs.findIndex(i => i._id == e._id);
  485. that.$set(that, `is_specs`, dataIndex);
  486. that.$set(that, `specsInfo`, e)
  487. that.$set(that, `buy_num`, 1);
  488. if (e.num <= 0) that.$set(that, `is_zero`, true)
  489. else that.$set(that, `is_zero`, false)
  490. },
  491. // 计数器
  492. toCount(e) {
  493. const that = this;
  494. that.$set(that, `buy_num`, e)
  495. },
  496. // 查询评价数
  497. async searchRate(e) {
  498. const that = this;
  499. let res = await that.$api(`/goodsRate`, `GET`, {
  500. goods: e.goods._id
  501. })
  502. if (res.errcode == '0') that.$set(that, `evaluate_num`, res.total);
  503. },
  504. // 关注商品
  505. async toGoodscolect() {
  506. const that = this;
  507. let user = that.user;
  508. if (user && user._id) {
  509. let res = await that.$api(`/storeGoods`, `POST`, {
  510. customer: user._id,
  511. goods: that.id
  512. });
  513. if (res.errcode == '0') {
  514. uni.showToast({
  515. title: res.data.msg,
  516. icon: 'none'
  517. })
  518. that.$set(that, `goodsColect`, res.data.result)
  519. }
  520. } else {
  521. uni.showToast({
  522. title: '暂无账号,无法收藏商品',
  523. icon: 'none'
  524. })
  525. }
  526. },
  527. // 选择规格
  528. toSpec() {
  529. const that = this;
  530. this.$set(that, `popupShow`, '1')
  531. that.$refs.specShow.open();
  532. },
  533. // 加入购物车
  534. async toMarket() {
  535. const that = this;
  536. let user = that.user;
  537. let info = that.info;
  538. let specsInfo = that.specsInfo;
  539. if (user && user._id) {
  540. let obj = {
  541. customer: user._id,
  542. shop: info.shop._id,
  543. goods: info.goods._id,
  544. goodsSpec: specsInfo._id,
  545. num: that.buy_num,
  546. inviter: that.inviter
  547. }
  548. let res = await that.$api(`/cart`, 'POST', obj)
  549. if (res.errcode == '0') {
  550. uni.showToast({
  551. title: `加入购物车成功`,
  552. icon: 'none'
  553. })
  554. that.toClose();
  555. } else {
  556. uni.showToast({
  557. title: res.errmsg,
  558. icon: 'none'
  559. })
  560. }
  561. } else {
  562. uni.navigateTo({
  563. url: `/pages/login/index`
  564. })
  565. }
  566. },
  567. // 立即购买
  568. async toBuy() {
  569. const that = this;
  570. let user = that.user;
  571. let info = that.info;
  572. let specsInfo = that.specsInfo;
  573. let act = that.info.act.map(item => {
  574. return item._id
  575. })
  576. if (user && user._id) {
  577. let obj = [{
  578. customer: user._id,
  579. shop: info.shop._id,
  580. goods: info.goods._id,
  581. goodsSpec: specsInfo._id,
  582. num: that.buy_num,
  583. inviter: that.inviter,
  584. act: act
  585. }]
  586. let res = await that.$api(`/util/checkCanBuy`, 'POST', obj)
  587. if (res.errcode == '0') {
  588. if (res.data.result == true) {
  589. uni.navigateTo({
  590. url: `/pagesHome/order/order?key=${res.data.key}`
  591. })
  592. } else {
  593. uni.showToast({
  594. title: res.data.msg,
  595. icon: 'none'
  596. })
  597. }
  598. } else {
  599. uni.showToast({
  600. title: res.errmsg,
  601. icon: 'none'
  602. })
  603. }
  604. } else {
  605. uni.navigateTo({
  606. url: `/pages/login/index`
  607. })
  608. }
  609. },
  610. // 参团
  611. toGroup() {
  612. const that = this;
  613. let specs_id = that.specsInfo._id;
  614. let id = that.id;
  615. uni.navigateTo({
  616. url: `/pagesHome/group/index?specs_id=${specs_id}&goods_id=${id}`
  617. })
  618. },
  619. // 关闭弹框
  620. toClose() {
  621. const that = this;
  622. that.$set(that, `btn_type`, '1');
  623. that.$refs.specShow.close();
  624. },
  625. // 评价
  626. toEvaluate() {
  627. const that = this;
  628. uni.navigateTo({
  629. url: `/pagesHome/order/appraise?id=${that.info.goods._id}`
  630. })
  631. },
  632. // 进入店铺
  633. toShop() {
  634. const that = this;
  635. let info = that.info;
  636. uni.navigateTo({
  637. url: `/pagesHome/shop/index?id=${info.shop._id}`
  638. })
  639. },
  640. // 关注店铺
  641. async toShopcolect() {
  642. const that = this;
  643. let user = that.user;
  644. if (user && user._id) {
  645. let res = await that.$api(`/storeShop`, `POST`, {
  646. customer: user._id,
  647. shop: that.info.shop._id
  648. });
  649. if (res.errcode == '0') {
  650. uni.showToast({
  651. title: res.data.msg,
  652. icon: 'none'
  653. })
  654. that.$set(that, `shopColect`, res.data.result)
  655. }
  656. } else {
  657. uni.showToast({
  658. title: '暂无账号,无法关注商铺',
  659. icon: 'none'
  660. })
  661. }
  662. },
  663. // 店铺,购物车
  664. toNavleft(e) {
  665. const that = this;
  666. if (e.content.type == 'shop') {
  667. that.toShop();
  668. } else if (e.content.type == 'market') {
  669. let obj = {
  670. route: e.content.route
  671. }
  672. that.toPath(obj)
  673. }
  674. },
  675. // 加入购物车,立即购买
  676. toNavright(e) {
  677. const that = this;
  678. that.$set(that, `popupShow`, '1');
  679. that.$set(that, `btn_type`, e.content.type);
  680. that.$refs.specShow.open();
  681. },
  682. // 右侧菜单
  683. toMenubar() {
  684. const that = this;
  685. that.$set(that, `is_menu`, that.is_menu ? false : true)
  686. },
  687. toPath(e) {
  688. let url = `/${e.route}`;
  689. uni.reLaunch({
  690. url
  691. })
  692. },
  693. // 配置分享内容
  694. configShare() {
  695. const that = this;
  696. let id = that.id;
  697. let inviter = that.user && that.user._id ? that.user._id : '';
  698. let title = that.info && that.info.goods ? that.info.goods.name : '';
  699. let imageUrl = that.info && that.info.goods ? that.info.goods.file[0].url : '';
  700. that.$config.share = {
  701. title: title,
  702. path: `/pagesHome/order/detail?id=${id}&inviter=${inviter}`,
  703. imageUrl: imageUrl
  704. }
  705. },
  706. // 规格预览
  707. diaView() {
  708. const that = this;
  709. that.$set(that, `dialog`, {
  710. show: true,
  711. type: '1'
  712. })
  713. },
  714. // 查看活动
  715. toAct(item) {
  716. uni.navigateTo({
  717. url: `/pagesRest/activity/info?id=${item._id}`
  718. })
  719. },
  720. // 弹框选择规格
  721. diaSpecs(e) {
  722. const that = this;
  723. let specs = that.info.specs;
  724. let index = e.detail.current;
  725. let data = specs[index];
  726. that.$set(that, `is_specs`, index);
  727. that.$set(that, `specsInfo`, data);
  728. that.$set(that, `buy_num`, 1);
  729. if (data.num <= 0) that.$set(that, `is_zero`, true)
  730. else that.$set(that, `is_zero`, false)
  731. },
  732. // 关闭弹框
  733. dialogClose() {
  734. const that = this;
  735. that.$set(that, `dialog`, {
  736. show: false,
  737. type: '1'
  738. })
  739. }
  740. }
  741. }
  742. </script>
  743. <style lang="scss">
  744. .main {
  745. display: flex;
  746. flex-direction: column;
  747. width: 100vw;
  748. height: 100vh;
  749. .one {
  750. position: relative;
  751. flex-grow: 1;
  752. .one_1 {
  753. border-bottom: 0.5vw solid var(--f9Color);
  754. swiper {
  755. height: 44vh !important;
  756. }
  757. .list {
  758. border-radius: 5px;
  759. .image {
  760. width: 100%;
  761. height: 100%;
  762. border-radius: 5px;
  763. background-color: #fff;
  764. }
  765. }
  766. .goodsColect {
  767. position: fixed;
  768. top: 2vw;
  769. right: 3vw;
  770. z-index: 99;
  771. background-color: #858585;
  772. border-radius: 90px;
  773. text {
  774. font-size: 30px;
  775. }
  776. }
  777. .acttags {
  778. position: absolute;
  779. top: 1vw;
  780. left: 1vw;
  781. width: 97%;
  782. text {
  783. display: inline-block;
  784. background-color: #ff0000;
  785. color: #fff;
  786. border-radius: 1vw;
  787. padding: 0.5vw;
  788. font-size: 12px;
  789. margin: 0 1vw 0 0;
  790. }
  791. }
  792. }
  793. .one_2 {
  794. border-bottom: 0.5vw solid var(--f9Color);
  795. padding: 2vw;
  796. .money {
  797. font-size: 20px;
  798. padding: 0 1vw 0 0;
  799. color: #ff0000;
  800. font-weight: bold;
  801. text {
  802. font-size: 14px;
  803. }
  804. }
  805. .money:last-child {
  806. font-size: 16px;
  807. color: #858585;
  808. text-decoration: line-through;
  809. }
  810. }
  811. .one_3 {
  812. padding: 1vw 0 1vw 1vw;
  813. border-bottom: 0.5vw solid var(--f9Color);
  814. .act {
  815. font-size: 12px;
  816. border: 1px solid var(--fFB1Color);
  817. margin: 0 1vw 0 0;
  818. color: var(--fFB1Color);
  819. border-radius: 6px;
  820. }
  821. }
  822. .one_4 {
  823. border-bottom: 0.5vw solid var(--f9Color);
  824. padding: 2vw;
  825. .name {
  826. font-size: 17px;
  827. font-weight: bold;
  828. margin: 0 0 2vw 0;
  829. }
  830. .brief {
  831. font-size: 14px;
  832. color: #858585;
  833. margin: 0 0 1vw 0;
  834. }
  835. .money {
  836. font-size: 13px;
  837. color: #858585;
  838. text {
  839. padding: 0 2vw 0 0;
  840. }
  841. }
  842. }
  843. .one_5 {
  844. display: flex;
  845. justify-content: space-between;
  846. padding: 2vw;
  847. border-bottom: 0.5vw solid var(--f9Color);
  848. font-size: 14px;
  849. }
  850. .one_6 {
  851. display: flex;
  852. justify-content: space-between;
  853. padding: 2vw;
  854. border-bottom: 0.5vw solid var(--f9Color);
  855. font-size: 14px;
  856. }
  857. .one_7 {
  858. padding: 2vw;
  859. border-bottom: 0.5vw solid var(--f9Color);
  860. .one_7_1 {
  861. margin: 0 0 1vw 0;
  862. display: flex;
  863. .shop_1 {
  864. width: 15vw;
  865. height: 15vw;
  866. border: 1px solid #f1f1f1;
  867. .image {
  868. width: 100%;
  869. height: 100%;
  870. }
  871. }
  872. .shop_2 {
  873. width: 78vw;
  874. padding: 0 0 0 2vw;
  875. .name {
  876. font-size: 14px;
  877. margin: 0 0 1vw 0;
  878. }
  879. .num {
  880. font-size: 12px;
  881. color: #858585;
  882. text:last-child {
  883. color: #000;
  884. }
  885. }
  886. }
  887. }
  888. .one_7_2 {
  889. margin: 0 0 2vw 0;
  890. display: flex;
  891. justify-content: space-between;
  892. padding: 2vw 0;
  893. .score_1 {
  894. width: 33vw;
  895. text-align: center;
  896. font-size: 14px;
  897. color: #858585;
  898. text:nth-child(2) {
  899. color: #ff0000;
  900. }
  901. text:nth-child(3) {
  902. float: right;
  903. }
  904. }
  905. }
  906. .one_7_3 {
  907. display: flex;
  908. justify-content: space-around;
  909. .btn {
  910. width: 40vw;
  911. button {
  912. width: 100%;
  913. font-size: 15px;
  914. }
  915. }
  916. }
  917. }
  918. .one_8 {
  919. padding: 2vw;
  920. .rich-img {
  921. width: 100% !important;
  922. display: block;
  923. }
  924. }
  925. }
  926. .two {
  927. width: 100vw;
  928. height: 8vh;
  929. overflow: hidden;
  930. }
  931. }
  932. .scroll-view {
  933. position: absolute;
  934. top: 0;
  935. left: 0;
  936. right: 0;
  937. bottom: 0;
  938. .list-scroll-view {
  939. display: flex;
  940. flex-direction: column;
  941. }
  942. }
  943. .bar_1 {
  944. position: fixed;
  945. right: 2vw;
  946. bottom: 20vw;
  947. text {
  948. background-color: #858585;
  949. border-radius: 90px;
  950. font-size: 30px;
  951. }
  952. }
  953. .bar_2 {
  954. position: fixed;
  955. right: 2vw;
  956. bottom: 28vw;
  957. width: 27vw;
  958. background: #ffffff;
  959. padding: 0 2vw;
  960. box-shadow: 0 0 5px #858585;
  961. .list {
  962. display: flex;
  963. border-bottom: 1px solid #f1f1f1;
  964. padding: 1vw 0;
  965. .image {
  966. width: 8vw;
  967. height: 8vw;
  968. }
  969. .name {
  970. font-size: 14px;
  971. position: relative;
  972. top: 2vw;
  973. left: 2vw;
  974. }
  975. }
  976. .list:last-child {
  977. border-bottom: none;
  978. }
  979. }
  980. .uni-popup {
  981. z-index: 9999 !important;
  982. }
  983. .popup {
  984. display: flex;
  985. flex-direction: column;
  986. width: 100vw;
  987. height: 60vh;
  988. .close {
  989. text-align: right;
  990. padding: 2vw;
  991. }
  992. .info_1 {
  993. position: relative;
  994. display: flex;
  995. flex-direction: column;
  996. height: 54vh;
  997. .info_1 {
  998. position: relative;
  999. flex-grow: 1;
  1000. .one {
  1001. padding: 2vw;
  1002. .one_1 {
  1003. display: flex;
  1004. margin: 0 0 2vw 0;
  1005. padding: 0 0 2vw 0;
  1006. border-bottom: 0.5vw solid var(--f9Color);
  1007. .l {
  1008. width: 25vw;
  1009. height: 25vw;
  1010. .image {
  1011. width: 100%;
  1012. height: 100%;
  1013. border-radius: 5px;
  1014. }
  1015. }
  1016. .r {
  1017. width: 70vw;
  1018. padding: 0 0 0 2vw;
  1019. .money {
  1020. margin: 0 0 2vw 0;
  1021. .money_1 {
  1022. font-size: 20px;
  1023. color: #ff0000;
  1024. padding: 0 2vw 0 0;
  1025. text {
  1026. font-size: 14px;
  1027. }
  1028. }
  1029. .money_1:last-child {
  1030. font-size: 16px;
  1031. color: #858585;
  1032. text-decoration: line-through;
  1033. }
  1034. }
  1035. .other_1 {
  1036. font-size: 15px;
  1037. color: #858585;
  1038. text:last-child {
  1039. color: #000000;
  1040. }
  1041. }
  1042. }
  1043. }
  1044. .one_2 {
  1045. margin: 0 0 2vw 0;
  1046. border-bottom: 0.5vw solid var(--f9Color);
  1047. .one_2_1 {
  1048. font-size: 14px;
  1049. margin: 0 0 2vw 0;
  1050. }
  1051. .one_2_2 {
  1052. display: flex;
  1053. flex-wrap: wrap;
  1054. .list {
  1055. background-color: #F5F5F5;
  1056. margin: 0 2vw 2vw 0;
  1057. padding: 0.5vw 1vw;
  1058. border-radius: 5px;
  1059. text {
  1060. font-size: 14px;
  1061. color: #000;
  1062. }
  1063. }
  1064. .huilist {
  1065. background-color: #DCDCDC;
  1066. text {
  1067. color: #858585;
  1068. }
  1069. }
  1070. .redlist {
  1071. background-color: #ff0000;
  1072. text {
  1073. color: #ffffff;
  1074. }
  1075. }
  1076. .huiilist {
  1077. background-color: #808080;
  1078. text {
  1079. color: #cccccc;
  1080. }
  1081. }
  1082. }
  1083. }
  1084. .one_3 {
  1085. display: flex;
  1086. .one_3_1 {
  1087. margin: 0 2vw 0 0;
  1088. text {
  1089. font-size: 14px;
  1090. color: #858585;
  1091. }
  1092. }
  1093. }
  1094. }
  1095. }
  1096. .info_2 {
  1097. display: flex;
  1098. text-align: center;
  1099. justify-content: space-between;
  1100. .btns {
  1101. width: 50vw;
  1102. }
  1103. .btn {
  1104. width: 100vw;
  1105. }
  1106. button {
  1107. width: 100%;
  1108. border-radius: 0;
  1109. background-color: var(--fFB1Color);
  1110. color: #fff;
  1111. border: 1px solid #f1f1f1;
  1112. }
  1113. .btncolor {
  1114. background: #f1f1f1;
  1115. color: #858585;
  1116. }
  1117. }
  1118. }
  1119. .info_3 {
  1120. position: relative;
  1121. flex-grow: 1;
  1122. .list {
  1123. margin: 0 2vw 2vw 2vw;
  1124. border-radius: 10px;
  1125. background-color: #FFF8DC;
  1126. .list_1 {
  1127. padding: 2vw;
  1128. font-size: 14px;
  1129. .title_1 {
  1130. display: flex;
  1131. justify-content: space-between;
  1132. margin: 1vw 0;
  1133. .l {
  1134. text {
  1135. margin: 0 1vw 0 0;
  1136. font-size: 12px;
  1137. border-radius: 5px;
  1138. border: 0.5px solid var(--fFB1Color);
  1139. color: var(--fFB1Color);
  1140. }
  1141. }
  1142. }
  1143. .title_2 {
  1144. .specList {
  1145. .name {
  1146. margin: 0 0 1vw 0;
  1147. }
  1148. .giftList {
  1149. display: flex;
  1150. justify-content: space-between;
  1151. align-items: center;
  1152. margin: 0 0 1vw 0;
  1153. border: 0.5px solid var(--f9Color);
  1154. border-radius: 10px;
  1155. .left {
  1156. width: 85vw;
  1157. .num {
  1158. color: var(--fFB1Color);
  1159. }
  1160. }
  1161. }
  1162. }
  1163. .text {
  1164. color: var(--fFB1Color);
  1165. }
  1166. }
  1167. }
  1168. }
  1169. }
  1170. }
  1171. .dialog {
  1172. position: fixed;
  1173. width: 100vw;
  1174. height: 100vh;
  1175. background-color: #000000;
  1176. z-index: 99999;
  1177. display: flex;
  1178. flex-direction: column;
  1179. justify-content: center;
  1180. swiper {
  1181. height: 60vh;
  1182. }
  1183. .list {
  1184. .list_1 {
  1185. padding: 2vw;
  1186. margin: 0 0 5vw 0;
  1187. .image {
  1188. width: 100%;
  1189. height: 40vh;
  1190. }
  1191. }
  1192. .name {
  1193. text-align: center;
  1194. margin: 0 10vw;
  1195. background-color: #6666669f;
  1196. border-radius: 25px;
  1197. padding: 2vw;
  1198. text {
  1199. color: #fff;
  1200. font-size: 15px;
  1201. overflow: hidden;
  1202. text-overflow: ellipsis;
  1203. -webkit-line-clamp: 2;
  1204. word-break: break-all;
  1205. display: -webkit-box;
  1206. -webkit-box-orient: vertical;
  1207. }
  1208. }
  1209. }
  1210. }
  1211. </style>