detail.vue 24 KB

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