shop.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  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="mb-box"></view>
  5. <view class="nav-box">
  6. <Nav :leftShow='false' :customNav='true' bgckgroundBox='transparent'>
  7. <template>
  8. <view slot="custom" class="">
  9. <image class="nav-img" @click="toBack()" src="@/static/img/takeout/bg-back.png"
  10. mode="scaleToFill"></image>
  11. </view>
  12. </template>
  13. </Nav>
  14. </view>
  15. <view class="head-box bgc-f box-border-box plr-24" :style="{height:domHeigjt + 'rpx'}">
  16. <view id="shopInfoBox" class="shop-info-box bgc-f box-border-box p-24">
  17. <view class="info-box-top flex-justify-space mb-10">
  18. <view class="box-top-left">
  19. <view class="top-left-1 fs-40 fw-600 text-overflow-ellipsis-one">{{shopsInfo.shop_name}}
  20. </view>
  21. <view class="align-items-center mb-8">
  22. <image class="img-x mr-12" src="@/static/img/my/wdpj.png" mode=""></image>
  23. <view class="fs-26 fw-600 fc-FF7F00 mr-12">{{shopsInfo.shop_score}}分</view>
  24. <view class="fc-6 fs-24 mr-12">| 预计{{shopsInfo.delivery_time}}分钟 |</view>
  25. <view class="fc-6 fs-24 mr-12">{{shopsInfo.shop_sales}}人购买</view>
  26. </view>
  27. </view>
  28. <image class="box-top-right" :src="shopsInfo.shop_logo" mode="scaleToFill"></image>
  29. </view>
  30. <view class="fs-24 fw-400 fc-9 text-overflow-ellipsis-one">
  31. 公告:{{shopsInfo.notice}}
  32. </view>
  33. <view class="flex-wrap-wrap p-t-20" v-if="couponData.length>0">
  34. <view class="info-box-quan-list" v-for="(item,i) in couponData" :key="i" @click="openCoupon">
  35. <view class="" v-if="i<=2">
  36. <image src="@/static/img/takeout/quan-bg.png" mode=""></image>
  37. <view class="quan-list-1 fw-b fs-32 fc-f">
  38. <span class="fw-b fs-20 fc-f">¥</span>{{item.money}}
  39. </view>
  40. <view class="quan-list-2 fw-400 fs-24 fc-f">领</view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="head-box-1 bgc-f box-border-box plr-24">
  47. <view class="align-items-center shop-type-list">
  48. <view class="shop-item fs-36" @click="seletShopType(item)"
  49. :class="shopType === item.id?'s-item':'n-item'" v-for="(item,i) in shopTypeList" :key="i">
  50. {{item.name}}
  51. <!-- <view v-if="item.id == 2" class="pj-num" :class="shopType === item.id?'s-item':'n-item'">999+</view> -->
  52. </view>
  53. <view class="shop-item-bs" :style="{left:shopTypeBsLeft+'rpx'}"></view>
  54. </view>
  55. </view>
  56. <view class="common-view-css bgc-f" style="overflow: hidden;">
  57. <Menu style="height: 100%;" v-if="shopType === 1" :shop_id="shop_id"></Menu>
  58. <Evaluate style="height: 100%;" :shopId='shop_id' :shopScore='shopsInfo.shop_score' 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. operate_id: '',
  213. shopsInfo: {},
  214. couponData: [], // 可领优惠卷
  215. goodsData: [], // 可领优惠卷
  216. categoryData: [], // 可领优惠卷
  217. }
  218. },
  219. onLoad(e) {
  220. if (e) {
  221. this.shop_id = e.shop_id
  222. this.operate_id = uni.getStorageSync('operate_id')
  223. this.shopInfo()
  224. }
  225. },
  226. mounted() {
  227. // this.getDomH();
  228. this.shopCoupon()
  229. },
  230. methods: {
  231. receiveCode(item) {
  232. receiveCoupon({grant_id: item.grant_id,coupon_id: item.coupon_id}).then((res) => {
  233. if(res.code == 1) {
  234. tools.success(res.msg)
  235. this.couponData = []
  236. this.shopCoupon()
  237. }else {
  238. tools.error(res.msg)
  239. }
  240. })
  241. },
  242. toBack() {
  243. tools.leftClick()
  244. },
  245. getDomH() {
  246. let info = uni.createSelectorQuery().select('#shopInfoBox');
  247. info.boundingClientRect((data) => {
  248. this.domHeigjt = data.height * 2 - 34
  249. }).exec()
  250. },
  251. scrolltolower() {
  252. console.log('触底');
  253. },
  254. seletShopType(item) {
  255. if (this.shopType != item.id) {
  256. this.shopType = item.id;
  257. if (this.shopType == 1) {
  258. this.shopTypeBsLeft = 12
  259. } else if (this.shopType == 2) {
  260. this.shopTypeBsLeft = 166
  261. } else {
  262. this.shopTypeBsLeft = 160 * 2
  263. }
  264. }
  265. },
  266. openBuyCrad() {
  267. this.$refs.popupBuy.open()
  268. },
  269. createOrder() {
  270. },
  271. openCoupon() {
  272. this.$refs.popupCoupon.open()
  273. },
  274. closeCoupon() {
  275. this.$refs.popupCoupon.close()
  276. },
  277. toConfirmOrder() {
  278. uni.navigateTo({
  279. url: '/pages-takeout/confirm-order'
  280. })
  281. },
  282. shopInfo() {
  283. const operate_id = uni.getStorageSync('operate_id')
  284. shopInfo({
  285. operate_id: operate_id,
  286. shop_id: this.shop_id
  287. }).then((res) => {
  288. if (res.code == 1) {
  289. this.shopsInfo = res.data
  290. }else {
  291. tools.error(res.msg)
  292. tools.leftClick()
  293. }
  294. })
  295. },
  296. shopCoupon() {
  297. shopCoupon({
  298. operate_id: this.operate_id,
  299. shop_id: this.shop_id
  300. }).then((res) => {
  301. if (res.code == 1) {
  302. if(res.data.length>0) {
  303. this.domHeigjt = 224
  304. this.couponData = res.data
  305. }else {
  306. this.domHeigjt = 156
  307. // console.log(this.domHeigjt, '1111111111111111111');
  308. }
  309. }
  310. })
  311. }
  312. },
  313. }
  314. </script>
  315. <style scoped lang="scss">
  316. .blank-text{
  317. line-height: 32vh;
  318. }
  319. .pop-coupon {
  320. width: 100%;
  321. height: 42vh;
  322. background-color: #F5F4F9;
  323. border-radius: 24rpx 24rpx 0rpx 0rpx;
  324. padding-top: 32rpx !important;
  325. display: flex;
  326. flex-direction: column;
  327. .box-title {
  328. position: relative;
  329. .box-close {
  330. position: absolute;
  331. right: 22rpx;
  332. }
  333. }
  334. .item-right {
  335. padding: 24rpx;
  336. box-sizing: border-box;
  337. border-radius: 20rpx 0 0 20rpx;
  338. position: relative;
  339. }
  340. .item-hr {
  341. width: 0px;
  342. height: auto;
  343. border-right: 1rpx dashed #FB7850;
  344. }
  345. .item-hr-two {
  346. width: 0px;
  347. height: auto;
  348. border-right: 1rpx dashed #999;
  349. }
  350. .item-left {
  351. width: 220rpx;
  352. height: auto;
  353. padding: 20rpx 24rpx;
  354. box-sizing: border-box;
  355. position: relative;
  356. border-radius: 0 20rpx 20rpx 0;
  357. }
  358. .but-box {
  359. width: 152rpx;
  360. height: 52rpx;
  361. line-height: 52rpx;
  362. text-align: center;
  363. background: linear-gradient(225deg, #FB3D03 0%, #FF6901 100%);
  364. border-radius: 200rpx;
  365. }
  366. .ball {
  367. width: 24rpx;
  368. height: 24rpx;
  369. border-radius: 50%;
  370. position: absolute;
  371. top: -12rpx;
  372. left: -12rpx;
  373. background: #F5F5F5;
  374. z-index: 2;
  375. }
  376. .ball-two {
  377. width: 24rpx;
  378. height: 24rpx;
  379. border-radius: 50%;
  380. position: absolute;
  381. background: #F5F5F5;
  382. z-index: 10;
  383. bottom: -12rpx;
  384. left: -12rpx;
  385. }
  386. }
  387. .shop-index {
  388. position: relative;
  389. .right-only-right-red {
  390. width: 44rpx;
  391. height: 44rpx;
  392. line-height: 40rpx;
  393. border-radius: 12rpx;
  394. border: 1rpx solid #41ABF5;
  395. color: #41ABF5;
  396. }
  397. .right-only-right-add {
  398. width: 44rpx;
  399. height: 44rpx;
  400. line-height: 40rpx;
  401. background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
  402. border-radius: 12rpx;
  403. }
  404. .right-only-right-2 {
  405. min-width: 50rpx;
  406. }
  407. .w-514 {
  408. width: 514rpx;
  409. }
  410. .bg-img {
  411. position: absolute;
  412. top: 0;
  413. left: 0;
  414. width: 100%;
  415. height: 280rpx;
  416. z-index: -1;
  417. }
  418. .mb-box{
  419. position: absolute;
  420. top: 0;
  421. left: 0;
  422. width: 100%;
  423. height: 280rpx;
  424. z-index: -1;
  425. background: rgba(51, 51, 51, 0.50);
  426. }
  427. .nav-box {
  428. margin-bottom: 110rpx;
  429. .nav-img {
  430. width: 56rpx;
  431. height: 56rpx;
  432. }
  433. }
  434. .shop-buttom-money {
  435. width: 100%;
  436. height: 140rpx;
  437. background: rgba(255, 255, 255, 0.8);
  438. padding: 20rpx 24rpx;
  439. .shop-buttom-money-1 {
  440. width: 100%;
  441. height: 100%;
  442. background: #333333;
  443. border-radius: 200rpx;
  444. box-sizing: border-box;
  445. padding-left: 136rpx;
  446. // padding-right: 32rpx;
  447. position: relative;
  448. image {
  449. position: absolute;
  450. bottom: 0;
  451. left: 8rpx;
  452. width: 128rpx;
  453. height: 128rpx;
  454. }
  455. .shop-buttom-num {
  456. width: 32rpx;
  457. height: 32rpx;
  458. line-height: 32rpx;
  459. background: #FB3D03;
  460. border-radius: 50%;
  461. position: absolute;
  462. top: 36rpx;
  463. left: 82rpx;
  464. }
  465. .shop-buttom-money-2 {
  466. width: 200rpx;
  467. height: 100rpx;
  468. line-height: 100rpx;
  469. background: #41ABF5;
  470. border-radius: 0rpx 200rpx 200rpx 0rpx;
  471. }
  472. }
  473. }
  474. .head-box {
  475. width: 100%;
  476. position: relative;
  477. .shop-info-box {
  478. position: absolute;
  479. top: -50rpx;
  480. left: 24rpx;
  481. width: 702rpx;
  482. // min-height: 156rpx;
  483. border-radius: 20rpx;
  484. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);
  485. .info-box-top {
  486. .box-top-left {
  487. .top-left-1 {
  488. width: 480rpx;
  489. margin-bottom: 8rpx;
  490. }
  491. .img-x {
  492. width: 24rpx;
  493. height: 24rpx;
  494. }
  495. }
  496. .box-top-right {
  497. width: 100rpx;
  498. height: 100rpx;
  499. border-radius: 12rpx;
  500. }
  501. }
  502. .info-box-quan-list {
  503. width: 164rpx;
  504. height: 48rpx;
  505. margin: 0 8rpx 8rpx 0;
  506. position: relative;
  507. image {
  508. width: 164rpx;
  509. height: 48rpx;
  510. position: absolute;
  511. top: 0;
  512. left: 0;
  513. z-index: 1;
  514. }
  515. .quan-list-1 {
  516. position: absolute;
  517. top: 3rpx;
  518. left: 8rpx;
  519. z-index: 2;
  520. }
  521. .quan-list-2 {
  522. position: absolute;
  523. top: 8rpx;
  524. right: 22rpx;
  525. z-index: 2;
  526. }
  527. }
  528. }
  529. }
  530. .head-box-1 {
  531. width: 100%;
  532. height: 88rpx;
  533. border-bottom: 1rpx solid #eee;
  534. .shop-type-list {
  535. height: 88rpx;
  536. position: relative;
  537. .shop-item-bs {
  538. position: absolute;
  539. bottom: 0;
  540. width: 40rpx;
  541. height: 6rpx;
  542. border-radius: 20rpx;
  543. background-color: #41ABF5;
  544. transition: left 0.5s;
  545. }
  546. .shop-item {
  547. margin-right: 90rpx;
  548. position: relative;
  549. .pj-num {
  550. position: absolute;
  551. right: -80rpx;
  552. top: 0;
  553. text-align: left;
  554. width: 80rpx;
  555. }
  556. }
  557. .s-item {
  558. font-weight: 600;
  559. color: #333;
  560. }
  561. .n-item {
  562. font-weight: 400;
  563. color: #666;
  564. }
  565. }
  566. }
  567. .buy-card {
  568. height: 828rpx;
  569. background-color: #fff;
  570. border-radius: 24rpx 24rpx 0rpx 0rpx;
  571. .buy-card-top {
  572. width: 100%;
  573. height: 92rpx;
  574. background: #FCF5DB;
  575. border-radius: 24rpx 24rpx 0rpx 0rpx;
  576. }
  577. .buy-card-item {
  578. width: 100%;
  579. height: 176rpx;
  580. margin-bottom: 32rpx;
  581. image {
  582. width: 152rpx;
  583. height: 152rpx;
  584. border-radius: 12rpx;
  585. margin-right: 20rpx;
  586. }
  587. }
  588. }
  589. }
  590. </style>