shop.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. <template>
  2. <view class="shop-index iPhone-bottom flex-common-css box-border-box">
  3. <image class="bg-img" :src="shopsInfo.shop_logo" mode="aspectFill"></image>
  4. <view class="nav-box">
  5. <Nav :leftShow='false' :customNav='true' bgckgroundBox='transparent'>
  6. <template>
  7. <view slot="custom" class="">
  8. <image class="nav-img" @click="toBack()" src="@/static/img/takeout/bg-back.png"
  9. mode="scaleToFill"></image>
  10. </view>
  11. </template>
  12. </Nav>
  13. </view>
  14. <view class="head-box bgc-f box-border-box plr-24" :style="{height:domHeigjt + 'rpx'}">
  15. <view id="shopInfoBox" class="shop-info-box bgc-f box-border-box p-24">
  16. <view class="info-box-top flex-justify-space">
  17. <view class="box-top-left">
  18. <view class="top-left-1 fs-40 fw-600 text-overflow-ellipsis-one">{{shopsInfo.shop_name}}
  19. </view>
  20. <view class="align-items-center mb-8">
  21. <image class="img-x mr-12" src="@/static/img/my/wdpj.png" mode=""></image>
  22. <view class="fs-26 fw-600 fc-FF7F00 mr-12">{{shopsInfo.shop_score}}分</view>
  23. <view class="fc-6 fs-24 mr-12">| 预计{{shopsInfo.delivery_time}}分钟 |</view>
  24. <view class="fc-6 fs-24 mr-12">{{shopsInfo.shop_sales}}人购买</view>
  25. </view>
  26. </view>
  27. <image class="box-top-right" :src="shopsInfo.shop_logo" mode="scaleToFill"></image>
  28. </view>
  29. <view class="fs-24 fw-400 fc-9 mb-20 text-overflow-ellipsis-one">
  30. 公告:{{shopsInfo.notice}}
  31. </view>
  32. <view class="flex-wrap-wrap" v-if="couponData.length>0">
  33. <view class="info-box-quan-list" v-for="(item,i) in couponData" :key="i" @click="openCoupon">
  34. <view class="" v-if="i<=2">
  35. <image src="@/static/img/takeout/quan-bg.png" mode=""></image>
  36. <view class="quan-list-1 fw-b fs-32 fc-f">
  37. <span class="fw-b fs-20 fc-f">¥</span>{{item.money}}
  38. </view>
  39. <view class="quan-list-2 fw-400 fs-24 fc-f">领</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="head-box-1 bgc-f box-border-box plr-24">
  46. <view class="align-items-center shop-type-list">
  47. <view class="shop-item fs-32" @click="seletShopType(item)"
  48. :class="shopType === item.id?'s-item':'n-item'" v-for="(item,i) in shopTypeList" :key="i">
  49. {{item.name}}
  50. <!-- <view v-if="item.id == 2" class="pj-num" :class="shopType === item.id?'s-item':'n-item'">999+</view> -->
  51. </view>
  52. <view class="shop-item-bs" :style="{left:shopTypeBsLeft+'rpx'}"></view>
  53. </view>
  54. </view>
  55. <view class="common-view-css bgc-f" style="overflow: hidden;">
  56. <Menu style="height: 100%;" v-if="shopType === 1" :shop_id="shop_id"></Menu>
  57. <Evaluate style="height: 100%;" :shopId='shop_id' :shopScore='shopsInfo.shop_score' v-else-if="shopType === 2"></Evaluate>
  58. <ShopInfo style="height: 100%;" :shopId='shop_id' v-else-if="shopType === 3"></ShopInfo>
  59. </view>
  60. <view class="shop-buttom-money box-border-box" @click="openBuyCrad()">
  61. <view class="shop-buttom-money-1 flex-justify-space align-items-center">
  62. <image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill"></image>
  63. <view class="shop-buttom-num fs-24 fc-f text-align-center">3</view>
  64. <view class="">
  65. <view class="">
  66. <span class="fw-600 fs-24 fc-f">¥</span>
  67. <span class="fw-600 fs-44 fc-f">19.26</span>
  68. </view>
  69. <!-- <view class="fs-24 fc-ADADAD">免配送</view> -->
  70. <view class="fs-24 fc-ff3939">配送费¥10</view>
  71. </view>
  72. <view class="fs-32 fw-600 fc-f mr-30">20元起送</view>
  73. <!-- <view class="shop-buttom-money-2 text-align-center fc-f fs-32 fw-600">去结算</view> -->
  74. </view>
  75. </view>
  76. <uni-popup ref="popupBuy" type="bottom">
  77. <view class="buy-card flex-index-css">
  78. <view class="buy-card-top box-border-box plr-32 flex-justify-space align-items-center">
  79. <view class="">
  80. <span class="fs-32 fc-3 mr-12">已选商品</span>
  81. <span class="fs-32 fc-9">(打包费<span class="fs-32 fc-FB3D03">8元</span>)</span>
  82. </view>
  83. <view class="fs-28 fw-400 fc-9 align-items-center">
  84. <view class="">
  85. <uni-icons type="trash" size="18" color="#999"></uni-icons>
  86. </view>
  87. <view class="fs-28 fw-400 fc-9">清空</view>
  88. </view>
  89. </view>
  90. <view class="scroll-view-css box-border-box p-32">
  91. <view class="buy-card-item display-flex" v-for="(item,i) in 5" :key="i">
  92. <image src="@/static/img/my/bg.png" mode="scaleToFill"></image>
  93. <view class="flex-1">
  94. <view class="w-514 text-overflow-ellipsis-one fs-34 fw-600 mb-12">
  95. [畅销款]奥尔1良烤肉牛油拌饭拌饭[畅销款]奥尔1良烤肉牛油拌饭拌饭</view>
  96. <view class="w-514 text-overflow-ellipsis-one fs-24 fw-400 fc-9 mb-18">不辣,加辣</view>
  97. <view class="flex-justify-space">
  98. <view class="">
  99. <span class="fs-24 fc-FB3D03 fw-400">¥</span>
  100. <span class="fs-40 fc-FB3D03 fw-b">3.99</span>
  101. </view>
  102. <view class="display-flex align-items-center">
  103. <view class="right-only-right-red fw-500 text-align-center fs-36 fc-f">-</view>
  104. <view class="right-only-right-2 text-align-center fs-28 fw-400">1</view>
  105. <view class="right-only-right-add fw-500 text-align-center fs-36 fc-f">+</view>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="shop-buttom-money box-border-box" @click="createOrder()">
  112. <view class="shop-buttom-money-1 flex-justify-space align-items-center">
  113. <image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill"></image>
  114. <view class="shop-buttom-num fs-24 fc-f text-align-center">3</view>
  115. <view class="">
  116. <view class="">
  117. <span class="fw-600 fs-24 fc-f">¥</span>
  118. <span class="fw-600 fs-44 fc-f">19.26</span>
  119. </view>
  120. <!-- <view class="fs-24 fc-ADADAD">免配送</view> -->
  121. <view class="fs-24 fc-ff3939">配送费¥10</view>
  122. </view>
  123. <!-- <view class="fs-32 fw-600 fc-f mr-30">20元起送</view> -->
  124. <view class="shop-buttom-money-2 text-align-center fs-32 fc-f fw-600" @click="toConfirmOrder()">
  125. 去结算</view>
  126. </view>
  127. </view>
  128. </view>
  129. </uni-popup>
  130. <uni-popup ref="popupCoupon" type="bottom">
  131. <view class="pop-coupon box-border-box p-24">
  132. <view class="text-align-center fs-36 fw-600 box-title mb-32">
  133. 本店优惠券
  134. <uni-icons @click="closeCoupon" class="box-close" type="closeempty" size="20"></uni-icons>
  135. </view>
  136. <view class="scroll-view-css">
  137. <view v-if="couponData<= 0" class="blank-text fs-32 fc-6 text-align-center">
  138. 暂无优惠券
  139. </view>
  140. <!-- <EnBlank :customSrc='true' v-if="couponData<= 0">
  141. <template v-slot:blankImg>
  142. <image class="black-img" src="@/static/img/common/no-order.png" mode=""></image>
  143. </template>
  144. </EnBlank> -->
  145. <view class="item-box display-flex mb-20" v-for="(item,index) in couponData" :key="index">
  146. <view class="item-right flex-direction flex-justify-center flex-1 bgc-f">
  147. <view class="fs-28 mb-12 ticket-name text-overflow-ellipsis fc-3 fw-600">
  148. {{item.name}}
  149. </view>
  150. <view class="fs-24 fc-6">
  151. 有效时间:{{item.time_type_str}}
  152. </view>
  153. </view>
  154. <view class="item-hr"></view>
  155. <view class="item-left flex-direction align-items-center flex-justify-center bgc-FCE7E2">
  156. <view class="align-items-center">
  157. <view class="fs-30 fw-600 fc-FB3D03">¥</view>
  158. <view class="fs-48 fw-600 fc-FB3D03">{{item.money}}</view>
  159. </view>
  160. <view class="fs-24 mb-18 fc-6">
  161. 满{{item.full_money}}可用
  162. </view>
  163. <view class="but-box fs-28 fc-f" @click="receiveCode(item)">
  164. 立即领取
  165. </view>
  166. <view class="ball"></view>
  167. <view class="ball-two"></view>
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. </uni-popup>
  173. </view>
  174. </template>
  175. <script>
  176. import Menu from './shop-mod/menu.vue';
  177. import Evaluate from './shop-mod/evaluate.vue';
  178. import ShopInfo from './shop-mod/info.vue';
  179. import tools from "@/service/tools";
  180. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  181. import {
  182. receiveCoupon
  183. } from "@/api/coupon.js"
  184. import {
  185. shopInfo,
  186. shopCoupon
  187. } from "@/api/shop.js"
  188. export default {
  189. components: {
  190. Menu,
  191. Evaluate,
  192. ShopInfo,
  193. EnBlank
  194. },
  195. data() {
  196. return {
  197. domHeigjt: 224,
  198. shopTypeList: [{
  199. name: "点菜",
  200. id: 1
  201. }, {
  202. name: "评价",
  203. id: 2
  204. }, {
  205. name: "店铺",
  206. id: 3
  207. }, ],
  208. shopType: 1, //组件类型
  209. shopTypeBsLeft: 12,
  210. shop_id: '',
  211. operate_id: '',
  212. shopsInfo: {},
  213. couponData: [], // 可领优惠卷
  214. goodsData: [], // 可领优惠卷
  215. categoryData: [], // 可领优惠卷
  216. }
  217. },
  218. onLoad(e) {
  219. if (e) {
  220. this.shop_id = e.shop_id
  221. this.operate_id = uni.getStorageSync('operate_id')
  222. this.shopInfo()
  223. }
  224. },
  225. mounted() {
  226. // this.getDomH();
  227. this.shopCoupon()
  228. },
  229. methods: {
  230. receiveCode(item) {
  231. receiveCoupon({grant_id: item.grant_id,coupon_id: item.coupon_id}).then((res) => {
  232. if(res.code == 1) {
  233. tools.success(res.msg)
  234. this.couponData = []
  235. this.shopCoupon()
  236. }else {
  237. tools.error(res.msg)
  238. }
  239. })
  240. },
  241. toBack() {
  242. tools.leftClick()
  243. },
  244. getDomH() {
  245. let info = uni.createSelectorQuery().select('#shopInfoBox');
  246. info.boundingClientRect((data) => {
  247. this.domHeigjt = data.height * 2 - 34
  248. }).exec()
  249. },
  250. scrolltolower() {
  251. console.log('触底');
  252. },
  253. seletShopType(item) {
  254. if (this.shopType != item.id) {
  255. this.shopType = item.id;
  256. if (this.shopType == 1) {
  257. this.shopTypeBsLeft = 12
  258. } else if (this.shopType == 2) {
  259. this.shopTypeBsLeft = 166
  260. } else {
  261. this.shopTypeBsLeft = 160 * 2
  262. }
  263. }
  264. },
  265. openBuyCrad() {
  266. this.$refs.popupBuy.open()
  267. },
  268. createOrder() {
  269. },
  270. openCoupon() {
  271. this.$refs.popupCoupon.open()
  272. },
  273. closeCoupon() {
  274. this.$refs.popupCoupon.close()
  275. },
  276. toConfirmOrder() {
  277. uni.navigateTo({
  278. url: '/pages-takeout/confirm-order'
  279. })
  280. },
  281. shopInfo() {
  282. const operate_id = uni.getStorageSync('operate_id')
  283. shopInfo({
  284. operate_id: operate_id,
  285. shop_id: this.shop_id
  286. }).then((res) => {
  287. if (res.code == 1) {
  288. this.shopsInfo = res.data
  289. }else {
  290. tools.error(res.msg)
  291. tools.leftClick()
  292. }
  293. })
  294. },
  295. shopCoupon() {
  296. shopCoupon({
  297. operate_id: this.operate_id,
  298. shop_id: this.shop_id
  299. }).then((res) => {
  300. if (res.code == 1) {
  301. if(res.data.length>0) {
  302. this.domHeigjt = 224
  303. this.couponData = res.data
  304. }else {
  305. this.domHeigjt = 156
  306. console.log(this.domHeigjt, '1111111111111111111');
  307. }
  308. }
  309. })
  310. }
  311. },
  312. }
  313. </script>
  314. <style scoped lang="scss">
  315. .blank-text{
  316. line-height: 32vh;
  317. }
  318. .pop-coupon {
  319. width: 100%;
  320. height: 42vh;
  321. background-color: #F5F4F9;
  322. border-radius: 24rpx 24rpx 0rpx 0rpx;
  323. padding-top: 32rpx !important;
  324. display: flex;
  325. flex-direction: column;
  326. .box-title {
  327. position: relative;
  328. .box-close {
  329. position: absolute;
  330. right: 22rpx;
  331. }
  332. }
  333. .item-right {
  334. padding: 24rpx;
  335. box-sizing: border-box;
  336. border-radius: 20rpx 0 0 20rpx;
  337. position: relative;
  338. }
  339. .item-hr {
  340. width: 0px;
  341. height: auto;
  342. border-right: 1rpx dashed #FB7850;
  343. }
  344. .item-hr-two {
  345. width: 0px;
  346. height: auto;
  347. border-right: 1rpx dashed #999;
  348. }
  349. .item-left {
  350. width: 220rpx;
  351. height: auto;
  352. padding: 20rpx 24rpx;
  353. box-sizing: border-box;
  354. position: relative;
  355. border-radius: 0 20rpx 20rpx 0;
  356. }
  357. .but-box {
  358. width: 152rpx;
  359. height: 52rpx;
  360. line-height: 52rpx;
  361. text-align: center;
  362. background: linear-gradient(225deg, #FB3D03 0%, #FF6901 100%);
  363. border-radius: 200rpx;
  364. }
  365. .ball {
  366. width: 24rpx;
  367. height: 24rpx;
  368. border-radius: 50%;
  369. position: absolute;
  370. top: -12rpx;
  371. left: -12rpx;
  372. background: #F5F5F5;
  373. z-index: 2;
  374. }
  375. .ball-two {
  376. width: 24rpx;
  377. height: 24rpx;
  378. border-radius: 50%;
  379. position: absolute;
  380. background: #F5F5F5;
  381. z-index: 10;
  382. bottom: -12rpx;
  383. left: -12rpx;
  384. }
  385. }
  386. .shop-index {
  387. position: relative;
  388. .right-only-right-red {
  389. width: 44rpx;
  390. height: 44rpx;
  391. line-height: 40rpx;
  392. border-radius: 12rpx;
  393. border: 1rpx solid #41ABF5;
  394. color: #41ABF5;
  395. }
  396. .right-only-right-add {
  397. width: 44rpx;
  398. height: 44rpx;
  399. line-height: 40rpx;
  400. background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
  401. border-radius: 12rpx;
  402. }
  403. .right-only-right-2 {
  404. min-width: 50rpx;
  405. }
  406. .w-514 {
  407. width: 514rpx;
  408. }
  409. .bg-img {
  410. position: absolute;
  411. top: 0;
  412. left: 0;
  413. width: 100%;
  414. height: 280rpx;
  415. z-index: -1;
  416. }
  417. .nav-box {
  418. margin-bottom: 110rpx;
  419. .nav-img {
  420. width: 56rpx;
  421. height: 56rpx;
  422. }
  423. }
  424. .shop-buttom-money {
  425. width: 100%;
  426. height: 140rpx;
  427. background: rgba(255, 255, 255, 0.8);
  428. padding: 20rpx 24rpx;
  429. .shop-buttom-money-1 {
  430. width: 100%;
  431. height: 100%;
  432. background: #333333;
  433. border-radius: 200rpx;
  434. box-sizing: border-box;
  435. padding-left: 136rpx;
  436. // padding-right: 32rpx;
  437. position: relative;
  438. image {
  439. position: absolute;
  440. bottom: 0;
  441. left: 8rpx;
  442. width: 128rpx;
  443. height: 128rpx;
  444. }
  445. .shop-buttom-num {
  446. width: 32rpx;
  447. height: 32rpx;
  448. line-height: 32rpx;
  449. background: #FB3D03;
  450. border-radius: 50%;
  451. position: absolute;
  452. top: 36rpx;
  453. left: 82rpx;
  454. }
  455. .shop-buttom-money-2 {
  456. width: 200rpx;
  457. height: 100rpx;
  458. line-height: 100rpx;
  459. background: #41ABF5;
  460. border-radius: 0rpx 200rpx 200rpx 0rpx;
  461. }
  462. }
  463. }
  464. .head-box {
  465. width: 100%;
  466. position: relative;
  467. .shop-info-box {
  468. position: absolute;
  469. top: -50rpx;
  470. left: 24rpx;
  471. width: 702rpx;
  472. // min-height: 156rpx;
  473. border-radius: 20rpx;
  474. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);
  475. .info-box-top {
  476. .box-top-left {
  477. .top-left-1 {
  478. width: 480rpx;
  479. margin-bottom: 8rpx;
  480. }
  481. .img-x {
  482. width: 24rpx;
  483. height: 24rpx;
  484. }
  485. }
  486. .box-top-right {
  487. width: 100rpx;
  488. height: 100rpx;
  489. border-radius: 12rpx;
  490. }
  491. }
  492. .info-box-quan-list {
  493. width: 164rpx;
  494. height: 48rpx;
  495. margin: 0 8rpx 8rpx 0;
  496. position: relative;
  497. image {
  498. width: 164rpx;
  499. height: 48rpx;
  500. position: absolute;
  501. top: 0;
  502. left: 0;
  503. z-index: 1;
  504. }
  505. .quan-list-1 {
  506. position: absolute;
  507. top: 3rpx;
  508. left: 8rpx;
  509. z-index: 2;
  510. }
  511. .quan-list-2 {
  512. position: absolute;
  513. top: 8rpx;
  514. right: 22rpx;
  515. z-index: 2;
  516. }
  517. }
  518. }
  519. }
  520. .head-box-1 {
  521. width: 100%;
  522. height: 88rpx;
  523. border-bottom: 1rpx solid #eee;
  524. .shop-type-list {
  525. height: 88rpx;
  526. position: relative;
  527. .shop-item-bs {
  528. position: absolute;
  529. bottom: 0;
  530. width: 40rpx;
  531. height: 6rpx;
  532. border-radius: 20rpx;
  533. background-color: #41ABF5;
  534. transition: left 0.5s;
  535. }
  536. .shop-item {
  537. margin-right: 90rpx;
  538. position: relative;
  539. .pj-num {
  540. position: absolute;
  541. right: -80rpx;
  542. top: 0;
  543. text-align: left;
  544. width: 80rpx;
  545. }
  546. }
  547. .s-item {
  548. font-weight: 600;
  549. color: #333;
  550. }
  551. .n-item {
  552. font-weight: 400;
  553. color: #999;
  554. }
  555. }
  556. }
  557. .buy-card {
  558. height: 828rpx;
  559. background-color: #fff;
  560. border-radius: 24rpx 24rpx 0rpx 0rpx;
  561. .buy-card-top {
  562. width: 100%;
  563. height: 92rpx;
  564. background: #FCF5DB;
  565. border-radius: 24rpx 24rpx 0rpx 0rpx;
  566. }
  567. .buy-card-item {
  568. width: 100%;
  569. height: 176rpx;
  570. margin-bottom: 32rpx;
  571. image {
  572. width: 152rpx;
  573. height: 152rpx;
  574. border-radius: 12rpx;
  575. margin-right: 20rpx;
  576. }
  577. }
  578. }
  579. }
  580. </style>