new-shop.vue 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  1. <template>
  2. <view class="shop-index iPhone-bottom flex-direction box-border-box">
  3. <image v-show="!navBgType" class="bg-img" src="@/static/img/order-food/shop-top.png" mode="aspectFill"
  4. :class="scrollTop > newNavHeight?'z-4':'z-3'"></image>
  5. <image v-show="navBgType" class="bg-img-type z-4" src="@/static/img/order-food/shop-top.png" mode="aspectFill"
  6. :style="{height:newNavHeight+'rpx',opacity:opacity}"></image>
  7. <newNav :leftShow="false" :textType='false' class="z-4 mb-32" @navHeight='navHeight'>
  8. <view slot="textContentSlot" class="align-items-center flex-justify-end">
  9. <view class="ss-box b-rad-50 mr-24 align-items-center flex-justify-center z-4" @click.stop="goSearch">
  10. <image class="shop-search" src="@/static/img/order-food/shop-search.png" mode=""></image>
  11. </view>
  12. <view class="dd-box align-items-center flex-justify-center b-rad-200 mr-24 z-4" @click="goToOrder">
  13. <image class="shp-list-img mr-8" src="@/static/img/order-food/shp-list.png" mode=""></image>
  14. <view class="fs-28 fc-f">
  15. 订单
  16. </view>
  17. </view>
  18. </view>
  19. </newNav>
  20. <view class="bgc-f box-border-box plr-32 mb-32 shop-info">
  21. <view class="shop-info-box bgc-f box-border-box p-24 z-3 b-rad-20">
  22. <view class="fs-40 fw-600 text-overflow-ellipsis">
  23. {{shopsInfo.shop_name || ''}}
  24. </view>
  25. <view class="fs-24 fw-400 fc-9 text-overflow-ellipsis-one pt-15">
  26. 公告:{{shopsInfo.notice || '暂无公告'}}
  27. </view>
  28. </view>
  29. </view>
  30. <view class="b-b-eee box-border-box p-0-32-12 align-items-center flex-justify-space z-3 shop-type-box">
  31. <view class="align-items-center shop-type-list">
  32. <view class="shop-item fs-36 mb-8 mr-64" @click="seletShopType(item)"
  33. :class="shopType === item.id?'fc-3 fw-600':'fc-6'" v-for="(item,i) in shopTypeList" :key="i">
  34. {{item.name}}
  35. </view>
  36. <view class="shop-item-bs bgc-FF3333" :style="{left:shopTypeBsLeft+'rpx'}"></view>
  37. </view>
  38. <view class="align-items-center">
  39. <image class="zh-icon mr-8" src="@/static/img/order-food/zh-icon.png" mode="aspectFill"></image>
  40. <view class="fw-600 fs-32 fc-3">
  41. 桌号:{{table_number}}
  42. </view>
  43. </view>
  44. </view>
  45. <!-- <view class="bgc-f sticky-nav" :style="{ height: navBgType?`calc(100vh - ${newNavHeight}rpx - ${48}rpx)`:'auto'}"> -->
  46. <view class="bgc-F7F8FA">
  47. <view class="menu-box box-border-box align-items-flex-start" v-if="shopType === 1">
  48. <view class="menu-box-left" :style="{top: newNavHeight + 'rpx'}">
  49. <view class="menu-box-left-box pb-130 box-border-box"
  50. :style="{height: menuLeftType?`calc(100vh - ${newNavHeight}rpx - ${68}rpx)`:''}">
  51. <view class="menu-type-list fs-26 box-border-box align-items-center flex-justify-center"
  52. v-for="(item,i) in categoryList" :key="i" @click="selectType(item)"
  53. :class="type === item.category_id?'bgc-f fc-3 fw-600':'fc-6 fw-400'"
  54. :id="'left-scroll'+ item.category_id">
  55. {{item.name}}
  56. <view class="menu-type-num fc-f" v-show="item.num > 0">{{item.num > 99?'99+':item.num}}
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="menu-box-only bgc-f pb-130 box-border-box">
  62. <view class="" v-for="(item,i) in goodsList" :key="i" :id="'scroll'+ item.type">
  63. <view class="fs-28 fw-600 fc-3 sticky-nav bgc-f p-20 box-border-box"
  64. :style="{top: newNavHeight + 'rpx'}">
  65. {{item.name}}
  66. </view>
  67. <view class="" v-if="item.list <= 0">
  68. <EnBlank message='暂无商品' :customSrc='true'>
  69. <template v-slot:blankImg>
  70. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode="">
  71. </image>
  72. </template>
  73. </EnBlank>
  74. </view>
  75. <view class="menu-list flex-justify-space box-border-box" v-for="(info,k) in item.list" :key="k"
  76. :id="'goods_id'+ info.goods_id">
  77. <image class="flex-shrink0 goods_img b-rad-12" :src="info.goods_image" mode="scaleToFill">
  78. </image>
  79. <view class="menu-list-right flex-direction flex-justify-space">
  80. <view class="mb-8">
  81. <view class="mb-4 goods-name text-overflow-ellipsis fs-32 fw-600">
  82. {{info.goods_name}}
  83. </view>
  84. <!-- <view class="text-overflow-ellipsis fw-400 fc-9 fs-24 mb-2 goods-name"
  85. v-if="info.spec_type == 1">
  86. {{info.goods_desc?info.goods_desc:''}}
  87. </view> -->
  88. </view>
  89. <view class="flex-justify-space align-items-flex-end">
  90. <view class="">
  91. <span class="fs-24 fw-400 fc-FB3D03">¥</span>
  92. <span
  93. class="fs-40 fw-b fc-FB3D03">{{info.seckill_money>0?info.seckill_money:info.price}}</span>
  94. </view>
  95. <view class="display-flex align-items-center" v-if="info.spec_type == 1">
  96. <image v-show="info.num > 0" class="wh-44" @click="addred(1,info)"
  97. src="@/static/img/order-food/reduce-img.png" mode=""></image>
  98. <view v-show="info.num > 0"
  99. class="right-only-right-2 text-align-center fs-28 fw-400">{{info.num}}
  100. </view>
  101. <image class="wh-44" src="@/static/img/order-food/add-img.png"
  102. @click="addred(2,info)" mode="">
  103. </image>
  104. </view>
  105. <view v-else class="right-only-right text-align-center b-rad-200"
  106. @click="addred(3,info)">
  107. <view class="fw-600 fs-28 fc-f">
  108. 选规格
  109. </view>
  110. <view class="selectedNum" v-if="info.num>0">
  111. {{info.num}}
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. <ShopInfo style="height: 100%;" v-else-if="shopType === 2"></ShopInfo>
  121. </view>
  122. <view v-if="shopType === 1" class="shop-buttom-money box-border-box" @click="openBuyCrad()">
  123. <view
  124. class="shop-buttom-money-1 bgc-f flex-justify-space align-items-center pl-24 box-border-box pr-8 b-rad-200">
  125. <view class="align-items-center">
  126. <image class="gwc-img mr-36" src="@/static/img/order-food/gwc-img.png" mode="scaleToFill"></image>
  127. <view class="shop-buttom-num bgc-FE6B2C fs-24 fc-f text-align-center">{{cartData.total_num}}</view>
  128. <view class="align-items-baseline">
  129. <view class="fw-600 fs-28 fc-3 mr-4">¥</view>
  130. <view class="fw-600 fs-48 fc-3">{{cartData.total_goods_money}}</view>
  131. </view>
  132. </view>
  133. <view class="shop-buttom-money-2 text-align-center fc-f fs-32 fw-600 b-rad-200"
  134. :class="cartData.total_num>0?'':'opacity-4'" @click.stop="toConfirmOrder()">去结算
  135. </view>
  136. </view>
  137. </view>
  138. <uni-popup ref="popupBuy" type="bottom" background-color="transparent" borderRadius='20px 20rpx 0 0'>
  139. <view class="buy-card flex-index-css">
  140. <view class="buy-card-top box-border-box plr-32 flex-justify-space align-items-center b-rad-20-20-0-0">
  141. <view class="">
  142. <span class="fs-32 fc-3 mr-12">已选商品</span>
  143. </view>
  144. <view class="fs-28 fw-400 fc-9 align-items-center" @click.stop="setShopIngDel">
  145. <view class="">
  146. <uni-icons type="trash" size="18" color="#999"></uni-icons>
  147. </view>
  148. <view class="fs-28 fw-400 fc-9">清空</view>
  149. </view>
  150. </view>
  151. <view class="scroll-view-css bgc-ECECEC box-border-box car-scroll-box">
  152. <view class="buy-card-item bgc-f b-rad-20 display-flex p-20 box-border-box"
  153. v-for="(goods,i) in cartData.goods_list" :key="i">
  154. <image class="goods_img flex-shrink0" :src="goods.goods_image" mode="scaleToFill"></image>
  155. <view class="flex-1 flex-direction flex-justify-space">
  156. <view class="">
  157. <view class="w-514 text-overflow-ellipsis-one fs-34 fw-600 mb-8">
  158. {{goods.goods_name}}
  159. </view>
  160. <view class="fc-6" v-show="goods.goods_attr">
  161. {{goods.goods_attr}}
  162. </view>
  163. </view>
  164. <view class="flex-justify-space">
  165. <view class="">
  166. <span class="fs-24 fc-FB3D03 fw-400">¥</span>
  167. <span class="fs-40 fc-FB3D03 fw-b">{{goods.price}}</span>
  168. </view>
  169. <view class="display-flex align-items-center">
  170. <image class="wh-44" @click.stop="setShoppingSave(goods,2)"
  171. src="@/static/img/order-food/reduce-img.png" mode="">
  172. </image>
  173. <view class="right-only-right-2 text-align-center fs-28 fw-400">
  174. {{goods.goods_number}}
  175. </view>
  176. <image class="wh-44" src="/static/img/order-food/add-img.png"
  177. @click.stop="setShoppingSave(goods,1)" mode=""></image>
  178. </view>
  179. </view>
  180. </view>
  181. </view>
  182. <en-blank navBackgroundColor='#ECECEC' v-if="cartData.goods_list.length<=0"
  183. message="快去选购商品吧!~"></en-blank>
  184. </view>
  185. <view class="pop-shop-buttom-money box-border-box" @click="openBuyCrad()">
  186. <view
  187. class="shop-buttom-money-1 bgc-f flex-justify-space align-items-center pl-24 box-border-box pr-8 b-rad-200">
  188. <view class="align-items-center">
  189. <image class="gwc-img mr-36" src="@/static/img/order-food/gwc-img.png" mode="scaleToFill">
  190. </image>
  191. <view class="shop-buttom-num bgc-FE6B2C fs-24 fc-f text-align-center">{{cartData.total_num}}
  192. </view>
  193. <view class="align-items-baseline">
  194. <view class="fw-600 fs-28 fc-3 mr-4">¥</view>
  195. <view class="fw-600 fs-48 fc-3">{{cartData.total_goods_money}}</view>
  196. </view>
  197. </view>
  198. <view class="shop-buttom-money-2 text-align-center fc-f fs-32 fw-600 b-rad-200"
  199. :class="cartData.total_num>0?'':'opacity-4'" @click.stop="toConfirmOrder()">去结算
  200. </view>
  201. </view>
  202. </view>
  203. </view>
  204. </uni-popup>
  205. </view>
  206. </template>
  207. <script>
  208. import ShopInfo from './shop-mod/info.vue';
  209. import tools from "@/service/tools";
  210. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  211. import cartStore from '@/utils/cartStore.js';
  212. import {
  213. getGoodsCategory,
  214. getGoodsGoods
  215. } from '@/api/goods.js'
  216. import {
  217. receiveCoupon
  218. } from "@/api/coupon.js"
  219. import {
  220. shopInfo
  221. } from "@/api/shop.js"
  222. import {
  223. getDeliveryMoney
  224. } from "@/api/common";
  225. import {
  226. getShopIngList,
  227. setShopIngDel,
  228. shoppingSave
  229. } from "@/api/shopping";
  230. export default {
  231. components: {
  232. ShopInfo,
  233. EnBlank
  234. },
  235. data() {
  236. return {
  237. domHeigjt: 0,
  238. shopTypeList: [{
  239. name: "点单",
  240. id: 1
  241. }, {
  242. name: "商家",
  243. id: 2
  244. }],
  245. table_number: '',
  246. shopType: 1, //组件类型
  247. shopTypeBsLeft: 12,
  248. shop_id: '',
  249. operate_id: '',
  250. shopsInfo: {},
  251. isAjax: false,
  252. newNavHeight: '',
  253. navBgType: false,
  254. menuLeftType: false,
  255. scrollTop: 0,
  256. opacity: 0,
  257. heightOne: '',
  258. heightTwo: '',
  259. topHeight: '',
  260. idMark: '', //滚动自适应参数
  261. idMarkTwo: '', //滚动自适应参数
  262. type: '', //默认分类标识
  263. categoryList: [],
  264. goodsList: [],
  265. cartData: {
  266. total_price: 0,
  267. total_num: 0,
  268. pack_price: 0,
  269. total_goods_money: 0,
  270. goods_list: [],
  271. }
  272. }
  273. },
  274. onShow() {
  275. this.getShopIngList();
  276. },
  277. onLoad(e) {
  278. cartStore.setShopId();
  279. this.getshopInfo();
  280. },
  281. mounted() {},
  282. onReachBottom(e) {},
  283. // 监听页面滚动
  284. onPageScroll(e) {
  285. // e.scrollTop 获取滚动条距离页面顶部的距离
  286. this.scrollTop = e.scrollTop
  287. this.opacity = (Number(this.scrollTop) - 30)
  288. // 可以根据滚动位置执行相应逻辑
  289. if (e.scrollTop > 25) {
  290. this.navBgType = true
  291. } else {
  292. this.navBgType = false
  293. }
  294. if (e.scrollTop > (Number(this.newNavHeight) - 4)) {
  295. this.menuLeftType = true
  296. } else {
  297. this.menuLeftType = false
  298. }
  299. },
  300. methods: {
  301. shopInfo() {
  302. // 获取商家详情
  303. shopInfo().then((res) => {
  304. if (res.code === 1) {
  305. this.shopsInfo = res.data
  306. }
  307. })
  308. },
  309. getGoodsCategory() {
  310. //获取商家分类
  311. getGoodsCategory().then((res) => {
  312. if (res.code === 1) {
  313. if (res.data.length > 0) {
  314. this.categoryList = res.data
  315. this.type = res.data[0].category_id
  316. }
  317. }
  318. })
  319. },
  320. getGoodsGoods() {
  321. //获取商家商品列表
  322. getGoodsGoods().then((res) => {
  323. if (res.code === 1) {
  324. // 初始化商品列表
  325. this.goodsList = res.data
  326. // 从购物车数据中回显每个商品的数量
  327. this.updateGoodsNumFromCart()
  328. }
  329. })
  330. },
  331. getShopIngList() {
  332. // 获取购物车列表
  333. const shopCart = cartStore.getShopCart(this.shop_id);
  334. if (shopCart) {
  335. this.cartData = {
  336. ...this.cartData,
  337. total_price: shopCart.total_price,
  338. total_num: shopCart.total_num,
  339. pack_price: shopCart.pack_price, //配送费总额
  340. total_goods_money: shopCart.total_goods_money, //商品价格总额
  341. goods_list: shopCart.goods_list
  342. };
  343. // 同步更新商品列表中的数量
  344. this.updateGoodsNumFromCart();
  345. }
  346. },
  347. getshopInfo() {
  348. this.table_number = uni.getStorageSync('table_number')
  349. this.shopInfo()
  350. this.getGoodsCategory()
  351. this.getGoodsGoods()
  352. },
  353. updateGoodsNumFromCart() {
  354. // 从购物车数据同步商品数量
  355. if (!this.goodsList) return;
  356. const shopCart = cartStore.getShopCart(this.shop_id);
  357. if (!shopCart) return;
  358. // 创建商品数量映射
  359. const goodsQuantityMap = {};
  360. const cartGoodsPackPriceMap = {}; // 存储商品配送费信息
  361. shopCart.goods_list.forEach(item => {
  362. if (!goodsQuantityMap[item.goods_id]) {
  363. goodsQuantityMap[item.goods_id] = 0;
  364. cartGoodsPackPriceMap[item.goods_id] = 0;
  365. }
  366. // 累加同一个商品不同规格的数量
  367. goodsQuantityMap[item.goods_id] += item.goods_number;
  368. // 累加同一个商品不同规格的配送费(按数量计算)
  369. cartGoodsPackPriceMap[item.goods_id] += parseFloat(item.pack_price || 0) * (item
  370. .goods_number || 0);
  371. });
  372. // 更新商品列表数量
  373. this.goodsList.forEach(category => {
  374. if (category.list && category.list.length > 0) {
  375. category.list.forEach(goods => {
  376. goods.num = goodsQuantityMap[goods.goods_id] || 0;
  377. });
  378. }
  379. });
  380. // 更新分类列表中的商品数量
  381. this.updateCategoryNum()
  382. },
  383. updateCategoryNum() {
  384. // 更新分类的商品总数
  385. if (!this.categoryList || !this.goodsList) {
  386. return
  387. }
  388. this.categoryList.forEach(categoryItem => {
  389. // 找到对应的商品分类
  390. const goodsCategory = this.goodsList.find(
  391. category => category.type === categoryItem.category_id
  392. )
  393. if (goodsCategory && goodsCategory.list) {
  394. // 计算该分类下所有商品的总数量
  395. const totalNum = goodsCategory.list.reduce((sum, goods) => {
  396. return sum + (goods.num || 0)
  397. }, 0)
  398. categoryItem.num = totalNum
  399. } else {
  400. categoryItem.num = 0
  401. }
  402. })
  403. },
  404. goToOrder() {
  405. uni.navigateTo({
  406. url: 'pages/order/index'
  407. })
  408. },
  409. goSearch() {
  410. uni.navigateTo({
  411. url: 'pages/index/search-record'
  412. })
  413. },
  414. selectType(item, itemTwo) {
  415. if (this.type != item.category_id) {
  416. this.type = item.category_id;
  417. this.idMark = 'scroll' + item.category_id
  418. // 立即更新
  419. this.$forceUpdate();
  420. // 延迟执行滚动
  421. setTimeout(() => {
  422. this.scrollToCategorySimple(item.category_id);
  423. }, 100);
  424. }
  425. },
  426. // 滚动方法
  427. scrollToCategorySimple(type) {
  428. const query = uni.createSelectorQuery();
  429. const selector = `#scroll${type}`;
  430. uni.pageScrollTo({
  431. selector: selector,
  432. duration: 300,
  433. });
  434. },
  435. addred(type, item) {
  436. if (type === 1) {
  437. // 减
  438. --item.num;
  439. if (item.num >= 0) {
  440. this.shoppingSave(item, item.num)
  441. }
  442. } else if (type === 2) {
  443. // 加
  444. ++item.num;
  445. this.shoppingSave(item, item.num)
  446. } else if (type === 3) {
  447. // 选规格
  448. uni.navigateTo({
  449. url: `pages-takeout/new-specs-info?goods_id=${item.goods_id}&category_id=${item.category_id}&shop_id=${this.shop_id}`
  450. })
  451. }
  452. },
  453. shoppingSave(item, num) {
  454. // 前端处理购物车
  455. if (num <= 0) {
  456. // 数量为0,移除商品
  457. cartStore.removeFromCart(item.goods_id, item.goods_spec || []);
  458. } else {
  459. // 更新商品数量
  460. const success = cartStore.updateQuantity(
  461. item.goods_id,
  462. item.goods_spec || [],
  463. num
  464. );
  465. if (!success) {
  466. // 如果更新失败,尝试添加新商品
  467. cartStore.addToCart(item, item.goods_spec || [], num);
  468. }
  469. }
  470. // 更新页面数据
  471. this.getShopIngList();
  472. this.$forceUpdate();
  473. },
  474. findGoodsInList(goodsId) {
  475. // 在商品列表中查找指定商品
  476. for (let category of this.goodsList) {
  477. if (category.list) {
  478. const goods = category.list.find(item => item.goods_id === goodsId)
  479. if (goods) {
  480. return goods
  481. }
  482. }
  483. }
  484. return null
  485. },
  486. navHeight(e) {
  487. this.newNavHeight = e
  488. },
  489. setShopIngDel() {
  490. uni.showModal({
  491. title: '提示',
  492. content: '是否清除购物车商品?',
  493. success: (res) => {
  494. if (res.confirm) {
  495. cartStore.clearCurrentShopCart();
  496. this.getShopIngList();
  497. this.$refs.popupBuy.close();
  498. uni.showToast({
  499. title: '已清空购物车',
  500. icon: 'success'
  501. });
  502. }
  503. }
  504. });
  505. },
  506. setShoppingSave(item, type) {
  507. if (type === 1) {
  508. // 加
  509. item.goods_number = item.goods_number + 1
  510. } else {
  511. // 减
  512. item.goods_number = item.goods_number - 1
  513. }
  514. if (item.goods_number <= 0) {
  515. // 数量为0,移除商品
  516. cartStore.removeFromCart(item.goods_id, item.goods_spec || []);
  517. } else {
  518. // 更新商品数量
  519. cartStore.updateQuantity(
  520. item.goods_id,
  521. item.goods_spec || [],
  522. item.goods_number
  523. );
  524. }
  525. // 更新页面数据
  526. this.getShopIngList();
  527. },
  528. setCartData(cartData) {
  529. this.cartData = cartData
  530. this.getDeliveryMoney()
  531. },
  532. getDeliveryMoney() {
  533. getDeliveryMoney({
  534. 'school_id': this.operate_id,
  535. 'shop_id': this.shop_id,
  536. }).then(res => {
  537. if (res.code === 1) {
  538. this.delivery_money = res.data.delivery_money * 1
  539. }
  540. })
  541. },
  542. toBack() {
  543. tools.leftClick()
  544. },
  545. getDomH(num) {
  546. this.$nextTick(() => {
  547. let info = uni.createSelectorQuery().select('#shopInfoBox');
  548. info.boundingClientRect((data) => {
  549. if (num === 1) {
  550. this.domHeigjt = data.height + 72
  551. } else {
  552. this.domHeigjt = data.height + 72 + 48
  553. }
  554. }).exec()
  555. })
  556. },
  557. seletShopType(item) {
  558. if (this.shopType != item.id) {
  559. this.shopType = item.id;
  560. if (this.shopType == 1) {
  561. this.shopTypeBsLeft = 12
  562. } else if (this.shopType == 2) {
  563. this.shopTypeBsLeft = 150
  564. } else {
  565. this.shopTypeBsLeft = 160 * 2
  566. }
  567. }
  568. },
  569. openBuyCrad() {
  570. this.$refs.popupBuy.open()
  571. },
  572. createOrder() {
  573. this.$refs.popupBuy.close()
  574. },
  575. toConfirmOrder() {
  576. uni.navigateTo({
  577. url: '/pages-takeout/goods-order'
  578. })
  579. },
  580. shopInfo() {
  581. const operate_id = uni.getStorageSync('operate_id')
  582. shopInfo({
  583. operate_id: operate_id,
  584. shop_id: this.shop_id
  585. }).then((res) => {
  586. if (res.code == 1) {
  587. this.shopsInfo = res.data
  588. } else {
  589. tools.error(res.msg)
  590. setTimeout(() => {
  591. uni.navigateBack({
  592. delta: 1
  593. })
  594. }, 1500)
  595. }
  596. })
  597. }
  598. },
  599. }
  600. </script>
  601. <style scoped lang="scss">
  602. .car-scroll-box {
  603. padding: 12rpx 24rpx calc(env(safe-area-inset-bottom) + 48rpx);
  604. }
  605. .zh-icon {
  606. width: 32rpx;
  607. height: 32rpx;
  608. }
  609. .shp-list-img {
  610. width: 40rpx;
  611. height: 40rpx;
  612. }
  613. .dd-box {
  614. width: 144rpx;
  615. padding: 12rpx 0;
  616. background: rgba(0, 0, 0, 0.14);
  617. }
  618. .ss-box {
  619. width: 64rpx;
  620. height: 64rpx;
  621. background: rgba(0, 0, 0, 0.14);
  622. }
  623. .shop-search {
  624. width: 40rpx;
  625. height: 40rpx;
  626. }
  627. .wh-44 {
  628. width: 44rpx;
  629. height: 44rpx;
  630. }
  631. .blank-text {
  632. line-height: 32vh;
  633. }
  634. .box-title {
  635. position: relative;
  636. }
  637. .box-close {
  638. position: absolute;
  639. right: 22rpx;
  640. }
  641. .pop-coupon {
  642. width: 100%;
  643. height: 42vh;
  644. background-color: #F5F4F9;
  645. border-radius: 24rpx 24rpx 0rpx 0rpx;
  646. padding-top: 32rpx !important;
  647. display: flex;
  648. flex-direction: column;
  649. }
  650. .item-right {
  651. padding: 24rpx;
  652. box-sizing: border-box;
  653. border-radius: 20rpx 0 0 20rpx;
  654. position: relative;
  655. }
  656. .item-hr {
  657. width: 0px;
  658. height: auto;
  659. border-right: 1rpx dashed #FB7850;
  660. }
  661. .item-hr-two {
  662. width: 0px;
  663. height: auto;
  664. border-right: 1rpx dashed #999;
  665. }
  666. .item-left {
  667. width: 220rpx;
  668. height: auto;
  669. padding: 20rpx 24rpx;
  670. box-sizing: border-box;
  671. position: relative;
  672. border-radius: 0 20rpx 20rpx 0;
  673. }
  674. .but-box {
  675. width: 152rpx;
  676. height: 52rpx;
  677. line-height: 52rpx;
  678. text-align: center;
  679. background: linear-gradient(225deg, #FB3D03 0%, #FF6901 100%);
  680. border-radius: 200rpx;
  681. }
  682. .ball {
  683. width: 24rpx;
  684. height: 24rpx;
  685. border-radius: 50%;
  686. position: absolute;
  687. top: -12rpx;
  688. left: -12rpx;
  689. background: #F5F5F5;
  690. z-index: 2;
  691. }
  692. .ball-two {
  693. width: 24rpx;
  694. height: 24rpx;
  695. border-radius: 50%;
  696. position: absolute;
  697. background: #F5F5F5;
  698. z-index: 10;
  699. bottom: -12rpx;
  700. left: -12rpx;
  701. }
  702. .shop-index {
  703. width: 100%;
  704. min-height: 100vh;
  705. height: auto;
  706. position: relative;
  707. }
  708. .right-only-right-red {
  709. width: 44rpx;
  710. height: 44rpx;
  711. line-height: 40rpx;
  712. border-radius: 12rpx;
  713. border: 1rpx solid #41ABF5;
  714. color: #41ABF5;
  715. }
  716. .right-only-right-add {
  717. width: 44rpx;
  718. height: 44rpx;
  719. line-height: 40rpx;
  720. background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
  721. border-radius: 12rpx;
  722. }
  723. .right-only-right-2 {
  724. min-width: 50rpx;
  725. }
  726. .w-514 {
  727. width: 480rpx;
  728. }
  729. .bg-img {
  730. position: fixed;
  731. top: 0;
  732. left: 0;
  733. width: 100%;
  734. height: 300rpx;
  735. transition: linear .3s all;
  736. // height: 300rpx;
  737. }
  738. .bg-img-type {
  739. position: fixed;
  740. top: 0;
  741. left: 0;
  742. width: 100%;
  743. // opacity: 100;
  744. transition: linear .3s all;
  745. }
  746. .mb-box {
  747. position: absolute;
  748. top: 0;
  749. left: 0;
  750. width: 100%;
  751. height: 300rpx;
  752. z-index: -1;
  753. }
  754. .nav-img {
  755. width: 56rpx;
  756. height: 56rpx;
  757. }
  758. .shop-buttom-money {
  759. width: 100%;
  760. // height: 140rpx;
  761. background: rgba(255, 255, 255, 0.8);
  762. padding-left: 24rpx;
  763. padding-right: 24rpx;
  764. padding-bottom: calc(env(safe-area-inset-bottom) + 12rpx);
  765. padding-top: 22rpx;
  766. // padding: 20rpx 24rpx;
  767. position: fixed;
  768. left: 0;
  769. bottom: 0;
  770. z-index: 5;
  771. }
  772. .pop-shop-buttom-money {
  773. width: 100%;
  774. // height: 140rpx;
  775. background: #ECECEC;
  776. padding-left: 24rpx;
  777. padding-right: 24rpx;
  778. padding-bottom: calc(env(safe-area-inset-bottom) + 12rpx);
  779. padding-top: 22rpx;
  780. position: fixed;
  781. left: 0;
  782. bottom: 0;
  783. z-index: 5;
  784. }
  785. .shop-buttom-num {
  786. width: 32rpx;
  787. height: 32rpx;
  788. line-height: 32rpx;
  789. border-radius: 50%;
  790. position: absolute;
  791. top: 0rpx;
  792. left: 85rpx;
  793. border: 1rpx solid #FFFFFF;
  794. }
  795. .shop-buttom-money-2 {
  796. width: 200rpx;
  797. height: 80rpx;
  798. line-height: 80rpx;
  799. background: linear-gradient(270deg, #FF3333 0%, #FE6122 100%);
  800. }
  801. .info-box-top {}
  802. .box-top-right {
  803. width: 100rpx;
  804. height: 100rpx;
  805. border-radius: 12rpx;
  806. }
  807. .box-top-left {}
  808. .top-left-1 {
  809. width: 480rpx;
  810. margin-bottom: 8rpx;
  811. }
  812. .img-x {
  813. width: 24rpx;
  814. height: 24rpx;
  815. }
  816. .buy-card {
  817. height: 60vh;
  818. border-radius: 24rpx 24rpx 0rpx 0rpx;
  819. }
  820. .buy-card-top {
  821. width: 100%;
  822. height: 92rpx;
  823. background: #FCF5DB;
  824. border-radius: 24rpx 24rpx 0rpx 0rpx;
  825. }
  826. .buy-card-item {
  827. width: 100%;
  828. // height: 176rpx;
  829. margin-bottom: 32rpx;
  830. }
  831. .goods_img {
  832. width: 152rpx;
  833. height: 152rpx;
  834. border-radius: 12rpx;
  835. margin-right: 20rpx;
  836. }
  837. .shop-buttom-money-1 {
  838. width: 100%;
  839. height: 96rpx;
  840. position: relative;
  841. }
  842. .gwc-img {
  843. width: 88rpx;
  844. height: 88rpx;
  845. }
  846. .head-box {
  847. width: 100%;
  848. position: relative;
  849. }
  850. .shop-info-box {
  851. box-shadow: 0rpx 8rpx 56rpx 0rpx rgba(154, 152, 152, 0.34);
  852. }
  853. .info-box-quan-list {
  854. width: 164rpx;
  855. height: 48rpx;
  856. margin: 0 8rpx 8rpx 0;
  857. position: relative;
  858. image {
  859. width: 164rpx;
  860. height: 48rpx;
  861. position: absolute;
  862. top: 0;
  863. left: 0;
  864. z-index: 1;
  865. }
  866. }
  867. .quan-list-1 {
  868. position: absolute;
  869. top: 3rpx;
  870. left: 8rpx;
  871. z-index: 2;
  872. }
  873. .quan-list-2 {
  874. position: absolute;
  875. top: 8rpx;
  876. right: 22rpx;
  877. z-index: 2;
  878. }
  879. .shop-type-list {
  880. // height: 88rpx;
  881. position: relative;
  882. }
  883. .shop-item {
  884. position: relative;
  885. }
  886. .pj-num {
  887. position: absolute;
  888. right: -80rpx;
  889. top: 0;
  890. text-align: left;
  891. width: 80rpx;
  892. }
  893. .shop-item-bs {
  894. position: absolute;
  895. bottom: 0;
  896. width: 40rpx;
  897. height: 6rpx;
  898. border-radius: 20rpx;
  899. transition: left 0.5s;
  900. }
  901. .sticky-nav {
  902. width: 100%;
  903. position: sticky;
  904. z-index: 3;
  905. }
  906. .wh-44 {
  907. width: 44rpx;
  908. height: 44rpx;
  909. }
  910. .menu-box-left-f {
  911. position: sticky;
  912. // transition: all .3s ease;
  913. // overflow: auto;
  914. }
  915. .menu-box-left {
  916. width: 160rpx;
  917. height: auto;
  918. position: sticky;
  919. overflow: auto;
  920. // transition: all .3s ease;
  921. // height: 100%;
  922. // background-color: #F7F8FA;
  923. // position: absolute;
  924. // left: 0;
  925. // top: 0;
  926. // border-radius: 0rpx 20rpx 0 0rpx;
  927. }
  928. .menu-box-left-box {
  929. overflow-y: auto;
  930. }
  931. .menu-type-list {
  932. width: 160rpx;
  933. min-height: 108rpx;
  934. padding: 18rpx 28rpx;
  935. position: relative;
  936. z-index: 10;
  937. border-radius: 0rpx 20rpx 20rpx 0rpx;
  938. .menu-type-num {
  939. position: absolute;
  940. top: 2rpx;
  941. right: 8rpx;
  942. padding: 0 6rpx;
  943. min-width: 20rpx;
  944. height: 32rpx;
  945. text-align: center;
  946. line-height: 32rpx;
  947. background: #FE6B2C;
  948. border-radius: 50%;
  949. }
  950. }
  951. .menu-type-list-f {
  952. // width: 160rpx;
  953. background-color: #007AFF;
  954. width: 100%;
  955. height: 100%;
  956. overflow-y: auto;
  957. /* 如果分类项很多,允许内部滚动 */
  958. -webkit-overflow-scrolling: touch;
  959. /* 改善移动端滚动体验 */
  960. // height: 100%;
  961. }
  962. .menu-box-only {
  963. // flex: 1;
  964. width: calc(100% - 160rpx);
  965. }
  966. .menu-box-right {
  967. // flex: 1;
  968. width: 100%;
  969. height: 100%;
  970. // padding: 16rpx 0;
  971. // box-sizing: border-box;
  972. // position: relative;
  973. }
  974. .menu-list {
  975. width: 100%;
  976. padding: 0 20rpx 40rpx;
  977. // height: 200rpx;
  978. // margin-bottom: 40rpx;
  979. .goods_img {
  980. width: 200rpx;
  981. height: 200rpx;
  982. border-radius: 12rpx;
  983. margin-right: 16rpx;
  984. }
  985. .menu-list-right {
  986. flex: 1;
  987. .right-only-right {
  988. width: 116rpx;
  989. height: 44rpx;
  990. background: linear-gradient(270deg, #FF3333 0%, #FE6122 100%);
  991. line-height: 44rpx;
  992. position: relative;
  993. .selectedNum {
  994. position: absolute;
  995. right: -10rpx;
  996. top: -22rpx;
  997. font-size: 24rpx;
  998. color: #fff;
  999. width: 32rpx;
  1000. height: 32rpx;
  1001. line-height: 32rpx;
  1002. background: #FE6B2C;
  1003. border-radius: 50%;
  1004. border: 1rpx solid #FFFFFF;
  1005. }
  1006. }
  1007. .right-only-right-red {
  1008. width: 44rpx;
  1009. height: 44rpx;
  1010. line-height: 40rpx;
  1011. border-radius: 12rpx;
  1012. border: 1rpx solid #41ABF5;
  1013. color: #41ABF5;
  1014. }
  1015. .right-only-right-add {
  1016. width: 44rpx;
  1017. height: 44rpx;
  1018. line-height: 40rpx;
  1019. background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
  1020. border-radius: 12rpx;
  1021. }
  1022. .right-only-right-2 {
  1023. min-width: 50rpx;
  1024. }
  1025. }
  1026. }
  1027. </style>