detail.vue 28 KB

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