LAPTOP-2OQMQSSM\ASUS 7 månader sedan
förälder
incheckning
bb537be00c

+ 1 - 1
api/goods.js

@@ -1,6 +1,6 @@
 import {request} from '../service/ajax.js'
 
-const newsUrl = '/api/goods/'
+const newsUrl = 'api/goods/'
 // 获取商家分类
 export const getGoodsCategory = (data) => request(newsUrl + 'category', 'post', { ...data },false)
 // 获取商家商品列表

+ 14 - 4
api/shopping.js

@@ -1,16 +1,26 @@
 import {request} from '../service/ajax.js'
 
-const newsUrl = '/api/shopping/'
+const newsUrl = 'api/shopping/'
+
+// 添加&更新购物车数量
+export const shoppingSave = (data) => request(newsUrl + 'save', 'post', { ...data },true)
+
+// 删除购物车
+export const setShopIngDel = (data) => request(newsUrl + 'del', 'post', { ...data },false)
+
+// 购物车列表
+export const getShopIngList = (data) => request(newsUrl + 'list', 'post', { ...data },false)
+///////////////////////////////
 // 购物车 添加
 export const setShopIngAdd = (data) => request(newsUrl + 'add', 'post', { ...data },false)
 // 更新  购物车数量
 export const setShopIngNumber = (data) => request(newsUrl + 'number', 'post', { ...data },false)
 
 // 清空 购物车
-export const setShopIngDel = (data) => request(newsUrl + 'del', 'post', { ...data },false)
+// export const setShopIngDel = (data) => request(newsUrl + 'del', 'post', { ...data },false)
 
 // 购物车列表
-export const getShopIngList = (data) => request(newsUrl + 'list', 'post', { ...data },false)
+// export const getShopIngList = (data) => request(newsUrl + 'list', 'post', { ...data },false)
 
 // 添加&更新购物车数量
-export const shoppingSave = (data) => request(newsUrl + 'save', 'post', { ...data },true)
+// export const shoppingSave = (data) => request(newsUrl + 'save', 'post', { ...data },true)

+ 8 - 1
common/css/common.css

@@ -13,6 +13,10 @@ text {
   display: none;
 }
 
