detail.vue 28 KB

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