detail.vue 29 KB

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