+.overf-h{
+  overflow: hidden;
+}
+
 .iPhone-bottom {
   padding-bottom: constant(safe-area-inset-bottom);
   padding-bottom: env(safe-area-inset-bottom);
@@ -198,7 +202,10 @@ text {
   position: relative;
   z-index: 3;
 }
-
+.z-4 {
+  position: relative;
+  z-index: 4;
+}
 /* 字体大小 */
 .fs-18 {
   font-size: 18rpx;

+ 1 - 0
components/en-utils/new-nav/new-nav.vue

@@ -186,6 +186,7 @@
       /* 微信小程序平台 */
       // #ifdef MP-WEIXIN
       this.navHeight = SystemInfomations.navHeight + SystemInfomations.statusBarHeight //头部导航栏总高度
+      this.$emit('navHeight', this.navHeight)
       this.navigationBarHeight = SystemInfomations.navHeight //头部导航栏高度
       this.customHeight = SystemInfomations.menuButtonHeight //胶囊高度
       this.menubarLeft = SystemInfomations.menuButtonLeft //胶囊左边界距离左上角的距离

+ 1063 - 0
pages-takeout/new-shop.vue

@@ -0,0 +1,1063 @@
+<template>
+  <view class="shop-index iPhone-bottom flex-direction box-border-box">
+
+    <image v-show="!navBgType" class="bg-img" src="@/static/img/order-food/shop-top.png" mode="aspectFill"
+      :class="scrollTop > newNavHeight?'z-4':'z-3'"></image>
+    <image v-show="navBgType" class="bg-img-type z-4" src="@/static/img/order-food/shop-top.png" mode="aspectFill"
+      :style="{height:newNavHeight+'rpx',opacity:opacity}"></image>
+
+    <newNav :leftShow="false" :textType='false' class="z-4 mb-32" @navHeight='navHeight'>
+      <view slot="textContent" class="align-items-center flex-justify-end">
+        <view class="ss-box b-rad-50 mr-24 align-items-center flex-justify-center">
+          <image class="shop-search" src="@/static/img/order-food/shop-search.png" mode=""></image>
+        </view>
+        <view class="dd-box align-items-center flex-justify-center b-rad-200 mr-24">
+          <image class="shp-list-img mr-8" src="@/static/img/order-food/shp-list.png" mode=""></image>
+          <view class="fs-28 fc-f">
+            订单
+          </view>
+        </view>
+      </view>
+    </newNav>
+
+    <view class="bgc-f box-border-box plr-32 mb-32 shop-info">
+      <view class="shop-info-box bgc-f box-border-box p-24 z-3 b-rad-20">
+        <view class="fs-40 fw-600 text-overflow-ellipsis mb-16">
+          {{shopsInfo.shop_name || "山海鲜熬老灶麻辣火锅辣火锅辣火11 世家匠心传承店川"}}
+        </view>
+        <view class="fs-24 fw-400 fc-9 text-overflow-ellipsis-one">
+          公告:{{shopsInfo.notice||"第二份半价是同时下相同商品的第二份可享受半价受"}}
+        </view>
+      </view>
+    </view>
+
+    <view class="b-b-eee bgc-f box-border-box p-0-32-12 align-items-center flex-justify-space z-3 shop-type-box">
+      <view class="align-items-center shop-type-list">
+        <view class="shop-item fs-36 mb-8 mr-64" @click="seletShopType(item)"
+          :class="shopType === item.id?'fc-3 fw-600':'fc-6'" v-for="(item,i) in shopTypeList" :key="i">
+          {{item.name}}
+        </view>
+        <view class="shop-item-bs bgc-FF3333" :style="{left:shopTypeBsLeft+'rpx'}"></view>
+      </view>
+      <view class="align-items-center">
+        <image class="zh-icon mr-8" src="@/static/img/order-food/zh-icon.png" mode="aspectFill"></image>
+        <view class="fw-600 fs-32 fc-3">
+          桌号:17
+        </view>
+      </view>
+    </view>
+
+    <!-- <view class="bgc-f sticky-nav" :style="{ height: navBgType?`calc(100vh - ${newNavHeight}rpx - ${48}rpx)`:'auto'}"> -->
+    <view class="bgc-f">
+      <view class="menu-box box-border-box align-items-flex-start" v-if="shopType === 1">
+
+        <view class="menu-box-left" :style="{top: newNavHeight + 'rpx'}">
+          <view class="menu-box-left-box"
+            :style="{height: menuLeftType?`calc(100vh - ${newNavHeight}rpx - ${68}rpx)`:''}">
+            <view class="menu-type-list fs-26 box-border-box align-items-center flex-justify-center"
+              v-for="(item,i) in categoryData" :key="i" @click="selectType(item)"
+              :class="type ===  item.type?'bgc-f fc-3 fw-600':'fc-6 fw-400'" :id="'left-scroll'+ item.type">
+              {{item.name}}
+              <view class="menu-type-num fc-f" v-show="item.num > 0">{{item.num > 99?'99+':item.num}}</view>
+            </view>
+          </view>
+        </view>
+
+        <view class="menu-box-only">
+          <view class="" v-for="(item,i) in categoryData" :key="i" :id="'scroll'+ item.type">
+            <view class="fs-28 fw-600 fc-3 sticky-nav bgc-f p-20 box-border-box" :style="{top: newNavHeight + 'rpx'}">
+              {{item.name}}
+            </view>
+            <view class="menu-list flex-justify-space box-border-box" v-for="(info,k) in item.list" :key="k"
+              :id="'goods_id'+ info.goods_id">
+              <image class="flex-shrink0 goods_img" :src="info.goods_image" mode="scaleToFill"></image>
+              <view class="menu-list-right flex-direction flex-justify-space">
+                <view class="mb-8">
+                  <view class="mb-4 goods-name text-overflow-ellipsis fs-32 fw-600">{{info.goods_name}}
+                  </view>
+                  <view class="text-overflow-ellipsis-one fw-400 fc-9 fs-24 mb-2 goods-name" v-if="info.spec_type == 1">
+                    {{info.goods_desc?info.goods_desc:''}}
+                  </view>
+                  <view class="fw-400 fc-9 fs-24">月销{{info.sales}}</view>
+                </view>
+                <view class="flex-justify-space align-items-flex-end">
+                  <view class="">
+                    <span class="fs-24 fw-400 fc-FB3D03">¥</span>
+                    <span class="fs-40 fw-b fc-FB3D03">{{info.seckill_money>0?info.seckill_money:info.price}}</span>
+                  </view>
+                  <view class="display-flex align-items-center" v-if="info.spec_type == 1">
+                    <image v-show="info.num > 0" class="wh-44" @click="addred(1,i,k,info)"
+                      src="@/static/img/takeout/j.png" mode=""></image>
+                    <view v-show="info.num > 0" class="right-only-right-2 text-align-center fs-28 fw-400">{{info.num}}
+                    </view>
+                    <image class="wh-44" src="@/static/img/takeout/add.png" @click="addred(2,i,k,info)" mode=""></image>
+                  </view>
+                  <view v-else class="right-only-right text-align-center" @click="addred(3,i,k,info)">
+                    <view class="fw-600 fs-28 fc-f">
+                      选规格
+                    </view>
+                    <view class="selectedNum" v-if="info.num>0">
+                      {{info.num}}
+                    </view>
+                  </view>
+                </view>
+              </view>
+            </view>
+          </view>
+        </view>
+
+      </view>
+      <!--      <newMenu style="height: 100%;" v-if="shopType === 1" :menuLeftType='menuLeftType' :newNavHeight='newNavHeight'
+        :shop_id="shop_id" @setCartData="setCartData" @scrollToCategory='handleCategoryScroll' ref="goodsMenu">
+      </newMenu> -->
+      <ShopInfo style="height: 100%;" :shopId='shop_id' v-else-if="shopType === 2"></ShopInfo>
+    </view>
+
+    <!--    <view v-if="shopType === 1" class="shop-buttom-money box-border-box" @click="openBuyCrad()">
+      <view class="shop-buttom-money-1 flex-justify-space align-items-center">
+        <image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill"></image>
+        <view class="shop-buttom-num fs-24 fc-f text-align-center">{{cartData.total_num}}</view>
+        <view class="">
+          <view class="">
+            <span class="fw-600 fs-24 fc-f">¥</span>
+            <span class="fw-600 fs-44 fc-f">{{cartData.total_price}}</span>
+          </view>
+          <view class="fs-24 fc-ADADAD" v-if="delivery_money<=0">免配送</view>
+          <view class="fs-24 fc-f" v-else>配送费¥{{delivery_money}}</view>
+        </view>
+        <view v-if="cartData.is_place_order===1" class="shop-buttom-money-2 text-align-center fc-f fs-32 fw-600"
+          @click.stop="toConfirmOrder()">去结算
+        </view>
+        <view v-else class="err-msg fs-32 fw-600 fc-f mr-30" @click.stop="mustBut">{{cartData.err_msg}}</view>
+      </view>
+    </view> -->
+  </view>
+</template>
+
+<script>
+  import newMenu from './shop-mod/new-menu.vue';
+  import ShopInfo from './shop-mod/info.vue';
+  import tools from "@/service/tools";
+  import EnBlank from "@/components/en-utils/en-blank/en-blank";
+  import {
+    receiveCoupon
+  } from "@/api/coupon.js"
+  import {
+    shopInfo
+  } from "@/api/shop.js"
+  import {
+    getDeliveryMoney
+  } from "@/api/common";
+  import {
+    getShopIngList,
+    setShopIngDel,
+    shoppingSave
+  } from "@/api/shopping";
+  export default {
+    components: {
+      newMenu,
+      ShopInfo,
+      EnBlank
+    },
+    data() {
+      return {
+        domHeigjt: 0,
+        shopTypeList: [{
+          name: "点单",
+          id: 1
+        }, {
+          name: "商家",
+          id: 2
+        }],
+        shopType: 1, //组件类型
+        shopTypeBsLeft: 12,
+        shop_id: '',
+        operate_id: '',
+        shopsInfo: {},
+        cartData: {
+          total_price: 0,
+          total_num: 0,
+          total_goods_money: 0,
+          pack_price: 0,
+          must_category: 0,
+          is_place_order: 0,
+          err_msg: 0,
+          goods_list: [],
+        },
+        isAjax: false,
+        newNavHeight: '',
+        navBgType: false,
+        menuLeftType: false,
+        scrollTop: 0,
+        opacity: 0,
+        heightOne: '',
+        heightTwo: '',
+        topHeight: '',
+        idMark: '', //滚动自适应参数
+        idMarkTwo: '', //滚动自适应参数
+        type: 0, //分类标识
+        typeList: [],
+        categoryData: [{
+            type: 0,
+            name: '测试1',
+            list: [{
+              goods_id: 1,
+              goods_name: '测试商品1-1',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }, {
+              goods_id: 2,
+              goods_name: '测试商品1-2',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }, {
+              goods_id: 3,
+              goods_name: '测试商品1-3',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          }, {
+            type: 1,
+            name: '测试2',
+            list: [{
+              goods_id: 4,
+              goods_name: '测试商品2-1',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }, {
+              goods_id: 5,
+              goods_name: '测试商品2-2',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }, {
+              goods_id: 6,
+              goods_name: '测试商品2-3',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          }, {
+            type: 2,
+            name: '测试3',
+            list: [{
+              goods_id: 7,
+              goods_name: '测试商品3',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          }, {
+            type: 3,
+            name: '测试4',
+            list: [{
+              goods_id: 8,
+              goods_name: '测试商品4',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          }, {
+            type: 4,
+            name: '测试5',
+            list: [{
+              goods_id: 9,
+              goods_name: '测试商品5',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+          {
+            type: 5,
+            name: '测试6',
+            list: [{
+              goods_id: 10,
+              goods_name: '测试商品6',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+          {
+            type: 6,
+            name: '测试7',
+            list: [{
+              goods_id: 11,
+              goods_name: '测试商品7',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+          {
+            type: 7,
+            name: '测试8',
+            list: [{
+              goods_id: 12,
+              goods_name: '测试商品8',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+          {
+            type: 8,
+            name: '测试9',
+            list: [{
+              goods_id: 13,
+              goods_name: '测试商品9',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+        ],
+      }
+    },
+    onShow() {},
+    onLoad(e) {},
+    mounted() {},
+    onReachBottom(e) {
+      console.log(e, '页面触底了');
+      // uni.$emit('shopBottom',true)
+    },
+    // 监听页面滚动
+    onPageScroll(e) {
+      // e.scrollTop 获取滚动条距离页面顶部的距离
+      this.scrollTop = e.scrollTop
+      this.opacity = (Number(this.scrollTop) - 30)
+      // 可以根据滚动位置执行相应逻辑
+      if (e.scrollTop > 25) {
+        this.navBgType = true
+      } else {
+        this.navBgType = false
+      }
+      if (e.scrollTop > (Number(this.newNavHeight) - 4)) {
+        this.menuLeftType = true
+      } else {
+        this.menuLeftType = false
+      }
+    },
+    methods: {
+      selectType(item, itemTwo) {
+        if (this.type != item.type) {
+          this.type = item.type;
+          this.idMark = 'scroll' + item.type
+
+          // 立即更新
+          this.$forceUpdate();
+
+          // 延迟执行滚动
+          setTimeout(() => {
+            this.scrollToCategorySimple(item.type);
+          }, 100);
+        }
+      },
+
+      // 滚动方法
+      scrollToCategorySimple(type) {
+        const query = uni.createSelectorQuery();
+        const selector = `#scroll${type}`;
+        uni.pageScrollTo({
+          selector: selector,
+          duration: 300,
+        });
+        return
+        let targetScrollTop = 0
+        query.select('.shop-info').boundingClientRect(rect => {
+          console.log('商家详情', rect);
+          targetScrollTop += rect.height
+        })
+        query.select('.shop-type-box').boundingClientRect(rect => {
+          console.log('详情切换', rect);
+          targetScrollTop += rect.height + this.newNavHeight
+          console.log('固定上部分位置', targetScrollTop);
+        })
+        query.select(selector).boundingClientRect(rect => {
+          console.log('id找到元素,top:', rect);
+          uni.pageScrollTo({
+            scrollTop: targetScrollTop,
+            duration: 300,
+            success: () => {
+              console.log('滚动完成');
+            }
+          });
+          // 获取当前滚动位置
+          // query.selectViewport().scrollOffset(res => {
+          //   // 计算目标滚动位置
+          //   // 减去固定元素的高度:导航栏 + 店铺信息 + 分类栏
+          //   const navHeight = this.newNavHeight ? uni.upx2px(this.newNavHeight) : 0;
+          //   const fixedOffset = navHeight + 200 + 100; // 可以根据实际情况调整
+
+          //   const targetScrollTop = res.scrollTop + rect.top - fixedOffset;
+
+          //   console.log('当前scrollTop:', res.scrollTop, '目标scrollTop:', targetScrollTop);
+
+          //   // 滚动到目标位置
+          //   uni.pageScrollTo({
+          //     scrollTop: targetScrollTop,
+          //     duration: 300,
+          //     success: () => {
+          //       console.log('滚动完成');
+          //     }
+          //   });
+          // }).exec();
+        }).exec();
+      },
+      getHeight() {
+        const query = uni.createSelectorQuery();
+        query.select('.shop-info').boundingClientRect(data => {
+          this.heightOne = data.height;
+          console.log(this.heightOne, '0000000000');
+        }).exec();
+        query.select('.shop-type-box').boundingClientRect(data => {
+          this.heightTwo = data.height;
+          this.topHeight = this.heightOne + this.heightTwo + this.newNavHeight
+          console.log(this.topHeight, '111111');
+        }).exec();
+      },
+      navHeight(e) {
+        this.newNavHeight = e
+        console.log(e, '000000000');
+      },
+      mustBut() {
+        // 未点必选品
+        const item = {
+          type: this.cartData.must_category
+        }
+        this.$refs.goodsMenu.selectType(item)
+      },
+      setShopIngDel() {
+        uni.showModal({
+          title: '提示',
+          content: '是否清除购物车商品?',
+          success: (res) => {
+            console.log(res)
+            if (res.confirm) {
+              setShopIngDel({
+                'shop_id': this.shop_id,
+                'type': 1,
+              }).then((res) => {
+                if (res.code === 1) {
+                  tools.success(res.msg)
+                  this.getShopIngList()
+                  this.$refs.popupBuy.close()
+                } else {
+                  tools.error(res.msg)
+                }
+              })
+            }
+          }
+        });
+      },
+      setShoppingSave(item, type) {
+        if (type === 1) {
+          // 加
+          item.goods_number = item.goods_number + 1
+        } else {
+          // 减
+          if (item.goods_number < 0) {
+            return
+          }
+          item.goods_number = item.goods_number - 1
+        }
+        if (this.isAjax) {
+          return
+        }
+        this.isAjax = true
+        shoppingSave({
+          'type': 1,
+          'goods_id': item.goods_id,
+          'shop_id': this.shop_id,
+          'category_id': item.category_id,
+          'goods_spec_id': item.goods_spec_id,
+          'number': item.goods_number,
+        }).then(res => {
+          if (res.code == 1) {
+            this.isAjax = false
+            this.getShopIngList()
+          }
+        }).catch(() => {
+          this.isAjax = false
+        })
+      },
+      getShopIngList() {
+        getShopIngList({
+          'shop_id': 111,
+        }).then(res => {
+          if (res.code === 1) {
+            this.cartData = res.data
+            if (this.shopType === 1) {
+              setTimeout(() => {
+                console.log('我的数据执行了')
+                // this.$refs.goodsMenu.setShopIngList(this.cartData)
+              }, 1000)
+
+            }
+          }
+        })
+      },
+      setCartData(cartData) {
+        this.cartData = cartData
+        this.getDeliveryMoney()
+      },
+      getDeliveryMoney() {
+        getDeliveryMoney({
+          'school_id': this.operate_id,
+          'shop_id': this.shop_id,
+        }).then(res => {
+          if (res.code === 1) {
+            this.delivery_money = res.data.delivery_money * 1
+          }
+        })
+      },
+      toBack() {
+        tools.leftClick()
+      },
+      getDomH(num) {
+        this.$nextTick(() => {
+          let info = uni.createSelectorQuery().select('#shopInfoBox');
+          info.boundingClientRect((data) => {
+            if (num === 1) {
+              this.domHeigjt = data.height + 72
+            } else {
+              this.domHeigjt = data.height + 72 + 48
+            }
+          }).exec()
+        })
+        // setTimeout(() => {
+
+        // }, 500)
+      },
+
+      scrolltolower() {
+        console.log('触底');
+      },
+      seletShopType(item) {
+        if (this.shopType != item.id) {
+          this.shopType = item.id;
+          if (this.shopType == 1) {
+            this.shopTypeBsLeft = 12
+          } else if (this.shopType == 2) {
+            this.shopTypeBsLeft = 166
+          } else {
+            this.shopTypeBsLeft = 160 * 2
+          }
+        }
+      },
+      openBuyCrad() {
+        this.$refs.popupBuy.open()
+      },
+      createOrder() {
+        this.$refs.popupBuy.close()
+      },
+      openCoupon() {
+        this.$refs.popupCoupon.open()
+      },
+      closeCoupon() {
+        this.$refs.popupCoupon.close()
+      },
+      toConfirmOrder() {
+        uni.navigateTo({
+          url: '/pages-takeout/goods-order?shop_id=' + this.shop_id
+        })
+      },
+      shopInfo() {
+        const operate_id = uni.getStorageSync('operate_id')
+        shopInfo({
+          operate_id: operate_id,
+          shop_id: this.shop_id
+        }).then((res) => {
+          if (res.code == 1) {
+            this.shopsInfo = res.data
+          } else {
+            tools.error(res.msg)
+            setTimeout(() => {
+              uni.navigateBack({
+                delta: 1
+              })
+            }, 1500)
+          }
+        })
+      }
+    },
+  }
+</script>
+
+<style scoped lang="scss">
+  .zh-icon {
+    width: 32rpx;
+    height: 32rpx;
+  }
+
+  .shp-list-img {
+    width: 40rpx;
+    height: 40rpx;
+  }
+
+  .dd-box {
+    width: 144rpx;
+    padding: 12rpx 0;
+    background: rgba(0, 0, 0, 0.14);
+  }
+
+  .ss-box {
+    width: 64rpx;
+    height: 64rpx;
+    background: rgba(0, 0, 0, 0.14);
+  }
+
+  .shop-search {
+    width: 40rpx;
+    height: 40rpx;
+  }
+
+  .wh-44 {
+    width: 44rpx;
+    height: 44rpx;
+  }
+
+  .blank-text {
+    line-height: 32vh;
+  }
+
+  .box-title {
+    position: relative;
+  }
+
+  .box-close {
+    position: absolute;
+    right: 22rpx;
+  }
+
+  .pop-coupon {
+    width: 100%;
+    height: 42vh;
+    background-color: #F5F4F9;
+    border-radius: 24rpx 24rpx 0rpx 0rpx;
+    padding-top: 32rpx !important;
+    display: flex;
+    flex-direction: column;
+  }
+
+  .item-right {
+    padding: 24rpx;
+    box-sizing: border-box;
+    border-radius: 20rpx 0 0 20rpx;
+    position: relative;
+  }
+
+  .item-hr {
+    width: 0px;
+    height: auto;
+    border-right: 1rpx dashed #FB7850;
+  }
+
+  .item-hr-two {
+    width: 0px;
+    height: auto;
+    border-right: 1rpx dashed #999;
+  }
+
+  .item-left {
+    width: 220rpx;
+    height: auto;
+    padding: 20rpx 24rpx;
+    box-sizing: border-box;
+    position: relative;
+    border-radius: 0 20rpx 20rpx 0;
+  }
+
+  .but-box {
+    width: 152rpx;
+    height: 52rpx;
+    line-height: 52rpx;
+    text-align: center;
+    background: linear-gradient(225deg, #FB3D03 0%, #FF6901 100%);
+    border-radius: 200rpx;
+  }
+
+  .ball {
+    width: 24rpx;
+    height: 24rpx;
+    border-radius: 50%;
+    position: absolute;
+    top: -12rpx;
+    left: -12rpx;
+    background: #F5F5F5;
+    z-index: 2;
+  }
+
+  .ball-two {
+    width: 24rpx;
+    height: 24rpx;
+    border-radius: 50%;
+    position: absolute;
+    background: #F5F5F5;
+    z-index: 10;
+    bottom: -12rpx;
+    left: -12rpx;
+  }
+
+  .shop-index {
+    width: 100%;
+    min-height: 100vh;
+    height: auto;
+    position: relative;
+  }
+
+  .right-only-right-red {
+    width: 44rpx;
+    height: 44rpx;
+    line-height: 40rpx;
+    border-radius: 12rpx;
+    border: 1rpx solid #41ABF5;
+    color: #41ABF5;
+  }
+
+  .right-only-right-add {
+    width: 44rpx;
+    height: 44rpx;
+    line-height: 40rpx;
+    background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
+    border-radius: 12rpx;
+  }
+
+  .right-only-right-2 {
+    min-width: 50rpx;
+  }
+
+  .w-514 {
+    width: 514rpx;
+  }
+
+  .bg-img {
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 300rpx;
+    transition: linear .3s all;
+    // height: 300rpx;
+  }
+
+  .bg-img-type {
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: 100%;
+    // opacity: 100;
+    transition: linear .3s all;
+  }
+
+  .mb-box {
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 300rpx;
+    z-index: -1;
+  }
+
+
+  .nav-img {
+    width: 56rpx;
+    height: 56rpx;
+  }
+
+  .shop-buttom-money {
+    width: 100%;
+    height: 140rpx;
+    background: rgba(255, 255, 255, 0.8);
+    padding: 20rpx 24rpx;
+    position: fixed;
+    left: 0;
+    bottom: 0;
+    z-index: 5;
+  }
+
+  .shop-buttom-num {
+    width: 32rpx;
+    height: 32rpx;
+    line-height: 32rpx;
+    background: #FB3D03;
+    border-radius: 50%;
+    position: absolute;
+    top: 36rpx;
+    left: 82rpx;
+  }
+
+  .shop-buttom-money-2 {
+    width: 200rpx;
+    height: 100rpx;
+    line-height: 100rpx;
+    background: #41ABF5;
+    border-radius: 0rpx 200rpx 200rpx 0rpx;
+  }
+
+  .info-box-top {}
+
+  .box-top-right {
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 12rpx;
+  }
+
+  .box-top-left {}
+
+  .top-left-1 {
+    width: 480rpx;
+    margin-bottom: 8rpx;
+  }
+
+  .img-x {
+    width: 24rpx;
+    height: 24rpx;
+  }
+
+  .buy-card {
+    height: 828rpx;
+    background-color: #fff;
+    border-radius: 24rpx 24rpx 0rpx 0rpx;
+  }
+
+  .buy-card-top {
+    width: 100%;
+    height: 92rpx;
+    background: #FCF5DB;
+    border-radius: 24rpx 24rpx 0rpx 0rpx;
+  }
+
+  .buy-card-item {
+    width: 100%;
+    height: 176rpx;
+    margin-bottom: 32rpx;
+  }
+
+  .goods_img {
+    width: 152rpx;
+    height: 152rpx;
+    border-radius: 12rpx;
+    margin-right: 20rpx;
+  }
+
+  .shop-buttom-money-1 {
+    width: 100%;
+    height: 100%;
+    background: #333333;
+    border-radius: 200rpx;
+    box-sizing: border-box;
+    padding-left: 136rpx;
+    // padding-right: 32rpx;
+    position: relative;
+
+    image {
+      position: absolute;
+      bottom: 0;
+      left: 8rpx;
+      width: 128rpx;
+      height: 128rpx;
+    }
+  }
+
+  .head-box {
+    width: 100%;
+    position: relative;
+  }
+
+  .shop-info-box {
+    box-shadow: 0rpx 8rpx 56rpx 0rpx rgba(154, 152, 152, 0.34);
+  }
+
+  .info-box-quan-list {
+    width: 164rpx;
+    height: 48rpx;
+    margin: 0 8rpx 8rpx 0;
+    position: relative;
+
+    image {
+      width: 164rpx;
+      height: 48rpx;
+      position: absolute;
+      top: 0;
+      left: 0;
+      z-index: 1;
+    }
+  }
+
+  .quan-list-1 {
+    position: absolute;
+    top: 3rpx;
+    left: 8rpx;
+    z-index: 2;
+  }
+
+  .quan-list-2 {
+    position: absolute;
+    top: 8rpx;
+    right: 22rpx;
+    z-index: 2;
+  }
+
+  .shop-type-list {
+    // height: 88rpx;
+    position: relative;
+  }
+
+  .shop-item {
+    position: relative;
+  }
+
+  .pj-num {
+    position: absolute;
+    right: -80rpx;
+    top: 0;
+    text-align: left;
+    width: 80rpx;
+  }
+
+  .shop-item-bs {
+    position: absolute;
+    bottom: 0;
+    width: 40rpx;
+    height: 6rpx;
+    border-radius: 20rpx;
+    transition: left 0.5s;
+  }
+
+  .sticky-nav {
+    width: 100%;
+    position: sticky;
+    z-index: 3;
+  }
+
+  .wh-44 {
+    width: 44rpx;
+    height: 44rpx;
+  }
+
+  .menu-box-left-f {
+    position: sticky;
+    // transition: all .3s ease;
+    // overflow: auto;
+  }
+
+  .menu-box-left {
+    width: 160rpx;
+    height: auto;
+    position: sticky;
+    overflow: auto;
+    // transition: all .3s ease;
+    // height: 100%;
+    // background-color: #F7F8FA;
+    // position: absolute;
+    // left: 0;
+    // top: 0;
+    // border-radius: 0rpx 20rpx 0 0rpx;
+  }
+
+  .menu-box-left-box {
+    overflow-y: auto;
+  }
+
+  .menu-type-list {
+    width: 160rpx;
+    min-height: 108rpx;
+    padding: 18rpx 28rpx;
+    position: relative;
+    z-index: 10;
+
+    .menu-type-num {
+      position: absolute;
+      top: 2rpx;
+      right: 8rpx;
+      padding: 0 6rpx;
+      min-width: 20rpx;
+      height: 32rpx;
+      text-align: center;
+      line-height: 32rpx;
+      background: #FB3D03;
+      border-radius: 50%;
+    }
+  }
+
+  .menu-type-list-f {
+    // width: 160rpx;
+    background-color: #007AFF;
+
+    width: 100%;
+    height: 100%;
+    overflow-y: auto;
+    /* 如果分类项很多,允许内部滚动 */
+    -webkit-overflow-scrolling: touch;
+    /* 改善移动端滚动体验 */
+    // height: 100%;
+  }
+
+  .menu-box-only {
+    // flex: 1;
+    width: calc(100% - 160rpx);
+  }
+
+  .menu-box-right {
+    // flex: 1;
+    width: 100%;
+    height: 100%;
+    // padding: 16rpx 0;
+    // box-sizing: border-box;
+    // position: relative;
+  }
+
+  .menu-list {
+    width: 100%;
+    padding: 0 20rpx 40rpx;
+    // height: 200rpx;
+    // margin-bottom: 40rpx;
+
+    .goods_img {
+      width: 200rpx;
+      height: 200rpx;
+      border-radius: 12rpx;
+      margin-right: 16rpx;
+    }
+
+    .menu-list-right {
+      flex: 1;
+
+      .right-only-right {
+        width: 100rpx;
+        height: 44rpx;
+        background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
+        border-radius: 12rpx;
+        line-height: 44rpx;
+        position: relative;
+
+        .selectedNum {
+          position: absolute;
+          right: 2rpx;
+          top: -22rpx;
+          font-size: 24rpx;
+          color: #fff;
+          width: 32rpx;
+          height: 32rpx;
+          line-height: 32rpx;
+          background: #FB3D03;
+          border-radius: 50%;
+        }
+      }
+
+      .right-only-right-red {
+        width: 44rpx;
+        height: 44rpx;
+        line-height: 40rpx;
+        border-radius: 12rpx;
+        border: 1rpx solid #41ABF5;
+        color: #41ABF5;
+      }
+
+      .right-only-right-add {
+        width: 44rpx;
+        height: 44rpx;
+        line-height: 40rpx;
+        background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
+        border-radius: 12rpx;
+      }
+
+      .right-only-right-2 {
+        min-width: 50rpx;
+      }
+    }
+  }
+</style>

+ 75 - 6
pages-takeout/shop-mod/menu.vue

@@ -1,6 +1,6 @@
 <template>
-	<view class="menu-box display-flex">
-		<scroll-view scroll-y="true" class="menu-box-left" :scroll-into-view="idMark" :scroll-with-animation='true'>
+	<view class="menu-box box-border-box display-flex">
+		<scroll-view :scroll-y="scrollType" class="menu-box-left" :scroll-into-view="idMark" :scroll-with-animation='true'>
 			<view class="menu-type-list-f">
 				<view class="menu-type-list fs-26 box-border-box align-items-center flex-justify-center"
 					v-for="(item,i) in categoryData" :key="i" @click="selectType(item)"
@@ -10,10 +10,10 @@
 				</view>
 			</view>
 		</scroll-view>
-		<scroll-view :scroll-y="true" :scroll-with-animation='true' :scroll-into-view="idMarkTwo" @scroll="menuScroll">
+		<scroll-view :scroll-y="scrollType" :scroll-with-animation='true' :scroll-into-view="idMarkTwo" @scroll="menuScroll">
 			<view class="menu-box-right">
 				<view class="menu-box-only" v-for="(item,i) in categoryData" :key="i" :id="'scroll'+ item.type">
-					<view class="mb-32 fs-30">{{item.name}}</view>
+					<view class="mb-32 fs-30 sticky-nav">{{item.name}}</view>
 					<view class="menu-list flex-justify-space" v-for="(info,k) in item.list" :key="k"
 						:id="'goods_id'+ info.goods_id">
 						<image class="flex-shrink0 goods_img" :src="info.goods_image" mode="scaleToFill"></image>
@@ -58,6 +58,7 @@
 				</view>
 			</view>
 		</scroll-view>
+    
 		<uni-popup ref="popupGG" type="bottom">
 			<view class="gg-box  flex-index-css">
 				<view class="flex-justify-space  box-border-box p-32">
@@ -160,7 +161,63 @@
 				idMarkTwo: '', //滚动自适应参数
 				type: 0, //分类标识
 				typeList: [],
-				categoryData: [],
+				categoryData: [{
+          type: 0,
+          name: '测试1',
+          list: [{
+            goods_name: '测试商品1-1',
+            price: '10',
+            goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+          },{
+            goods_name: '测试商品1-2',
+            price: '10',
+            goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+          },{
+            goods_name: '测试商品1-3',
+            price: '10',
+            goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+          }]
+        },{
+          type: 0,
+          name: '测试2',
+          list: [{
+            goods_name: '测试商品2-1',
+            price: '10',
+            goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+          },{
+            goods_name: '测试商品2-2',
+            price: '10',
+            goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+          },{
+            goods_name: '测试商品2-3',
+            price: '10',
+            goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+          }]
+        },{
+          type: 0,
+          name: '测试3',
+          list: [{
+            goods_name: '测试商品3',
+            price: '10',
+            goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+          }]
+        },{
+          type: 0,
+          name: '测试4',
+          list: [{
+            goods_name: '测试商品4',
+            price: '10',
+            goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+          }]
+        },{
+          type: 0,
+          name: '测试5',
+          list: [{
+            goods_name: '测试商品5',
+            price: '10',
+            goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+          }]
+        }],
 				menuList: [],
 				cartData: {
 					total_price: 0,
@@ -193,7 +250,8 @@
 					spec_attr: [],
 				},
 				selectedNum: 1,
-				selectedSpecification: []
+				selectedSpecification: [],
+        scrollType: true
 			}
 		},
 		watch: {
@@ -202,6 +260,10 @@
 			// }
 		},
 		mounted() {
+      // uni.$on('shopBottom',(e)=>{
+      //   console.log(e,'1111111');
+      //   this.scrollType = e
+      // })
 			// this.operate_id = uni.getStorageSync('operate_id')
 			// this.getShopGoods();
 			// this.getShopIngList(true);
@@ -677,6 +739,12 @@
 </script>
 
 <style scoped lang="scss">
+  .sticky-nav{
+    position: sticky;
+    top: 0rpx;
+    height: auto;
+    z-index: 5;
+  }
 	.wh-44 {
 		width: 44rpx;
 		height: 44rpx;
@@ -684,6 +752,7 @@
 
 	.menu-box {
 		height: 100%;
+    padding-bottom: 140rpx;
 
 		.menu-box-left {
 			width: 160rpx;

+ 920 - 0
pages-takeout/shop-mod/new-menu.vue

@@ -0,0 +1,920 @@
+<template>
+  <view class="menu-box box-border-box align-items-flex-start">
+
+    <view class="menu-box-left" :style="{top: newNavHeight + 'rpx'}">
+      <view class="menu-box-left-box" :style="{height: menuLeftType?`calc(100vh - ${newNavHeight}rpx - ${68}rpx)`:''}">
+        <view class="menu-type-list fs-26 box-border-box align-items-center flex-justify-center"
+          v-for="(item,i) in categoryData" :key="i" @click="selectType(item)"
+          :class="type ===  item.type?'bgc-f fc-3 fw-600':'fc-6 fw-400'" :id="'scroll'+ item.type">
+          {{item.name}}
+          <view class="menu-type-num fc-f" v-show="item.num > 0">{{item.num > 99?'99+':item.num}}</view>
+        </view>
+      </view>
+    </view>
+
+    <view class="menu-box-only">
+      <view class="" v-for="(item,i) in categoryData" :key="i" :id="'scroll'+ item.type">
+        <view class="fs-28 fw-600 fc-3 sticky-nav bgc-f p-20 box-border-box" :style="{top: newNavHeight + 'rpx'}">
+          {{item.name}}
+        </view>
+        <view class="menu-list flex-justify-space box-border-box" v-for="(info,k) in item.list" :key="k"
+          :id="'goods_id'+ info.goods_id">
+          <image class="flex-shrink0 goods_img" :src="info.goods_image" mode="scaleToFill"></image>
+          <view class="menu-list-right flex-direction flex-justify-space">
+            <view class="mb-8">
+              <view class="mb-4 goods-name text-overflow-ellipsis fs-32 fw-600">{{info.goods_name}}
+              </view>
+              <view class="text-overflow-ellipsis-one fw-400 fc-9 fs-24 mb-2 goods-name" v-if="info.spec_type == 1">
+                {{info.goods_desc?info.goods_desc:''}}
+              </view>
+              <view class="fw-400 fc-9 fs-24">月销{{info.sales}}</view>
+            </view>
+            <view class="flex-justify-space align-items-flex-end">
+              <view class="">
+                <span class="fs-24 fw-400 fc-FB3D03">¥</span>
+                <span class="fs-40 fw-b fc-FB3D03">{{info.seckill_money>0?info.seckill_money:info.price}}</span>
+              </view>
+              <view class="display-flex align-items-center" v-if="info.spec_type == 1">
+                <image v-show="info.num > 0" class="wh-44" @click="addred(1,i,k,info)" src="@/static/img/takeout/j.png"
+                  mode=""></image>
+                <view v-show="info.num > 0" class="right-only-right-2 text-align-center fs-28 fw-400">{{info.num}}
+                </view>
+                <image class="wh-44" src="@/static/img/takeout/add.png" @click="addred(2,i,k,info)" mode=""></image>
+              </view>
+              <view v-else class="right-only-right text-align-center" @click="addred(3,i,k,info)">
+                <view class="fw-600 fs-28 fc-f">
+                  选规格
+                </view>
+                <view class="selectedNum" v-if="info.num>0">
+                  {{info.num}}
+                </view>
+              </view>
+            </view>
+          </view>
+        </view>
+      </view>
+    </view>
+
+  </view>
+</template>
+
+<script>
+  import tools from "@/service/tools";
+  import {
+    shopCategory,
+    shopGoods,
+    shopGoodsSpec
+  } from "@/api/shop";
+  import {
+    shoppingSave,
+    getShopIngList,
+    setShopIngAdd,
+    setShopIngDel,
+    setShopIngNumber
+  } from "@/api/shopping";
+  export default {
+    name: 'menu-box',
+    props: {
+      'shop_id': {
+        default: 0
+      },
+      'newNavHeight': {
+        default: 0
+      },
+      'menuLeftType': {
+        default: false
+      }
+    },
+    data() {
+      return {
+        idMark: '', //滚动自适应参数
+        idMarkTwo: '', //滚动自适应参数
+        type: 0, //分类标识
+        typeList: [],
+        categoryData: [{
+            type: 0,
+            name: '测试1',
+            list: [{
+              goods_id: 1,
+              goods_name: '测试商品1-1',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }, {
+              goods_id: 2,
+              goods_name: '测试商品1-2',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }, {
+              goods_id: 3,
+              goods_name: '测试商品1-3',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          }, {
+            type: 1,
+            name: '测试2',
+            list: [{
+              goods_id: 4,
+              goods_name: '测试商品2-1',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }, {
+              goods_id: 5,
+              goods_name: '测试商品2-2',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }, {
+              goods_id: 6,
+              goods_name: '测试商品2-3',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          }, {
+            type: 2,
+            name: '测试3',
+            list: [{
+              goods_id: 7,
+              goods_name: '测试商品3',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          }, {
+            type: 3,
+            name: '测试4',
+            list: [{
+              goods_id: 8,
+              goods_name: '测试商品4',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          }, {
+            type: 4,
+            name: '测试5',
+            list: [{
+              goods_id: 9,
+              goods_name: '测试商品5',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+          {
+            type: 5,
+            name: '测试6',
+            list: [{
+              goods_id: 10,
+              goods_name: '测试商品6',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+          {
+            type: 6,
+            name: '测试7',
+            list: [{
+              goods_id: 11,
+              goods_name: '测试商品7',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+          {
+            type: 7,
+            name: '测试8',
+            list: [{
+              goods_id: 12,
+              goods_name: '测试商品8',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+          {
+            type: 8,
+            name: '测试9',
+            list: [{
+              goods_id: 13,
+              goods_name: '测试商品9',
+              price: '10',
+              goods_image: 'https://qcloud.dpfile.com/pc/JvY4fMzO0Km80S9Sn-tNxYin28jkvrNMJV-pUo8YwCctS4AHLKPXFhGyuI2dCwk8.jpg'
+            }]
+          },
+        ],
+        menuList: [],
+        cartData: {
+          total_price: 0,
+          total_num: 0,
+          total_goods_money: 0,
+          pack_price: 0,
+          must_category: 0,
+          is_place_order: 0,
+          err_msg: 0,
+          goods_list: [],
+        },
+        isAjax: false,
+        operate_id: '',
+        popData: {
+          goodsItem: {},
+          price: '0.00',
+          line_price: '',
+          num: 0,
+          goods_id: '',
+          is_quota: 0,
+          is_infinite: 0,
+          quota_num: 0,
+          payNum: 0,
+          stock: 0,
+          spec_key: '',
+          goods_spec_id: '',
+          spec_name: [],
+          spec_ids: [],
+          spec_list: [],
+          spec_attr: [],
+        },
+        selectedNum: 1,
+        selectedSpecification: [],
+        scrollType: true
+      }
+    },
+    watch: {},
+    mounted() {},
+    methods: {
+      setSpecNum(type) {
+        // this.popData.spec_ids
+        if (!this.popData.spec_key) {
+          console.log('被阻挡');
+          tools.error('请选择规格')
+          return;
+        }
+        if (type === 1) {
+          // 减
+          console.log('减');
+          if (this.popData.num > 1) {
+            --this.popData.num;
+            this.$forceUpdate()
+          } else {
+            this.isAjax = false
+          }
+        } else {
+          console.log('加');
+          if (this.popData.is_infinite === 0 && this.popData.payNum > this.popData.stock) {
+            console.log('加1');
+            tools.error('商品库存' + this.popData.stock + '件')
+          } else if (this.popData.is_quota > 0 && this.popData.payNum > this.popData.quota_num) {
+            console.log('加2');
+            tools.error('限购' + this.popData.quota_num + '件')
+          } else {
+            // 加
+            console.log('加3');
+            ++this.popData.num;
+            this.$forceUpdate()
+          }
+        }
+
+      },
+      getShopGoodsSpec(item) {
+        console.log(item, this.cartData, 'item');
+        shopGoodsSpec({
+          'goods_id': item.goods_id
+        }).then(res => {
+          console.log(item, 'item');
+          this.popData.goodsItem = item
+          if (this.popData.goods_id !== item.goods_id) {
+            this.popData.goods_id = item.goods_id
+            this.popData.spec_name = []
+            // this.popData.price = '0.00'
+            this.popData.price = item.price
+            this.popData.line_price = ''
+            this.popData.spec_key = ''
+            this.popData.num = 1
+            this.popData.spec_ids = []
+            console.log(this.popData, '走if');
+            this.$forceUpdate()
+          } else {
+            console.log(this.popData, '无');
+            this.popData.num = 1;
+            // this.popData.price = item.price
+            if (this.cartData.goods_list.length > 0) {
+              this.cartData.goods_list.forEach(item => {
+                if (item.goods_spec_id === this.popData.spec_key) {
+                  // this.popData.num = this.selectedSpecification.goods_number
+                  this.popData.num = this.popData.payNum
+                  console.log(this.popData, '走else');
+                  this.$forceUpdate()
+                }
+              })
+            }
+          }
+          this.popData.spec_list = res.data
+          this.popData.spec_attr = res.data
+          console.log(this.selectedSpecification, 'this.selectedSpecification');
+          this.selectedSpecification.forEach((v, k) => {
+            if (v.goods_id === item.goods_id) {
+              v.goodsItem = item
+              v.spec_list = res.data
+              v.spec_attr = res.data
+              v.num = v.goods_number
+              let data = JSON.parse(JSON.stringify(v))
+              this.popData = data
+            }
+          })
+          console.log(this.popData, 'this.popData');
+          this.$refs.popupGG.open();
+          this.setGoodsSpecPrice()
+          this.isAjax = false
+        }).catch(() => {
+          tools.error('规格信息异常')
+          this.isAjax = false
+        })
+      },
+      setGoodsSpecPrice() {
+        console.log(this.popData.spec_ids)
+        if (this.popData.spec_ids.length > 0) {
+          let spec_ids = JSON.parse(JSON.stringify(this.popData.spec_ids))
+          spec_ids.sort((a, b) => a - b);
+          let spec_key = spec_ids.join('_')
+          this.popData.spec_key = spec_key
+        } else {
+          this.popData.num = 1
+          this.popData.goods_spec_id = ''
+        }
+      },
+      setShopIngList(cartData) {
+        this.cartData = cartData
+        this.selectedSpecification = []
+        this.setGoodsNum()
+      },
+      getShopIngList(isStart) {
+        getShopIngList({
+          'shop_id': this.shop_id,
+        }).then(res => {
+          if (res.code === 1) {
+            this.cartData = res.data
+            let data = res.data
+            data.goods_list.forEach((v, k) => {
+              let ge = JSON.parse(JSON.stringify(v))
+              ge.spec_ids = ge.goods_spec_id.split('_').map(item => Number(item.trim()))
+              ge.spec_name = ge.goods_attr.split(',').map(item => item.trim())
+              this.selectedSpecification.push(ge)
+            })
+            console.log(this.selectedSpecification, '初始回显已选数据');
+            this.$emit('setCartData', this.cartData)
+            this.setGoodsNum()
+          }
+        })
+      },
+      setGoodsNum() {
+        if (this.cartData.goods_list.length > 0) {
+          let goodsIds = []
+          this.categoryData.forEach(categoryItem => {
+            categoryItem.list.forEach(goodsItem => {
+              goodsItem.num = 0
+              this.cartData.goods_list.forEach(item => {
+                if (item.goods_id === goodsItem.goods_id) {
+                  if (goodsIds.indexOf(item.goods_id) < 0) {
+                    goodsIds.push(item.goods_id)
+                    goodsItem.num = item.goods_number * 1
+                  } else {
+                    goodsItem.num += item.goods_number * 1
+                  }
+                }
+              })
+            })
+          })
+        } else {
+          //购物车数据清除
+          this.categoryData.forEach(categoryItem => {
+            categoryItem.list.forEach(goodsItem => {
+              goodsItem.num = 0
+            })
+          })
+        }
+      },
+      getShopGoods() {
+        if (this.shop_id < 0 || !this.operate_id) {
+          return;
+        }
+        shopGoods({
+          'shop_id': this.shop_id,
+          operate_id: this.operate_id,
+        }).then(res => {
+          if (res.code === 1) {
+            this.categoryData = res.data
+            const category_id = uni.getStorageSync('category_id')
+            const goods_id = uni.getStorageSync('goods_id')
+            if (category_id.type && category_id.type != 'undefined') {
+              this.selectType(category_id, goods_id)
+            } else {
+              this.selectType(this.categoryData[0])
+            }
+            this.categoryData.forEach(categoryItem => {
+              categoryItem.list.forEach(goodsItem => {
+                goodsItem.payNum = 0
+                goodsItem.spec = []
+              })
+            })
+            setTimeout(() => {
+              this.setGoodsNum()
+            }, 1000)
+          }
+        })
+      },
+      selectType(item, itemTwo) {
+        if (this.type != item.type) {
+          this.type = item.type;
+          this.idMark = 'scroll' + item.type
+          
+          // 触发事件通知父组件需要滚动
+          this.$emit('scrollToCategory', {
+            type: item.type,
+            selector: `#scroll${item.type}`
+          });
+
+          this.$forceUpdate()
+        }
+      },
+      menuScroll(e) {
+        let _this = this;
+        let query = uni.createSelectorQuery().in(this);
+        const goods_id = uni.getStorageSync('goods_id')
+        if (goods_id.goodsId && goods_id.goodsId != 'undefined') {
+          query.selectAll(".menu-list").boundingClientRect(data => {
+            data.forEach((v) => {
+              if (data[this.categoryData.length - 1].top <= 392) {
+                return
+              }
+              if (v.top < 332 && v.top > 0) {
+                // _this.idMark = v.id;
+                let arr = v.id.split('scroll');
+              }
+            })
+            uni.setStorageSync('category_id', '')
+            uni.setStorageSync('goods_id', '')
+          }).exec();
+        } else {
+          query.selectAll(".menu-box-only").boundingClientRect(data => {
+            data.forEach((v) => {
+              if (data[this.categoryData.length - 1].top <= 392) {
+                return
+              }
+              if (v.top < 332 && v.top > 0) {
+                // _this.idMark = v.id;
+                let arr = v.id.split('scroll');
+                _this.type = Number(arr[1]);
+              }
+              this.$forceUpdate()
+            })
+          }).exec();
+        }
+      },
+      addred(type, i, k, item) {
+        if (this.isAjax) {
+          return
+        }
+        this.isAjax = true
+        if (type === 1) {
+          // 减
+          --item.num;
+          if (item.num >= 0) {
+            this.addShoppingSave(item, item.num, type)
+          } else {
+            this.isAjax = false
+          }
+        } else if (type === 2) {
+          // 加
+          ++item.num;
+          if (item.is_infinite === 0 && item.num > item.stock) {
+            tools.error('商品库存' + item.stock + '件')
+              --item.num
+            this.isAjax = false
+          } else if (item.is_quota > 0 && item.num > item.quota_num) {
+            tools.error('限购' + item.quota_num + '件')
+              --item.num
+            this.isAjax = false
+          } else {
+            this.addShoppingSave(item, item.num, type)
+          }
+
+        } else if (type === 3) {
+          // 选规格
+          console.log(item, '000000000')
+          console.log(this.selectedSpecification, '1111111111111');
+          this.selectedSpecification.forEach((v, k) => {
+            if (v.goods_id === item.goods_id) {
+              v.quota_num = item.quota_num
+              v.payNum = item.num
+              v.stock = item.stock
+            }
+          })
+          this.popData.is_quota = item.is_quota
+          this.popData.quota_num = item.quota_num
+          this.popData.is_infinite = item.is_infinite
+          this.popData.payNum = item.num
+          this.popData.stock = item.stock
+          this.getShopGoodsSpec(item)
+        } else {
+          let data = JSON.parse(JSON.stringify(this.popData))
+          this.selectedSpecification.push(data)
+          console.log(this.popData, "666666666666666666")
+          console.log('1', this.popData.goods_id, this.shop_id, this.popData.goodsItem.category_id, this.popData
+            .spec_key, this.popData.num);
+          this.setShoppingSave()
+          this.isAjax = false
+        }
+      },
+      addShoppingSave(item, num, type) {
+        shoppingSave({
+          type: 1,
+          goods_id: item.goods_id,
+          shop_id: this.shop_id,
+          category_id: item.category_id,
+          goods_spec_id: '',
+          number: num
+        }).then((res) => {
+          if (res.code === 1) {
+            if (type === 1) {
+              tools.success('操作成功')
+            } else {
+              tools.success(res.msg)
+            }
+            this.isAjax = false
+            this.getShopIngList()
+          } else {
+            this.isAjax = false
+            tools.error(res.msg)
+          }
+        })
+      },
+      gbPop() {
+        this.$refs.popupGG.close();
+      },
+      setSub(item, type) {
+        let cartKey = this.cartData.goods_list.findIndex(row => row.goods_id === item.goods_id)
+        if (type === 2 && cartKey < 0) {
+          this.setShopIngAdd(item.goods_id, item.category_id, '', 1, item)
+        } else {
+          this.setShopIngNumber(item.goods_id, item.category_id, type, '', 1, item)
+        }
+      },
+      setShoppingSave() {
+        shoppingSave({
+          type: 1,
+          goods_id: this.popData.goods_id,
+          shop_id: this.shop_id,
+          category_id: this.popData.goodsItem.category_id,
+          goods_spec_id: this.popData.spec_key,
+          number: this.popData.num
+        }).then((res) => {
+          if (res.code === 1) {
+            tools.success(res.msg)
+            this.$refs.popupGG.close();
+            this.getShopIngList()
+          } else {
+            tools.error(res.msg)
+          }
+        })
+      },
+      setShopIngAdd(goodsId, categoryId, goodsSpecId, number, item) {
+        setShopIngAdd({
+          'type': 1,
+          'goods_id': goodsId,
+          'shop_id': this.shop_id,
+          'category_id': categoryId,
+          'goods_spec_id': goodsSpecId,
+          'number': number,
+        }).then(res => {
+          this.isAjax = false
+          if (res.code === 1) {
+            if (item) {
+              ++item.num;
+            }
+            this.getShopIngList()
+          } else if (res.code === 2) {
+            tools.error(res.msg)
+            if (item) {
+              ++item.num;
+            }
+            this.getShopIngList()
+          } else {
+            tools.error(res.msg)
+          }
+
+        }).catch(() => {
+          this.isAjax = false
+        })
+      },
+      setShopIngNumber(goodsId, categoryId, operation, goodsSpecId, number, item) {
+        setShopIngNumber({
+          'type': 1,
+          'goods_id': goodsId,
+          'shop_id': this.shop_id,
+          'category_id': categoryId,
+          'goods_spec_id': goodsSpecId,
+          'number': number,
+          'operation': operation === 2 ? 1 : 2,
+        }).then(res => {
+          this.isAjax = false
+          if (res.code === 1) {
+            if (item) {
+              if (operation === 2) {
+                ++item.num;
+              } else {
+                --item.num;
+              }
+            }
+            this.getShopIngList()
+          } else if (res.code === 2) {
+            tools.error(res.msg)
+            if (item) {
+              if (operation === 2) {
+                ++item.num;
+              } else {
+                --item.num;
+              }
+            }
+            this.getShopIngList()
+          } else {
+            tools.error(res.msg)
+          }
+
+        }).catch(() => {
+          this.isAjax = false
+        })
+      },
+
+      setShopIngDel() {},
+      // -------弹窗选择规格-----------
+      selectSpec(info, groupKey) {
+        let specKey = this.popData.spec_ids.indexOf(info.spec_id)
+        if (specKey >= 0) {
+          this.popData.spec_ids.splice(specKey, 1)
+          this.popData.spec_name.splice(specKey, 1)
+          if (Number(info.spec_price) > 0) {
+            this.popData.price = Number(this.popData.price) - Number(info.spec_price)
+          }
+        } else {
+          this.popData.spec_ids.push(info.spec_id)
+          this.popData.spec_name.push(info.spec_name)
+          if (Number(info.spec_price) > 0) {
+            this.popData.price = Number(this.popData.price) + Number(info.spec_price)
+          }
+          for (const attrKey in this.popData.spec_attr[groupKey].spec_list) {
+            if (this.popData.spec_attr[groupKey].spec_list[attrKey].spec_id !== info.spec_id) {
+              let oldKey = this.popData.spec_ids.indexOf(this.popData.spec_attr[groupKey].spec_list[attrKey]
+                .spec_id)
+              if (oldKey >= 0) {
+                this.popData.spec_ids.splice(oldKey, 1)
+                this.popData.spec_name.splice(oldKey, 1)
+                this.popData.price = Number(this.popData.price) - Number(this.popData.spec_attr[groupKey]
+                  .spec_list[attrKey].spec_price)
+              }
+            }
+          }
+        }
+        // this.spec_ids = this.popData.spec_list.join('_')
+        this.setGoodsSpecPrice()
+      },
+    },
+  }
+</script>
+
+<style scoped lang="scss">
+  .sticky-nav {
+    width: 100%;
+    position: sticky;
+    z-index: 3;
+  }
+
+  .wh-44 {
+    width: 44rpx;
+    height: 44rpx;
+  }
+
+  .menu-box-left-f {
+    position: sticky;
+    // transition: all .3s ease;
+    // overflow: auto;
+  }
+
+  .menu-box-left {
+    width: 160rpx;
+    height: auto;
+    position: sticky;
+    overflow: auto;
+    // transition: all .3s ease;
+    // height: 100%;
+    // background-color: #F7F8FA;
+    // position: absolute;
+    // left: 0;
+    // top: 0;
+    // border-radius: 0rpx 20rpx 0 0rpx;
+  }
+
+  .menu-box-left-box {
+    overflow-y: auto;
+  }
+
+  .menu-type-list {
+    width: 160rpx;
+    min-height: 108rpx;
+    padding: 18rpx 28rpx;
+    position: relative;
+    z-index: 10;
+
+    .menu-type-num {
+      position: absolute;
+      top: 2rpx;
+      right: 8rpx;
+      padding: 0 6rpx;
+      min-width: 20rpx;
+      height: 32rpx;
+      text-align: center;
+      line-height: 32rpx;
+      background: #FB3D03;
+      border-radius: 50%;
+    }
+  }
+
+  .menu-type-list-f {
+    // width: 160rpx;
+    background-color: #007AFF;
+
+    width: 100%;
+    height: 100%;
+    overflow-y: auto;
+    /* 如果分类项很多,允许内部滚动 */
+    -webkit-overflow-scrolling: touch;
+    /* 改善移动端滚动体验 */
+    // height: 100%;
+  }
+
+  .menu-box-only {
+    // flex: 1;
+    width: calc(100% - 160rpx);
+  }
+
+  .menu-box-right {
+    // flex: 1;
+    width: 100%;
+    height: 100%;
+    // padding: 16rpx 0;
+    // box-sizing: border-box;
+    // position: relative;
+  }
+
+  .menu-list {
+    width: 100%;
+    padding: 0 20rpx 40rpx;
+    // height: 200rpx;
+    // margin-bottom: 40rpx;
+
+    .goods_img {
+      width: 200rpx;
+      height: 200rpx;
+      border-radius: 12rpx;
+      margin-right: 16rpx;
+    }
+
+    .menu-list-right {
+      flex: 1;
+
+      .right-only-right {
+        width: 100rpx;
+        height: 44rpx;
+        background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
+        border-radius: 12rpx;
+        line-height: 44rpx;
+        position: relative;
+
+        .selectedNum {
+          position: absolute;
+          right: 2rpx;
+          top: -22rpx;
+          font-size: 24rpx;
+          color: #fff;
+          width: 32rpx;
+          height: 32rpx;
+          line-height: 32rpx;
+          background: #FB3D03;
+          border-radius: 50%;
+        }
+      }
+
+      .right-only-right-red {
+        width: 44rpx;
+        height: 44rpx;
+        line-height: 40rpx;
+        border-radius: 12rpx;
+        border: 1rpx solid #41ABF5;
+        color: #41ABF5;
+      }
+
+      .right-only-right-add {
+        width: 44rpx;
+        height: 44rpx;
+        line-height: 40rpx;
+        background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
+        border-radius: 12rpx;
+      }
+
+      .right-only-right-2 {
+        min-width: 50rpx;
+      }
+    }
+  }
+
+  .menu-box {
+    width: 100%;
+    height: 100%;
+    // padding-bottom: 140rpx;
+
+    .gg-box {
+      width: 750rpx;
+      height: 1208rpx;
+      background: #FFFFFF;
+      border-radius: 24rpx 24rpx 0rpx 0rpx;
+
+      .goods-info {
+        border-bottom: 1rpx solid #EEEEEE;
+
+        image {
+          width: 170rpx;
+          height: 160rpx;
+          border-radius: 8rpx;
+          margin-right: 22rpx;
+          margin-bottom: 32rpx;
+        }
+      }
+
+      .pop-buttom {
+        width: 100%;
+        // height: 250rpx;
+        box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(51, 51, 51, 0.1);
+
+        .pop-buttom-left {
+          padding-top: 12rpx;
+        }
+
+        .pop-buttom-2 {
+          width: 100%;
+          height: 96rpx;
+          line-height: 96rpx;
+          background: #41ABF5;
+          border-radius: 200rpx
+        }
+
+        .right-only-right-red {
+          width: 44rpx;
+          height: 44rpx;
+          line-height: 40rpx;
+          border-radius: 12rpx;
+          border: 1rpx solid #41ABF5;
+          color: #41ABF5;
+        }
+
+        .right-only-right-add {
+          width: 44rpx;
+          height: 44rpx;
+          line-height: 40rpx;
+          background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
+          border-radius: 12rpx;
+        }
+
+        .right-only-right-2 {
+          min-width: 50rpx;
+        }
+      }
+
+      .w-m {
+        width: calc(100% + 30rpx);
+      }
+
+      .spec-item {
+        min-width: 210rpx;
+        height: 66rpx;
+        line-height: 66rpx;
+        box-sizing: border-box;
+        border-radius: 12rpx;
+        margin: 0 26rpx 26rpx 0;
+        padding: 0 10rpx;
+      }
+
+      // .spec-item:nth-child(3) {
+      // 	margin-right: 0rpx !important;
+      // }
+
+      .s-item {
+        background-color: #ECF7FE;
+        border: 2rpx solid #41ABF5;
+        color: #41ABF5;
+      }
+
+      .n-item {
+        border: 2rpx solid #EEEEEE;
+        color: #000;
+      }
+    }
+  }
+
+  .goods-name {
+    max-width: 310rpx;
+  }
+</style>

+ 89 - 83
pages-takeout/shop.vue

@@ -1,9 +1,12 @@
 <template>
-  <view class="shop-index iPhone-bottom flex-common-css box-border-box">
+  <view class="shop-index iPhone-bottom flex-direction box-border-box">
 
-    <image class="bg-img" src="@/static/img/order-food/shop-top.png" mode="aspectFill"></image>
+    <image v-show="!navBgType" class="bg-img" src="@/static/img/order-food/shop-top.png" mode="aspectFill"
+      :class="scrollTop > newNavHeight?'z-4':'z-3'"></image>
+    <image v-show="navBgType" class="bg-img-type z-4" src="@/static/img/order-food/shop-top.png" mode="aspectFill"
+      :style="{height:newNavHeight+'rpx',opacity:opacity}"></image>
 
-    <newNav :leftShow="false" :textType='false' class="z-3 mb-32">
+    <newNav :leftShow="false" :textType='false' class="z-4 mb-32" @navHeight='navHeight'>
       <view slot="textContent" class="align-items-center flex-justify-end">
         <view class="ss-box b-rad-50 mr-24 align-items-center flex-justify-center">
           <image class="shop-search" src="@/static/img/order-food/shop-search.png" mode=""></image>
@@ -17,8 +20,8 @@
       </view>
     </newNav>
 
-    <view class="bgc-f box-border-box plr-32 mb-32">
-      <view class="shop-info-box bgc-f box-border-box p-24 z-3 .b-rad-20">
+    <view class="bgc-f box-border-box plr-32 mb-32 shop-info">
+      <view class="shop-info-box bgc-f box-border-box p-24 z-3 b-rad-20">
         <view class="fs-40 fw-600 text-overflow-ellipsis mb-16">
           {{shopsInfo.shop_name || "山海鲜熬老灶麻辣火锅辣火锅辣火11 世家匠心传承店川"}}
         </view>
@@ -28,7 +31,7 @@
       </view>
     </view>
 
-    <view class="b-b-eee bgc-f box-border-box p-0-32-12 align-items-center flex-justify-space">
+    <view class="b-b-eee bgc-f box-border-box p-0-32-12 align-items-center flex-justify-space z-3 shop-type-box">
       <view class="align-items-center shop-type-list">
         <view class="shop-item fs-36 mb-8 mr-64" @click="seletShopType(item)"
           :class="shopType === item.id?'fc-3 fw-600':'fc-6'" v-for="(item,i) in shopTypeList" :key="i">
@@ -44,14 +47,15 @@
       </view>
     </view>
 
-    <view class="common-view-css bgc-f" style="overflow: hidden;">
+    <!-- <view class="bgc-f sticky-nav" :style="{ height: navBgType?`calc(100vh - ${newNavHeight}rpx)`:'auto'}"> -->
+      <view class="bgc-f sticky-nav">
       <Menu style="height: 100%;" v-if="shopType === 1" :shop_id="shop_id" @setCartData="setCartData" ref="goodsMenu">
       </Menu>
-<!--      <Evaluate style="height: 100%;" :shopId='shop_id' :shopScore='shopsInfo.shop_score' v-else-if="shopType === 2">
+      <!--      <Evaluate style="height: 100%;" :shopId='shop_id' :shopScore='shopsInfo.shop_score' v-else-if="shopType === 2">
       </Evaluate> -->
       <ShopInfo style="height: 100%;" :shopId='shop_id' v-else-if="shopType === 2"></ShopInfo>
     </view>
-    
+
     <view v-if="shopType === 1" class="shop-buttom-money box-border-box" @click="openBuyCrad()">
       <view class="shop-buttom-money-1 flex-justify-space align-items-center">
         <image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill"></image>
@@ -70,12 +74,12 @@
         <view v-else class="err-msg fs-32 fw-600 fc-f mr-30" @click.stop="mustBut">{{cartData.err_msg}}</view>
       </view>
     </view>
-    <uni-popup ref="popupBuy" type="bottom" background-color="#fff">
+    <uni-popup ref="popupBuy" type="bottom" background-color="transparent" borderRadius='20px 20rpx 0 0'>
       <view class="buy-card flex-index-css">
-        <view class="buy-card-top box-border-box plr-32 flex-justify-space align-items-center">
+        <view class="buy-card-top box-border-box plr-32 flex-justify-space align-items-center b-rad-20-20-0-0">
           <view class="">
             <span class="fs-32 fc-3 mr-12">已选商品</span>
-            <span class="fs-32 fc-9">(打包费<span class="fs-32 fc-FB3D03">{{cartData.pack_price}}元</span>)</span>
+            <!-- <span class="fs-32 fc-9">(打包费<span class="fs-32 fc-FB3D03">{{cartData.pack_price}}元</span>)</span> -->
           </view>
           <view class="fs-28 fw-400 fc-9 align-items-center" @click.stop="setShopIngDel">
             <view class="">
@@ -134,49 +138,6 @@
         </view>
       </view>
     </uni-popup>
-    <uni-popup ref="popupCoupon" type="bottom">
-      <view class="pop-coupon box-border-box p-24">
-        <view class="text-align-center fs-36 fw-600 box-title mb-32">
-          本店优惠券
-          <uni-icons @click="closeCoupon" class="box-close" type="closeempty" size="20"></uni-icons>
-        </view>
-        <view class="scroll-view-css">
-          <view v-if="couponData<= 0" class="blank-text fs-32 fc-6 text-align-center">
-            暂无优惠券
-          </view>
-          <!-- 					<EnBlank :customSrc='true' v-if="couponData<= 0">
-						<template v-slot:blankImg>
-							<image class="black-img" src="@/static/img/common/no-order.png" mode=""></image>
-						</template>
-					</EnBlank> -->
-          <view class="item-box display-flex mb-20" v-for="(item,index) in couponData" :key="index">
-            <view class="item-right flex-direction flex-justify-center flex-1 bgc-f">
-              <view class="fs-28 mb-12 ticket-name text-overflow-ellipsis fc-3 fw-600">
-                {{item.name}}
-              </view>
-              <view class="fs-24 fc-6">
-                有效时间:{{item.time_type_str}}
-              </view>
-            </view>
-            <view class="item-hr"></view>
-            <view class="item-left flex-direction align-items-center flex-justify-center bgc-FCE7E2">
-              <view class="align-items-center">
-                <view class="fs-30 fw-600 fc-FB3D03">¥</view>
-                <view class="fs-48 fw-600 fc-FB3D03">{{item.money}}</view>
-              </view>
-              <view class="fs-24 mb-18 fc-6">
-                满{{item.full_money}}可用
-              </view>
-              <view class="but-box fs-28 fc-f" @click="receiveCode(item)">
-                立即领取
-              </view>
-              <view class="ball"></view>
-              <view class="ball-two"></view>
-            </view>
-          </view>
-        </view>
-      </view>
-    </uni-popup>
   </view>
 </template>
 
@@ -237,34 +198,52 @@
           err_msg: 0,
           goods_list: [],
         },
-        isAjax: false
+        isAjax: false,
+        newNavHeight: '',
+        navBgType: false,
+        scrollTop: 0,
+        opacity: 0,
+        heightOne: '',
+        heightTwo: '',
+        topHeight: ''
       }
     },
-    onShow() {
-      // this.getShopIngList()
+    onShow() {},
+    onLoad(e) {},
+    mounted() {},
+    onReachBottom(e) {
+      console.log(e,'页面触底了');
+      // uni.$emit('shopBottom',true)
     },
-    onLoad(e) {
-      // if (e) {
-      // 	console.log(e, '^^^^^^^');
-      // 	this.shop_id = e.shop_id
-      // 	this.operate_id = uni.getStorageSync('operate_id')
-      // 	const item = {
-      // 		type: Number(e.category_id)
-      // 	}
-      // 	const goodsId = {
-      // 		goodsId: Number(e.goods_id)
-      // 	}
-      // 	console.log(item, goodsId, '00000000000');
-      // 	uni.setStorageSync('category_id', item)
-      // 	uni.setStorageSync('goods_id', goodsId)
-      // 	this.shopInfo()
-      // }
-    },
-    mounted() {
-      // this.getDomH();
-      // this.shopCoupon()
+    // 监听页面滚动
+    onPageScroll(e) {
+      // e.scrollTop 获取滚动条距离页面顶部的距离
+      this.scrollTop = e.scrollTop
+      this.opacity = (Number(this.scrollTop) - 30)
+      // 可以根据滚动位置执行相应逻辑
+      if (e.scrollTop > 25) {
+        this.navBgType = true
+      } else {
+        this.navBgType = false
+      }
     },
     methods: {
+      getHeight() {
+        const query = uni.createSelectorQuery();
+        query.select('.shop-info').boundingClientRect(data => {
+          this.heightOne = data.height;
+          console.log(this.heightOne,'0000000000');
+        }).exec();
+        query.select('.shop-type-box').boundingClientRect(data => {
+          this.heightTwo = data.height;
+          this.topHeight =  this.heightOne + this.heightTwo + this.newNavHeight
+          console.log(this.topHeight,'111111');
+        }).exec();
+      },
+      navHeight(e) {
+        this.newNavHeight = e
+        console.log(e,'000000000');
+      },
       mustBut() {
         // 未点必选品
         const item = {
@@ -328,14 +307,14 @@
       },
       getShopIngList() {
         getShopIngList({
-          'shop_id': this.shop_id,
+          'shop_id': 111,
         }).then(res => {
           if (res.code === 1) {
             this.cartData = res.data
             if (this.shopType === 1) {
               setTimeout(() => {
                 console.log('我的数据执行了')
-                this.$refs.goodsMenu.setShopIngList(this.cartData)
+                // this.$refs.goodsMenu.setShopIngList(this.cartData)
               }, 1000)
 
             }
@@ -461,10 +440,20 @@
 </script>
 
 <style scoped lang="scss">
-  .zh-icon{
+  .sticky-nav {
+    height: 80vh;
+    position: sticky;
+    // height: calc(100vh - this.topHeight);
+    // height: auto;
+    top: 180rpx;
+    z-index: 5;
+  }
+
+  .zh-icon {
     width: 32rpx;
     height: 32rpx;
   }
+
   .shp-list-img {
     width: 40rpx;
     height: 40rpx;
@@ -575,6 +564,9 @@
   }
 
   .shop-index {
+    width: 100%;
+    min-height: 100vh;
+    // height: 100vh;
     position: relative;
   }
 
@@ -604,12 +596,22 @@
   }
 
   .bg-img {
-    position: absolute;
+    position: fixed;
     top: 0;
     left: 0;
     width: 100%;
     height: 300rpx;
-    z-index: 0;
+    transition: linear .3s all;
+    // height: 300rpx;
+  }
+
+  .bg-img-type {
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: 100%;
+    // opacity: 100;
+    transition: linear .3s all;
   }
 
   .mb-box {
@@ -632,6 +634,10 @@
     height: 140rpx;
     background: rgba(255, 255, 255, 0.8);
     padding: 20rpx 24rpx;
+    position: fixed;
+    left: 0;
+    bottom: 0;
+    z-index: 5;
   }
 
   .shop-buttom-num {

+ 7 - 1
pages.json

@@ -188,6 +188,12 @@
 						"navigationBarTitleText": "店铺"
 					}
 				},
+        {
+        	"path": "new-shop",
+        	"style": {
+        		"navigationBarTitleText": "演示店铺"
+        	}
+        },
 				{
 					"path": "aptitude",
 					"style": {
@@ -484,7 +490,7 @@
 		"current": 0,
 		"list": [{
 				"name": "列表调试",
-				"path": "pages-takeout/shop",
+				"path": "pages-takeout/new-shop",
 				"query": "balance=2"
 			},
 			{

+ 21 - 21
service/ajax.js

@@ -1,19 +1,19 @@
 import tools from "@/service/tools";
 
 
-let BASE_URL  = process.uniEnv.baseUrl;
+let BASE_URL = process.uniEnv.baseUrl;
 
 
 /**
  * post请求封装
  */
 export const request = (url, method, data, show = false) => {
-  let token=uni.getStorageSync('token')
+  let token = uni.getStorageSync('token')
   data.token = token;
   data.m_id = uni.getStorageSync('m_id')
-  data.school_id = uni.getStorageSync('school_id');
-  data.operate_id = uni.getStorageSync('operate_id');
-  data.system_type = uni.getStorageSync('system_type');
+  // data.school_id = uni.getStorageSync('school_id');
+  // data.operate_id = uni.getStorageSync('operate_id');
+  // data.system_type = uni.getStorageSync('system_type');
   if (show) {
     tools.showLoading();
   }
@@ -23,7 +23,7 @@ export const request = (url, method, data, show = false) => {
   return new Promise((resolve, reject) => {
     // 封装主体:网络请求
     uni.request({
-      url:BASE_URL+  url,
+      url: BASE_URL + url,
       data: data,
       method: method || 'post',
       header: {
@@ -36,28 +36,28 @@ export const request = (url, method, data, show = false) => {
           tools.hideLoading();
           if (res.data.code * 1 === 401) {
             // uni.clearStorageSync()
-			uni.removeStorageSync('token')
-			uni.removeStorageSync('m_id')
-			setTimeout(()=>{
-				uni.reLaunch({
-				  url: '/pages/login/index'
-				});
-			},500)
+            uni.removeStorageSync('token')
+            uni.removeStorageSync('m_id')
+            setTimeout(() => {
+              uni.reLaunch({
+                url: '/pages/login/index'
+              });
+            }, 500)
           } else if (res.data.code * 1 === 403) {
-			resolve(res.data)
-			tools.error('请求过快!!')
-          }else {
+            resolve(res.data)
+            tools.error('请求过快!!')
+          } else {
             resolve(res.data)
           }
-        }else if(res.statusCode === 401){
+        } else if (res.statusCode === 401) {
           // uni.clearStorageSync()
-		  uni.removeStorageSync('token')
-		  uni.removeStorageSync('m_id')
+          uni.removeStorageSync('token')
+          uni.removeStorageSync('m_id')
           uni.reLaunch({
             url: '/pages/login/index'
           });
-        } else{
-		  resolve(res.data)
+        } else {
+          resolve(res.data)
           tools.error('网络错误!!')
         }
       },