detail.vue 24 KB

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