detail.vue 29 KB

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