detail.vue 24 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061
  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. const that = this;
  528. that.$set(that, `buy_num`, e)
  529. },
  530. // 立即购买
  531. async toBuy() {
  532. const that = this;
  533. let user = that.user;
  534. let info = that.info;
  535. let specsInfo = that.specsInfo;
  536. let act = that.info.act.map(item => {
  537. return item._id
  538. })
  539. if (user && user._id) {
  540. let obj = [{
  541. customer: user._id,
  542. shop: info.shop._id,
  543. goods: info.goods._id,
  544. goodsSpec: specsInfo._id,
  545. num: that.buy_num,
  546. inviter: that.inviter,
  547. act
  548. }]
  549. let res = await that.$api(`/util/checkCanBuy`, 'POST', obj)
  550. if (res.errcode == '0') {
  551. if (res.data.result == true) {
  552. uni.navigateTo({
  553. url: `/pagesHome/order/order?key=${res.data.key}`
  554. })
  555. } else {
  556. uni.showToast({
  557. title: res.data.msg,
  558. icon: 'none',
  559. duration: 5000
  560. })
  561. }
  562. } else {
  563. uni.showToast({
  564. title: res.errmsg,
  565. icon: 'none'
  566. })
  567. }
  568. } else {
  569. uni.navigateTo({
  570. url: `/pages/login/index`
  571. })
  572. }
  573. },
  574. // 加入购物车
  575. async toMarket() {
  576. const that = this;
  577. let user = that.user;
  578. let info = that.info;
  579. let specsInfo = that.specsInfo;
  580. if (user && user._id) {
  581. let obj = {
  582. customer: user._id,
  583. shop: info.shop._id,
  584. goods: info.goods._id,
  585. goodsSpec: specsInfo._id,
  586. num: that.buy_num,
  587. inviter: that.inviter
  588. }
  589. let res = await that.$api(`/cart`, 'POST', obj)
  590. if (res.errcode == '0') {
  591. uni.showToast({
  592. title: `加入购物车成功`,
  593. icon: 'none'
  594. })
  595. that.toClose();
  596. } else {
  597. uni.showToast({
  598. title: res.errmsg,
  599. icon: 'none'
  600. })
  601. }
  602. } else {
  603. uni.navigateTo({
  604. url: `/pages/login/index`
  605. })
  606. }
  607. },
  608. // 开团
  609. toGroup() {
  610. const that = this;
  611. uni.navigateTo({
  612. url: `/pagesHome/group/index?shop=${that.info?.shop?._id}&goods=${that.id}`
  613. })
  614. },
  615. // 查看活动
  616. toAct(item) {
  617. uni.navigateTo({
  618. url: `/pagesRest/activity/info?id=${item._id}`
  619. })
  620. },
  621. // 店铺,购物车
  622. toNavleft(e) {
  623. const that = this;
  624. if (e.content.type == 'shop') {
  625. that.toShop();
  626. } else if (e.content.type == 'market') {
  627. let obj = {
  628. route: e.content.route
  629. }
  630. that.toPath(obj)
  631. }
  632. },
  633. // 关闭弹框
  634. dialogClose() {
  635. const that = this;
  636. that.$set(that, `dialog`, {
  637. show: false,
  638. type: '1'
  639. })
  640. },
  641. // 弹框选择规格
  642. diaSpecs(e) {
  643. const that = this;
  644. let specs = that.info.specs;
  645. let index = e.detail.current;
  646. let data = specs[index];
  647. that.$set(that, `is_specs`, index);
  648. that.$set(that, `specsInfo`, data);
  649. that.$set(that, `buy_num`, 1);
  650. if (data.num <= 0) that.$set(that, `is_zero`, true)
  651. else that.$set(that, `is_zero`, false)
  652. },
  653. // 套装加入购物车
  654. async toSetMarket(e) {
  655. const that = this;
  656. let user = that.user;
  657. if (user && user._id) {
  658. let obj = {
  659. customer: user._id,
  660. set_id: e._id,
  661. is_set: '0',
  662. num: 1,
  663. }
  664. let res = await that.$api(`/cart`, 'POST', obj)
  665. if (res.errcode == '0') {
  666. uni.showToast({
  667. title: `加入购物车成功`,
  668. icon: 'none'
  669. })
  670. that.toClose();
  671. } else {
  672. uni.showToast({
  673. title: res.errmsg,
  674. icon: 'none'
  675. })
  676. }
  677. } else {
  678. uni.navigateTo({
  679. url: `/pages/login/index`
  680. })
  681. }
  682. },
  683. // 加入购物车,立即购买
  684. toNavright(e) {
  685. const that = this;
  686. that.$set(that, `popupShow`, '1');
  687. that.$set(that, `btn_type`, e.content.type);
  688. that.$refs.specShow.open();
  689. },
  690. // 配置分享内容
  691. configShare() {
  692. const that = this;
  693. let id = that.id;
  694. let inviter = that.user && that.user._id ? that.user._id : '';
  695. let title = that.info && that.info.goods ? that.info.goods.name : '';
  696. let imageUrl = that.info && that.info.goods ? that.info.goods.file[0].url : '';
  697. that.$config.share = {
  698. title: title,
  699. path: `/pagesHome/order/detail?id=${id}&inviter=${inviter}`,
  700. imageUrl: imageUrl
  701. }
  702. },
  703. // 右侧菜单
  704. toMenubar() {
  705. const that = this;
  706. that.$set(that, `is_menu`, that.is_menu ? false : true)
  707. },
  708. toPath(e) {
  709. let url = `/${e.route}`;
  710. uni.reLaunch({
  711. url
  712. })
  713. },
  714. }
  715. }
  716. </script>
  717. <style lang="scss">
  718. .main {
  719. display: flex;
  720. flex-direction: column;
  721. width: 100vw;
  722. height: 100vh;
  723. .one {
  724. position: relative;
  725. flex-grow: 1;
  726. .one_2 {
  727. border-bottom: 0.5vw solid var(--f9Color);
  728. padding: 2vw;
  729. .money_1 {
  730. color: #23B67A;
  731. font-size: 20px;
  732. padding: 0 1vw 0 0;
  733. font-weight: bold;
  734. text {
  735. font-size: 14px;
  736. }
  737. }
  738. .money {
  739. font-size: 20px;
  740. padding: 0 1vw 0 0;
  741. color: #ff0000;
  742. font-weight: bold;
  743. text {
  744. font-size: 14px;
  745. }
  746. }
  747. .money:last-child {
  748. font-size: 16px;
  749. color: #858585;
  750. text-decoration: line-through;
  751. }
  752. }
  753. .one_3 {
  754. display: flex;
  755. flex-wrap: wrap;
  756. padding: 1vw;
  757. border-bottom: 0.5vw solid var(--f9Color);
  758. .act {
  759. font-size: 12px;
  760. border: 1px solid var(--fFB1Color);
  761. margin: 0 1vw 1vw 0;
  762. color: var(--fFB1Color);
  763. border-radius: 6px;
  764. padding: 0 1vw;
  765. }
  766. .num {
  767. font-size: 12px;
  768. color: #858585;
  769. }
  770. }
  771. .one_4 {
  772. display: flex;
  773. flex-wrap: wrap;
  774. padding: 1vw;
  775. border-bottom: 0.5vw solid var(--f9Color);
  776. .num {
  777. font-size: 12px;
  778. color: #858585;
  779. }
  780. }
  781. .one_5 {
  782. border-bottom: 0.5vw solid var(--f9Color);
  783. padding: 2vw;
  784. .name {
  785. font-size: 17px;
  786. font-weight: bold;
  787. margin: 0 0 2vw 0;
  788. }
  789. .brief {
  790. font-size: 14px;
  791. color: #858585;
  792. margin: 0 0 1vw 0;
  793. }
  794. .money {
  795. font-size: 13px;
  796. color: #858585;
  797. text {
  798. padding: 0 2vw 0 0;
  799. }
  800. }
  801. }
  802. .one_6 {
  803. display: flex;
  804. justify-content: space-between;
  805. padding: 2vw;
  806. border-bottom: 0.5vw solid var(--f9Color);
  807. font-size: 14px;
  808. }
  809. .one_7 {
  810. padding: 2vw;
  811. border-bottom: 2vw solid var(--f9Color);
  812. border-top: 1vw solid var(--f9Color);
  813. .one_7_1 {
  814. padding: 2vw 0;
  815. font-size: 14px;
  816. text {
  817. padding: 0 0 0 1vw;
  818. font-size: 12px;
  819. color: #858585;
  820. }
  821. }
  822. .one_7_2 {
  823. display: flex;
  824. justify-content: space-between;
  825. align-items: center;
  826. padding: 2vw;
  827. border-radius: 5px;
  828. background-color: var(--f9Color);
  829. .image {
  830. width: 20vw;
  831. height: 20vw;
  832. .image {
  833. width: 100%;
  834. height: 100%;
  835. border-radius: 5px;
  836. background-color: #fff;
  837. }
  838. }
  839. .money {
  840. text-align: center;
  841. .money_1 {
  842. font-size: 12px;
  843. color: #858585;
  844. }
  845. .money_2 {
  846. font-size: 12px;
  847. color: #ff0000;
  848. }
  849. }
  850. }
  851. }
  852. .one_8 {
  853. padding: 2vw;
  854. border-bottom: 0.5vw solid var(--f9Color);
  855. .one_8_1 {
  856. margin: 0 0 1vw 0;
  857. display: flex;
  858. .shop_1 {
  859. width: 15vw;
  860. height: 15vw;
  861. border: 1px solid #f1f1f1;
  862. .image {
  863. width: 100%;
  864. height: 100%;
  865. }
  866. }
  867. .shop_2 {
  868. width: 78vw;
  869. padding: 0 0 0 2vw;
  870. .name {
  871. font-size: 14px;
  872. margin: 0 0 1vw 0;
  873. }
  874. .num {
  875. font-size: 12px;
  876. color: #858585;
  877. text:last-child {
  878. color: #000;
  879. }
  880. }
  881. }
  882. }
  883. .one_8_2 {
  884. margin: 0 0 2vw 0;
  885. display: flex;
  886. justify-content: space-between;
  887. padding: 2vw 0;
  888. .score_1 {
  889. width: 33vw;
  890. text-align: center;
  891. font-size: 14px;
  892. color: #858585;
  893. text:nth-child(2) {
  894. color: #ff0000;
  895. }
  896. text:nth-child(3) {
  897. float: right;
  898. }
  899. }
  900. }
  901. .one_8_3 {
  902. display: flex;
  903. justify-content: space-around;
  904. .btn {
  905. width: 40vw;
  906. button {
  907. width: 100%;
  908. font-size: 15px;
  909. }
  910. }
  911. }
  912. }
  913. .one_9 {
  914. padding: 2vw;
  915. .rich-img {
  916. width: 100% !important;
  917. display: block;
  918. }
  919. }
  920. }
  921. .two {
  922. width: 100vw;
  923. height: 8vh;
  924. overflow: hidden;
  925. }
  926. }
  927. .scroll-view {
  928. position: absolute;
  929. top: 0;
  930. left: 0;
  931. right: 0;
  932. bottom: 0;
  933. .list-scroll-view {
  934. display: flex;
  935. flex-direction: column;
  936. }
  937. }
  938. .bar_1 {
  939. position: fixed;
  940. right: 2vw;
  941. bottom: 20vw;
  942. text {
  943. background-color: #858585;
  944. border-radius: 90px;
  945. font-size: 30px;
  946. }
  947. }
  948. .bar_2 {
  949. position: fixed;
  950. right: 2vw;
  951. bottom: 28vw;
  952. width: 27vw;
  953. background: #ffffff;
  954. padding: 0 2vw;
  955. box-shadow: 0 0 5px #858585;
  956. .list {
  957. display: flex;
  958. border-bottom: 1px solid #f1f1f1;
  959. padding: 1vw 0;
  960. .image {
  961. width: 8vw;
  962. height: 8vw;
  963. }
  964. .name {
  965. font-size: 14px;
  966. position: relative;
  967. top: 2vw;
  968. left: 2vw;
  969. }
  970. }
  971. .list:last-child {
  972. border-bottom: none;
  973. }
  974. }
  975. .uni-popup {
  976. z-index: 9999 !important;
  977. }
  978. .popup {
  979. display: flex;
  980. flex-direction: column;
  981. width: 100vw;
  982. height: 60vh;
  983. .close {
  984. text-align: right;
  985. padding: 2vw;
  986. }
  987. }
  988. .dialog {
  989. position: fixed;
  990. width: 100vw;
  991. height: 100vh;
  992. background-color: #000000;
  993. z-index: 99999;
  994. display: flex;
  995. flex-direction: column;
  996. justify-content: center;
  997. }
  998. </style>