detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. <template>
  2. <view class="page">
  3. <view class="swiper-sec">
  4. <swiper :indicator-dots="true" :autoplay="true" :circular="true" :interval="3000" :duration="1000" class="swiper">
  5. <swiper-item v-for="(item, idx) in banners" :key="idx" class="swiper-item">
  6. <view class="img-wrap"><image :src="item" mode="aspectFill" class="img"></image></view>
  7. </swiper-item>
  8. </swiper>
  9. <view class="ic-wrap align-center justify-center" @tap="tapLove">
  10. <image src="/static/love-full.png" mode="aspectFill" class="ic" v-if="info.is_fav_shop === 1"></image>
  11. <image src="/static/love.png" mode="aspectFill" class="ic" v-else></image>
  12. </view>
  13. </view>
  14. <view class="header-sec">
  15. <!-- navTo('/pages/mang/shops',{id:this.info.shop_id}) -->
  16. <view class="flex-col name-wrap" @tap="goShop">
  17. <view class="flex-col">
  18. <view class="flex-row">
  19. <text class="text_2 clamp">{{info.goods_name}}</text>
  20. <view class="text-wrapper text_3 clamp">仅剩{{info.num}}份</view>
  21. </view>
  22. <image
  23. src="/static/mangd-rarrow.png"
  24. class="image_8 image_9"
  25. />
  26. </view>
  27. <view class="align-center group_10">
  28. <view class="stars align-center">
  29. <image
  30. src="/static/mang_star.png"
  31. class="image_10"
  32. v-for="(item,idx) in info.rank"
  33. :key="idx"
  34. />
  35. </view>
  36. <text class="text_4">随机搭配</text>
  37. </view>
  38. </view>
  39. <view class="border-wrap"></view>
  40. <view class="flex-row time-wrap">
  41. <text class="text_5">自提时间</text>
  42. <text class="text_6">{{info.self_hours}}</text>
  43. </view>
  44. <view class="border-wrap"></view>
  45. <view class="flex-col loc-wrap">
  46. <view class="flex-row justify-between items-start">
  47. <view class="flex-row">
  48. <image
  49. src="/static/temp/pro.png"
  50. class="image_12"
  51. mode="aspectFill"
  52. />
  53. <view class="flex-col items-start group_15">
  54. <text class="text_7 clamp">{{info.shop_name}}</text>
  55. <text class="text_8 clamp2">{{info.full_address}}</text>
  56. </view>
  57. </view>
  58. <view class="flex-row group_16">
  59. <view class="flex-col items-center image-wrapper" @tap='goLoc'>
  60. <image
  61. src="/static/mangd-loc.png"
  62. class="image_13"
  63. mode="aspectFill"
  64. />
  65. </view>
  66. <view class="section_5"><!--*--></view>
  67. <view class="flex-col items-center image-wrapper view_3" @tap="makePhone">
  68. <image
  69. src="/static/mang-phone.png"
  70. class="image_14"
  71. mode="aspectFill"
  72. />
  73. </view>
  74. </view>
  75. </view>
  76. <view class="group_17" v-if="info.distance">
  77. <text class="text_9">距离您</text>
  78. <text class="text_10">{{info.distance}}</text>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="line-wrap"></view>
  83. <view class="flex-col items-start tips-wrap">
  84. <text class="title">盲盒内能得到什么</text>
  85. <text class="text_12">{{info.goods_description}}</text>
  86. </view>
  87. <view class="line-wrap"></view>
  88. <view class="review-sec">
  89. <view class="title-wrap align-center justify-between">
  90. <text class="text_14">商品评价</text>
  91. <view class="flex-row group_21" v-if="loaded && comments.length !==0 ">
  92. <text class="text_15">查看全部</text>
  93. <image
  94. src="/static/mangd-rarrow.png"
  95. class="image_8 image_15"
  96. mode="aspectFill"
  97. />
  98. </view>
  99. </view>
  100. <view class="review-wrap">
  101. <evaItem :info="item" v-for="(item,idx) in comments" :key="idx" />
  102. <empty v-if="loaded && comments.length === 0 " marginTop="40rpx"/>
  103. </view>
  104. </view>
  105. <view class="line-wrap"></view>
  106. <view class="rich-wrap">
  107. <view class="title">
  108. {{tips.title}}
  109. </view>
  110. <view class="content">
  111. {{tips.value}}
  112. </view>
  113. </view>
  114. <safe-area height="94rpx">
  115. <template v-slot:btn>
  116. <view class="btn-wrap">
  117. <view class="flex-row group_34">
  118. <view class="flex-col justify-center items-start section_7">
  119. <view class="group_35 align-center">
  120. <text class="text_26">¥</text>
  121. <text class="text_27 clamp">{{info.shop_price}}</text>
  122. </view>
  123. </view>
  124. <view class="flex-col items-center text-wrapper_1" @tap="navTo('/pages/mang/confirm',{id:info.id,shopId:info.shop_id},{isCheckLogin:true})"><text class="text_30">下单</text></view>
  125. </view>
  126. </view>
  127. </template>
  128. </safe-area>
  129. </view>
  130. </template>
  131. <script>
  132. import evaItem from './components/eva-item.vue';
  133. export default {
  134. components: {
  135. evaItem,
  136. },
  137. data() {
  138. return {
  139. info:{},
  140. banners:[],
  141. comments:[],
  142. loaded:false,
  143. sRes:'', //搜索结果 empty,noMore
  144. tips:{},
  145. };
  146. },
  147. onLoad(e) {
  148. this.id = e.id;
  149. this.getInfo();
  150. this.getTips();
  151. this.getComments();
  152. // this.$nextTick(()=>{
  153. // this.reqData={goods_id:this.id} //请求数据
  154. // })
  155. },
  156. methods:{
  157. async getInfo(){
  158. let sendData={
  159. goods_id:this.id,
  160. lng: this.addrInfo.address ? this.addrInfo.address_lng : '',
  161. lat: this.addrInfo.address ? this.addrInfo.address_lat : '',
  162. }
  163. let res = await this.$request('goods.info',sendData);
  164. this.info = res.data.goods_info;
  165. this.banners = this.info.rotation_img.split(',');
  166. },
  167. async getTips(){
  168. let res = await this.$request('goods.getInfoText');
  169. this.tips = res.data;
  170. },
  171. async getComments(){
  172. let res = await this.$request('goods.commentList',{goods_id:this.id,page:1,limit:5});
  173. this.loaded = true;
  174. this.comments = res.data.row;
  175. },
  176. async tapLove(){
  177. let url = this.info.is_fav_shop === 1 ? 'favorite.cancel' : 'favorite.add';
  178. let sendData={
  179. shop_id:this.info.shop_id,
  180. }
  181. let res = await this.$request(url,sendData);
  182. this.$tools.msg(res.msg);
  183. this.info.is_fav_shop = this.info.is_fav_shop === 1 ? 0 : 1;
  184. },
  185. // previewImg(idx){
  186. // let url = [];
  187. // this.$tools.previewImg(url)
  188. // },
  189. searchEnd({loadingType,pageOneRes}){
  190. if(loadingType === 'noMore' && pageOneRes && pageOneRes.length === 0){
  191. this.sRes='empty';
  192. }else{
  193. this.sRes=loadingType;
  194. }
  195. },
  196. makePhone(){
  197. uni.makePhoneCall({
  198. phoneNumber: this.info.shop_mobile
  199. })
  200. },
  201. goLoc(){
  202. uni.openLocation({
  203. latitude: Number(this.info.shop_lat),
  204. longitude:Number(this.info.shop_lng)
  205. })
  206. },
  207. goShop(){
  208. this.navTo('/pages/mang/shops',{id:this.info.shop_id})
  209. },
  210. }
  211. };
  212. </script>
  213. <style lang="scss">
  214. .swiper-sec{
  215. position: relative;
  216. .swiper{
  217. width: 750rpx;
  218. height: 750rpx;
  219. .img-wrap{
  220. position: relative;
  221. &::after{
  222. content: '';
  223. position: absolute;
  224. left: 0;
  225. top: 0;
  226. width: 100%;
  227. height: 100%;
  228. background: linear-gradient(180deg, rgba(0,0,0,0),rgba(0,0,0,.2));
  229. }
  230. }
  231. .img{
  232. width: 750rpx;
  233. height: 750rpx;
  234. }
  235. }
  236. .ic-wrap{
  237. position: absolute;
  238. z-index: 2;
  239. right: 0;
  240. bottom: 0;
  241. width: 118rpx;
  242. height: 94rpx;
  243. .ic{
  244. width: 54rpx;
  245. height: 54rpx;
  246. }
  247. }
  248. }
  249. .name-wrap {
  250. padding: 34rpx 31rpx 37rpx;
  251. .text_2 {
  252. margin: 7rpx 0 6rpx;
  253. color: #333333;
  254. font-size: 32rpx;
  255. font-family: PingFang;
  256. letter-spacing: 1.28rpx;
  257. max-width: 500rpx;
  258. }
  259. .text-wrapper {
  260. margin-left: 10rpx;
  261. padding: 10rpx 10rpx 11rpx;
  262. background-color: #92b99c;
  263. border-radius: 10rpx;
  264. height: 44rpx;
  265. max-width: 160rpx;
  266. }
  267. .text_3 {
  268. margin-left: 10rpx;
  269. margin-right: 5rpx;
  270. color: #ffffff;
  271. font-size: 24rpx;
  272. font-family: PingFang;
  273. // max-width: 110rpx;
  274. text-align: center;
  275. }
  276. .image_8 {
  277. width: 11rpx;
  278. height: 18rpx;
  279. }
  280. .image_9 {
  281. margin-right: 9rpx;
  282. flex-shrink: 0;
  283. align-self: flex-end;
  284. }
  285. .group_10 {
  286. margin-top: 6rpx;
  287. }
  288. .image_10 {
  289. width: 28rpx;
  290. height: 28rpx;
  291. margin-right: 4rpx;
  292. }
  293. .text_4 {
  294. margin-left: 20rpx;
  295. color: #999999;
  296. font-size: 24rpx;
  297. font-family: PingFang;
  298. }
  299. }
  300. .border-wrap{
  301. margin: 0 auto;
  302. width: 710rpx;
  303. height: 2rpx;
  304. background-color: #eee;
  305. }
  306. .time-wrap {
  307. padding: 40rpx 33rpx 39rpx;
  308. .text_5 {
  309. color: #333333;
  310. font-size: 28rpx;
  311. font-family: PingFang;
  312. letter-spacing: 1.12rpx;
  313. }
  314. .text_6 {
  315. margin-left: 28rpx;
  316. margin-top: 3rpx;
  317. color: #999999;
  318. font-size: 24rpx;
  319. font-family: PingFang;
  320. }
  321. }
  322. .loc-wrap {
  323. padding: 40rpx 30rpx 41rpx;
  324. .image_12 {
  325. margin-top: 5rpx;
  326. width: 68rpx;
  327. height: 68rpx;
  328. border-radius: 68rpx;
  329. }
  330. .group_15 {
  331. margin-left: 16rpx;
  332. }
  333. .text_7 {
  334. color: #333333;
  335. font-size: 30rpx;
  336. font-family: PingFang;
  337. max-width: 420rpx;
  338. }
  339. .text_8 {
  340. margin-top: 20rpx;
  341. color: #999999;
  342. font-size: 24rpx;
  343. font-family: PingFang;
  344. max-width: 420rpx;
  345. line-height: 36rpx;
  346. }
  347. .group_16 {
  348. margin-right: 20rpx;
  349. margin-top: 37rpx;
  350. }
  351. .image-wrapper {
  352. align-self: center;
  353. width: 28rpx;
  354. }
  355. .image_13 {
  356. width: 28rpx;
  357. height: 33rpx;
  358. }
  359. .section_5 {
  360. margin-left: 41rpx;
  361. background-color: #0000001a;
  362. width: 1rpx;
  363. height: 65rpx;
  364. }
  365. .view_3 {
  366. margin-left: 40rpx;
  367. }
  368. .image_14 {
  369. width: 28rpx;
  370. height: 28rpx;
  371. }
  372. .group_17 {
  373. margin-left: 3rpx;
  374. align-self: flex-start;
  375. line-height: 23rpx;
  376. margin-top: 10rpx;
  377. }
  378. .text_9 {
  379. color: #999999;
  380. font-size: 24rpx;
  381. font-family: PingFang;
  382. line-height: 23rpx;
  383. }
  384. .text_10 {
  385. color: #92b99c;
  386. font-size: 24rpx;
  387. font-family: PingFang;
  388. line-height: 19rpx;
  389. }
  390. }
  391. .line-wrap {
  392. background-color: #0000000f;
  393. height: 17rpx;
  394. }
  395. .tips-wrap {
  396. padding: 40rpx 32rpx;
  397. .title {
  398. color: #333333;
  399. font-size: 30rpx;
  400. font-family: PingFang;
  401. }
  402. .text_12 {
  403. margin-left: 4rpx;
  404. margin-top: 20rpx;
  405. color: #999999;
  406. font-size: 24rpx;
  407. font-family: PingFang;
  408. line-height: 36rpx;
  409. word-break: break-all;
  410. }
  411. }
  412. .review-sec{
  413. padding-top: 35rpx;
  414. .review-wrap{
  415. min-height: 340rpx;
  416. }
  417. }
  418. .title-wrap {
  419. height: 37rpx;
  420. margin-bottom: 10rpx;
  421. padding: 0 30rpx;
  422. .text_14 {
  423. color: #333333;
  424. font-size: 28rpx;
  425. font-family: PingFang;
  426. letter-spacing: 1.12rpx;
  427. }
  428. .group_21 {
  429. margin-right: 9rpx;
  430. }
  431. .text_15 {
  432. color: #999999;
  433. font-size: 24rpx;
  434. font-family: PingFang;
  435. }
  436. .image_8 {
  437. width: 11rpx;
  438. height: 18rpx;
  439. }
  440. .image_15 {
  441. margin-left: 11rpx;
  442. margin-bottom: 3rpx;
  443. flex-shrink: 0;
  444. }
  445. }
  446. .rich-wrap{
  447. background-color: #fff;
  448. padding: 30rpx;
  449. .title{
  450. font-size: 30rpx;
  451. font-family: PingFang SC;
  452. font-weight: bold;
  453. color: #333333;
  454. }
  455. .content{
  456. margin-top: 20rpx;
  457. font-size: 24rpx;
  458. font-family: PingFang SC;
  459. font-weight: 500;
  460. color: #999999;
  461. line-height: 37rpx;
  462. }
  463. }
  464. .btn-wrap{
  465. // margin-top: 67rpx;
  466. padding: 0 20rpx;
  467. position: fixed;
  468. /* #ifdef H5 */
  469. bottom: calc(var(--window-bottom) / 2);
  470. /* #endif */
  471. /* #ifdef MP */
  472. bottom: calc(var(--safe-area-inset-bottom) / 2);
  473. /* #endif */
  474. z-index: 10;
  475. left: 20rpx;
  476. right: 20rpx;
  477. .section_7 {
  478. padding: 15rpx 30rpx 14rpx;
  479. flex: 1 1 auto;
  480. background-color: #333333;
  481. border-radius: 47rpx 0px 0px 47rpx;
  482. height: 94rpx;
  483. }
  484. .group_35 {
  485. line-height: 26rpx;
  486. }
  487. .text_26 {
  488. color: #ffffff;
  489. font-size: 24rpx;
  490. font-family: PingFang;
  491. }
  492. .text_27 {
  493. color: #ffffff;
  494. font-size: 34rpx;
  495. font-family: PingFang;
  496. max-width: 300rpx;
  497. letter-spacing: 1.36rpx;
  498. }
  499. .text-wrapper_1 {
  500. padding: 31rpx 0;
  501. flex-shrink: 0;
  502. background-color: #92b99c;
  503. border-radius: 0px 47rpx 47rpx 0px;
  504. width: 165rpx;
  505. height: 94rpx;
  506. }
  507. .text_30 {
  508. color: #ffffff;
  509. font-size: 34rpx;
  510. font-family: PingFang;
  511. line-height: 32rpx;
  512. letter-spacing: 1.36rpx;
  513. }
  514. }
  515. </style>