shops.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <view class="page" v-if="info.id">
  3. <view class="header-sec"></view>
  4. <view class="name-sec flex-col">
  5. <image :src="info.shop_logo" class="img" mode="aspectFill" />
  6. <view class="flex-row group_5">
  7. <view class="flex-row group_6" @tap="tapLove">
  8. <text class="name clamp">{{info.shop_name}}</text>
  9. <image src="/static/love-full.png" class="ic" mode="aspectFill" v-if="info.is_fav_shop === 1" />
  10. <image src="/static/love.png" class="ic" mode="aspectFill" v-else />
  11. </view>
  12. <text class="loc-txt" v-if="info.distance">距您{{info.distance}}</text>
  13. </view>
  14. <view class="stars align-center"><image src="/static/mang_star.png" class="starImg" v-for="(item, idx) in info.rank" :key="idx" /></view>
  15. <text class="group_5 text_4 clamp2">
  16. {{info.shop_desc}}
  17. </text>
  18. <view class="flex-row group_5 loc-wrap">
  19. <view class="flex-row group_7">
  20. <image src="/static/mangd-loc.png" class="image_7" mode="aspectFill" />
  21. <view class="group_8"><text class="text_5 clamp2">{{info.full_address}}</text></view>
  22. </view>
  23. <image src="/static/shops-dire.png" class="image_8" />
  24. </view>
  25. </view>
  26. <view class="pro-sec flex-col">
  27. <text class="title">盲盒</text>
  28. <view class="flex-col">
  29. <view class="flex-row items-start list-item" :key="i" v-for="(item, i) in info.goods">
  30. <image :src="item.goods_img_text" class="image" mode="aspectFill" />
  31. <view class="flex-col group_10">
  32. <view class="flex-col items-start group_11 view_7">
  33. <text class="name clamp">{{item.goods_name}}</text>
  34. <view class="stars align-center"><image src="/static/mang_star.png" class="starImg" v-for="(star, idx) in item.rank" :key="idx" /></view>
  35. <text class="text_10">随机搭配</text>
  36. </view>
  37. <view class="flex-row group_12">
  38. <view class="group_13">
  39. <text class="text_11">¥</text>
  40. <text class="text_12">{{item.shop_price}}</text>
  41. </view>
  42. <text class="text_13">¥{{item.market_price}}</text>
  43. </view>
  44. </view>
  45. <view class="flex-col items-center btn-wrap" @tap="navTo('/pages/mang/confirm',{id:item.id,shopId:info.id},{isCheckLogin:true})">
  46. <text class="txt">立即下单</text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="tab-sec flex-col">
  52. <view class="flex-row tab-wrap">
  53. <text class="tab" :class="{active: curTabIdx === 0}" @tap="tapTab(0)">用户评价</text>
  54. <text class="tab" :class="{active: curTabIdx === 1}" @tap="tapTab(1)">商家故事</text>
  55. </view>
  56. </view>
  57. <view class="eva-sec" v-if="curTabIdx === 0">
  58. <view class="e-top justify-between">
  59. <view class="flex-row e-top-wrap">
  60. <view class="justify-center group_21">
  61. <text class="text_23">{{info.score}}分</text>
  62. <view class="flex-col items-start group_22">
  63. <text class="text_24">总评分</text>
  64. <view class="stars align-center"><image src="/static/mang_star.png" class="starImg" v-for="(item, idx) in 5" :key="idx" /></view>
  65. </view>
  66. <!-- <view class="section_8"></view> -->
  67. </view>
  68. <view class="flex-col items-center group_23">
  69. <text class="text_25">评价</text>
  70. <text class="text_26">{{info.score_num}}条</text>
  71. </view>
  72. <view class="section_8"></view>
  73. <view class="flex-col group_24">
  74. <text class="text_27">好评率</text>
  75. <text class="text_28">{{info.score_rate}}</text>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="division-wrap"></view>
  80. <singleList ref="listRef" url="goods.shopComments" :sendData="reqData" @reqEnd="searchEnd">
  81. <template v-slot:items="{list}">
  82. <evaItem :info="item" v-for="(item,idx) in list" :key="idx" />
  83. <!-- <empty v-if="sRes && sRes==='empty'"/> -->
  84. </template>
  85. </singleList>
  86. </view>
  87. <view class="story-sec" v-else>
  88. <view class="s-top">
  89. <view class="line-wrap flex-row">
  90. <text class="key">
  91. 商家名称:
  92. </text>
  93. <text class="val">{{info.shop_name}}</text>
  94. </view>
  95. <view class="line-wrap flex-row">
  96. <text class="key">
  97. 商家地址:
  98. </text>
  99. <text class="val">{{info.full_address}}</text>
  100. </view>
  101. </view>
  102. <view class="division-wrap"></view>
  103. <view class="promise-wrap">
  104. <view class="name">{{promise.title}}</view>
  105. <view class="content">
  106. {{promise.value}}
  107. </view>
  108. </view>
  109. </view>
  110. <safe-area />
  111. </view>
  112. </template>
  113. <script>
  114. import evaItem from './components/eva-item.vue';
  115. export default {
  116. components: {
  117. evaItem,
  118. },
  119. data() {
  120. return {
  121. id:'', //店铺id
  122. info:{},
  123. curTabIdx:0,
  124. promise:{},
  125. comments:[],
  126. reqData:{}, //请求数据
  127. sRes:'', //搜索结果 empty,noMore
  128. };
  129. },
  130. onReachBottom() {
  131. this.$refs.listRef.getList();
  132. },
  133. onLoad(e) {
  134. this.id = e.id;
  135. this.getInfo();
  136. this.getPromise();
  137. this.$nextTick(()=>{
  138. this.reqData={shop_id:this.id} //请求数据
  139. })
  140. },
  141. methods:{
  142. async getInfo(){
  143. let sendData={
  144. shop_id:this.id,
  145. lng: this.addrInfo.address ? this.addrInfo.address_lng : '',
  146. lat: this.addrInfo.address ? this.addrInfo.address_lat : '',
  147. }
  148. let res = await this.$request('goods.shop',sendData);
  149. this.info = res.data;
  150. },
  151. async tapLove(){
  152. let url = this.info.is_fav_shop === 1 ? 'favorite.cancel' : 'favorite.add';
  153. let sendData={
  154. shop_id:this.id,
  155. }
  156. let res = await this.$request(url,sendData);
  157. this.$tools.msg(res.msg);
  158. this.info.is_fav_shop = this.info.is_fav_shop === 1 ? 0 : 1;
  159. },
  160. tapTab(idx){
  161. if(idx === this.curTabIdx){
  162. return;
  163. }
  164. this.curTabIdx = idx;
  165. },
  166. async getPromise(){
  167. let res = await this.$request('goods.getPromise');
  168. this.promise = res.data;
  169. },
  170. searchEnd({loadingType,pageOneRes}){
  171. if(loadingType === 'noMore' && pageOneRes && pageOneRes.length === 0){
  172. this.sRes='empty';
  173. }else{
  174. this.sRes=loadingType;
  175. }
  176. },
  177. }
  178. };
  179. </script>
  180. <style lang="scss">
  181. page{
  182. background-color: #fff;
  183. }
  184. .header-sec {
  185. background-color: $base-color;
  186. height: 240rpx;
  187. }
  188. .name-sec {
  189. padding: 30rpx 14rpx 31.5rpx 30rpx;
  190. background-color: #ffffff;
  191. box-shadow: 0px 4rpx 18.4rpx 1.6rpx #2a2a2a1a;
  192. border-radius: 20rpx;
  193. position: relative;
  194. width: 690rpx;
  195. margin: -196rpx auto 0;
  196. .img {
  197. width: 154rpx;
  198. height: 154rpx;
  199. position: absolute;
  200. left: 24rpx;
  201. top: 24rpx;
  202. }
  203. .group_5 {
  204. position: relative;
  205. }
  206. .loc-txt {
  207. position: absolute;
  208. top: 0;
  209. right: 0;
  210. z-index: 2;
  211. color: #999999;
  212. font-size: 24rpx;
  213. font-family: PingFang;
  214. }
  215. .group_6 {
  216. margin-right: 93rpx;
  217. margin-left: 172rpx;
  218. .name {
  219. color: #333333;
  220. font-size: 30rpx;
  221. font-family: PingFang;
  222. max-width: 300rpx;
  223. font-weight: bold;
  224. }
  225. .ic {
  226. margin-left: 18rpx;
  227. flex-shrink: 0;
  228. width: 31rpx;
  229. height: 27rpx;
  230. }
  231. }
  232. .stars {
  233. margin-top: 13rpx;
  234. margin-left: 172rpx;
  235. .starImg {
  236. width: 28rpx;
  237. height: 28rpx;
  238. margin-right: 4rpx;
  239. }
  240. }
  241. .text_4 {
  242. margin-left: 172rpx;
  243. margin-top: 12rpx;
  244. align-self: flex-start;
  245. color: #666666;
  246. font-size: 24rpx;
  247. font-family: PingFang;
  248. line-height: 32rpx;
  249. word-wrap: break-word;
  250. }
  251. .loc-wrap {
  252. margin-top: 18rpx;
  253. }
  254. .group_7 {
  255. flex: 1 1 auto;
  256. }
  257. .image_7 {
  258. margin-top: 10.5rpx;
  259. flex-shrink: 0;
  260. width: 18rpx;
  261. height: 22rpx;
  262. }
  263. .group_8 {
  264. margin-left: 16rpx;
  265. flex: 1 1 auto;
  266. line-height: 37rpx;
  267. height: 74rpx;
  268. }
  269. .text_5 {
  270. color: #666666;
  271. font-size: 24rpx;
  272. font-family: PingFang;
  273. line-height: 37rpx;
  274. }
  275. .image_8 {
  276. margin-left: 40rpx;
  277. margin-right: 28rpx;
  278. align-self: center;
  279. width: 30rpx;
  280. height: 30rpx;
  281. flex-shrink: 0;
  282. }
  283. }
  284. .pro-sec {
  285. padding: 29rpx 20rpx 0;
  286. background-color: #ffffff;
  287. box-shadow: 0px 4rpx 18.4rpx 1.6rpx #2a2a2a1a;
  288. border-radius: 20rpx;
  289. width: 690rpx;
  290. margin: 24rpx auto 0;
  291. .title {
  292. margin-left: 6rpx;
  293. align-self: flex-start;
  294. color: #333333;
  295. font-size: 34rpx;
  296. font-family: PingFang;
  297. font-weight: bold;
  298. }
  299. .list-item {
  300. padding: 29rpx 4rpx 25rpx;
  301. border-bottom: solid 1rpx #0000000f;
  302. position: relative;
  303. &:last-child {
  304. border: none;
  305. }
  306. }
  307. .image {
  308. flex-shrink: 0;
  309. width: 200rpx;
  310. height: 200rpx;
  311. }
  312. .group_10 {
  313. margin-left: 20rpx;
  314. flex: 1 1 auto;
  315. }
  316. .group_11 {
  317. flex: 1 1 auto;
  318. }
  319. .view_7 {
  320. flex: initial;
  321. }
  322. .name {
  323. color: #333333;
  324. font-size: 30rpx;
  325. font-family: PingFang;
  326. max-width: 400rpx;
  327. font-weight: bold;
  328. }
  329. .stars {
  330. margin-top: 11rpx;
  331. .starImg {
  332. width: 28rpx;
  333. height: 28rpx;
  334. margin-right: 4rpx;
  335. }
  336. }
  337. .text_10 {
  338. margin-top: 21rpx;
  339. color: #999999;
  340. font-size: 24rpx;
  341. font-family: PingFang;
  342. line-height: 23rpx;
  343. }
  344. .group_12 {
  345. margin-top: 57rpx;
  346. }
  347. .group_13 {
  348. line-height: 28rpx;
  349. height: 29rpx;
  350. }
  351. .text_11 {
  352. color: #ff3e3e;
  353. font-size: 24rpx;
  354. font-family: PingFang;
  355. line-height: 19rpx;
  356. }
  357. .text_12 {
  358. color: #ff3e3e;
  359. font-size: 36rpx;
  360. font-family: PingFang;
  361. line-height: 28rpx;
  362. }
  363. .text_13 {
  364. margin-left: 10rpx;
  365. margin-top: 9rpx;
  366. color: #999999;
  367. font-size: 24rpx;
  368. font-family: PingFang;
  369. line-height: 20rpx;
  370. text-decoration: line-through;
  371. }
  372. .btn-wrap {
  373. padding: 18rpx 0 17rpx;
  374. flex-shrink: 0;
  375. background-color: #92b99c;
  376. border-radius: 32rpx;
  377. width: 168rpx;
  378. height: 64rpx;
  379. position: absolute;
  380. bottom: 26rpx;
  381. right: 10rpx;
  382. z-index: 2;
  383. .txt {
  384. color: #ffffff;
  385. font-size: 30rpx;
  386. font-family: PingFang;
  387. line-height: 29rpx;
  388. }
  389. }
  390. }
  391. .tab-sec {
  392. margin-top: 43rpx;
  393. padding: 0 54rpx;
  394. .tab-wrap {
  395. padding-bottom: 20rpx;
  396. border-bottom: 2rpx solid #eee;
  397. }
  398. .tab {
  399. margin-right: 65rpx;
  400. color: #999999;
  401. font-size: 34rpx;
  402. font-family: PingFang;
  403. position: relative;
  404. &.active {
  405. color: #333333;
  406. font-weight: bold;
  407. &::after {
  408. content: '';
  409. background-color: #92b99c;
  410. width: 41rpx;
  411. height: 4rpx;
  412. position: absolute;
  413. left: 50%;
  414. transform: translateX(-50%);
  415. bottom: -18rpx;
  416. }
  417. }
  418. }
  419. }
  420. .division-wrap {
  421. width: 750rpx;
  422. height: 17rpx;
  423. background: #000000;
  424. opacity: 0.06;
  425. }
  426. .eva-sec {
  427. .e-top {
  428. padding: 17rpx 3rpx 19rpx;
  429. .group_21 {
  430. margin: 5rpx 0 8rpx;
  431. // padding: 0 30rpx;
  432. flex:1;
  433. border-right: 2rpx solid #eee;
  434. }
  435. .text_23 {
  436. align-self: center;
  437. color: #ff3e3e;
  438. font-size: 36rpx;
  439. font-family: PingFang;
  440. margin-right: 10rpx;
  441. }
  442. .group_22 {
  443. flex-shrink: 0;
  444. }
  445. .text_24 {
  446. color: #999999;
  447. font-size: 24rpx;
  448. font-family: PingFang;
  449. }
  450. .stars {
  451. margin-top: 6rpx;
  452. .starImg {
  453. width: 28rpx;
  454. height: 28rpx;
  455. margin-right: 4rpx;
  456. }
  457. }
  458. .section_8 {
  459. background-color: #0000000f;
  460. width: 2rpx;
  461. height: 70rpx;
  462. }
  463. .group_23 {
  464. margin: 4rpx 0 8rpx;
  465. width: 200rpx;
  466. }
  467. .text_25 {
  468. color: #999999;
  469. font-size: 24rpx;
  470. font-family: PingFang;
  471. }
  472. .text_26 {
  473. margin-top: 13rpx;
  474. color: #333333;
  475. font-size: 24rpx;
  476. font-family: PingFang;
  477. }
  478. .group_24 {
  479. margin: 4rpx 0 10rpx 0;
  480. width: 200rpx;
  481. }
  482. .text_27 {
  483. align-self: center;
  484. color: #999999;
  485. font-size: 24rpx;
  486. font-family: PingFang;
  487. }
  488. .text_28 {
  489. margin-top: 15rpx;
  490. align-self: center;
  491. color: #333333;
  492. font-size: 24rpx;
  493. font-family: PingFang;
  494. }
  495. }
  496. .e-top-wrap{
  497. width: 100%;
  498. }
  499. }
  500. .story-sec{
  501. padding-top: 30rpx;
  502. .s-top{
  503. padding-bottom: 30rpx;
  504. }
  505. .line-wrap{
  506. padding: 0 30rpx;
  507. margin-bottom: 20rpx;
  508. &:last-child{
  509. margin-bottom: 0;
  510. }
  511. .key{
  512. margin-right: 38rpx;
  513. font-size: 30rpx;
  514. font-family: PingFang SC;
  515. font-weight: 500;
  516. color: #999999;
  517. line-height: 36rpx;
  518. }
  519. .val{
  520. font-size: 30rpx;
  521. font-family: PingFang SC;
  522. font-weight: 500;
  523. color: #333333;
  524. line-height: 36rpx;
  525. max-width: 500rpx;
  526. }
  527. }
  528. .rich-wrap{
  529. background-color: #fff;
  530. .rich {
  531. line-height: normal;
  532. }
  533. }
  534. .promise-wrap{
  535. padding: 40rpx 30rpx 30rpx;
  536. .name{
  537. font-size: 30rpx;
  538. font-family: PingFang SC;
  539. font-weight: bold;
  540. color: #333333;
  541. }
  542. .content{
  543. width: 696rpx;
  544. font-size: 24rpx;
  545. font-family: PingFang SC;
  546. font-weight: 500;
  547. color: #666666;
  548. line-height: 42rpx;
  549. margin: 30rpx auto 0;
  550. }
  551. }
  552. }
  553. </style>