detail.vue 29 KB

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