detail.vue 30 KB

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