detail.vue 30 KB

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