detail.vue 29 KB

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