detail.vue 29 KB

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