detail.vue 29 KB

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