shop.vue 15 KB

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