new-shop.vue 27 KB

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