|
|
@@ -22,11 +22,11 @@
|
|
|
|
|
|
<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 class="fs-40 fw-600 text-overflow-ellipsis">
|
|
|
+ {{shopsInfo.shop_name}}
|
|
|
</view>
|
|
|
- <view class="fs-24 fw-400 fc-9 text-overflow-ellipsis-one">
|
|
|
- 公告:{{shopsInfo.notice||"第二份半价是同时下相同商品的第二份可享受半价受"}}
|
|
|
+ <view class="fs-24 fw-400 fc-9 text-overflow-ellipsis-one pt-15" v-if="shopsInfo.notice">
|
|
|
+ 公告:{{shopsInfo.notice || '暂无公告'}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -42,7 +42,7 @@
|
|
|
<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
|
|
|
+ 桌号:{{table_number}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -55,9 +55,9 @@
|
|
|
<view class="menu-box-left-box pb-130 box-border-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">
|
|
|
+ v-for="(item,i) in categoryList" :key="i" @click="selectType(item)"
|
|
|
+ :class="type === item.category_id?'bgc-f fc-3 fw-600':'fc-6 fw-400'"
|
|
|
+ :id="'left-scroll'+ item.category_id">
|
|
|
{{item.name}}
|
|
|
<view class="menu-type-num fc-f" v-show="item.num > 0">{{item.num > 99?'99+':item.num}}
|
|
|
</view>
|
|
|
@@ -66,7 +66,7 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="menu-box-only bgc-f pb-130 box-border-box">
|
|
|
- <view class="" v-for="(item,i) in categoryData" :key="i" :id="'scroll'+ item.type">
|
|
|
+ <view class="" v-for="(item,i) in goodsList" :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}}
|
|
|
@@ -115,7 +115,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <ShopInfo style="height: 100%;" :shopId='shop_id' v-else-if="shopType === 2"></ShopInfo>
|
|
|
+ <ShopInfo style="height: 100%;" v-else-if="shopType === 2"></ShopInfo>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
@@ -150,16 +150,18 @@
|
|
|
<view class="fs-28 fw-400 fc-9">清空</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="scroll-view-css bgc-ECECEC box-border-box p-32">
|
|
|
- <view class="buy-card-item display-flex" v-for="(goods,i) in cartData.goods_list" :key="i">
|
|
|
+ <view class="scroll-view-css bgc-ECECEC box-border-box car-scroll-box">
|
|
|
+ <view class="buy-card-item bgc-f b-rad-20 display-flex p-20 box-border-box"
|
|
|
+ v-for="(goods,i) in cartData.goods_list" :key="i">
|
|
|
<image class="goods_img" :src="goods.goods_image" mode="scaleToFill"></image>
|
|
|
- <view class="flex-1">
|
|
|
- <view class="w-514 text-overflow-ellipsis-one fs-34 fw-600 mb-12">
|
|
|
- {{goods.goods_name}}
|
|
|
- </view>
|
|
|
- <view class="w-514 text-overflow-ellipsis-one fs-24 fw-400 mb-18"
|
|
|
- :class="goods.status_str?'fc-FD5C02':'fc-9'">
|
|
|
- {{goods.status_str?goods.status_str:goods.goods_attr}}
|
|
|
+ <view class="flex-1 flex-direction flex-justify-space">
|
|
|
+ <view class="">
|
|
|
+ <view class="w-514 text-overflow-ellipsis-one fs-34 fw-600 mb-8">
|
|
|
+ {{goods.goods_name}}
|
|
|
+ </view>
|
|
|
+ <view class="fc-6">
|
|
|
+ {{goods.goods_attr}}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="flex-justify-space">
|
|
|
<view class="">
|
|
|
@@ -168,12 +170,12 @@
|
|
|
</view>
|
|
|
<view class="display-flex align-items-center">
|
|
|
<image class="wh-44" @click.stop="setShoppingSave(goods,2)"
|
|
|
- src="@/static/img/takeout/j.png" mode="">
|
|
|
+ src="@/static/img/order-food/reduce-img.png" mode="">
|
|
|
</image>
|
|
|
<view class="right-only-right-2 text-align-center fs-28 fw-400">
|
|
|
{{goods.goods_number}}
|
|
|
</view>
|
|
|
- <image class="wh-44" src="@/static/img/takeout/add.png"
|
|
|
+ <image class="wh-44" src="/static/img/order-food/add-img.png"
|
|
|
@click.stop="setShoppingSave(goods,1)" mode=""></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -211,6 +213,10 @@
|
|
|
import ShopInfo from './shop-mod/info.vue';
|
|
|
import tools from "@/service/tools";
|
|
|
import EnBlank from "@/components/en-utils/en-blank/en-blank";
|
|
|
+ import {
|
|
|
+ getGoodsCategory,
|
|
|
+ getGoodsGoods
|
|
|
+ } from '@/api/goods.js'
|
|
|
import {
|
|
|
receiveCoupon
|
|
|
} from "@/api/coupon.js"
|
|
|
@@ -241,6 +247,7 @@
|
|
|
name: "商家",
|
|
|
id: 2
|
|
|
}],
|
|
|
+ table_number: '',
|
|
|
shopType: 1, //组件类型
|
|
|
shopTypeBsLeft: 12,
|
|
|
shop_id: '',
|
|
|
@@ -267,121 +274,17 @@
|
|
|
topHeight: '',
|
|
|
idMark: '', //滚动自适应参数
|
|
|
idMarkTwo: '', //滚动自适应参数
|
|
|
- type: 0, //分类标识
|
|
|
- typeList: [],
|
|
|
- categoryData: [{
|
|
|
- type: 0,
|
|
|
- name: '测试1',
|
|
|
- list: [{
|
|
|
- goods_id: 1,
|
|
|
- goods_name: '测试商品1-1',
|
|
|
- price: '10',
|
|
|
- spec_type: 1,
|
|
|
- goods_number: 0,
|
|
|
- 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'
|
|
|
- }]
|
|
|
- },
|
|
|
- ],
|
|
|
+ type: '', //默认分类标识
|
|
|
+ categoryList: [],
|
|
|
+ goodsList: []
|
|
|
}
|
|
|
},
|
|
|
- onShow() {},
|
|
|
- onLoad(e) {},
|
|
|
+ onShow() {
|
|
|
+ this.getShopIngList()
|
|
|
+ },
|
|
|
+ onLoad(e) {
|
|
|
+ this.getshopInfo()
|
|
|
+ },
|
|
|
mounted() {},
|
|
|
onReachBottom(e) {},
|
|
|
// 监听页面滚动
|
|
|
@@ -402,6 +305,103 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ shopInfo() {
|
|
|
+ // 获取商家详情
|
|
|
+ shopInfo().then((res) => {
|
|
|
+ if (res.code === 1) {
|
|
|
+ this.shopsInfo = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getGoodsCategory() {
|
|
|
+ //获取商家分类
|
|
|
+ getGoodsCategory().then((res) => {
|
|
|
+ if (res.code === 1) {
|
|
|
+ this.categoryList = res.data
|
|
|
+ this.type = res.data[0].category_id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getGoodsGoods() {
|
|
|
+ //获取商家商品列表
|
|
|
+ getGoodsGoods().then((res) => {
|
|
|
+ if (res.code === 1) {
|
|
|
+ // 初始化商品列表
|
|
|
+ this.goodsList = res.data
|
|
|
+ // 从购物车数据中回显每个商品的数量
|
|
|
+ this.updateGoodsNumFromCart()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getShopIngList() {
|
|
|
+ // 获取购物车列表
|
|
|
+ getShopIngList().then(res => {
|
|
|
+ if (res.code === 1) {
|
|
|
+ this.cartData = res.data
|
|
|
+ // 同步更新商品列表中的数量
|
|
|
+ this.updateGoodsNumFromCart()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getshopInfo() {
|
|
|
+ this.table_number = uni.getStorageSync('table_number')
|
|
|
+ this.shopInfo()
|
|
|
+ this.getGoodsCategory()
|
|
|
+ this.getGoodsGoods()
|
|
|
+ },
|
|
|
+ updateGoodsNumFromCart() {
|
|
|
+ // 从购物车数据同步商品数量
|
|
|
+ if (!this.goodsList || !this.cartData.goods_list) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建购物车商品的映射,按goods_id分组,累加数量
|
|
|
+ const cartGoodsMap = {}
|
|
|
+ this.cartData.goods_list.forEach(cartItem => {
|
|
|
+ const goodsId = cartItem.goods_id
|
|
|
+ if (!cartGoodsMap[goodsId]) {
|
|
|
+ cartGoodsMap[goodsId] = 0
|
|
|
+ }
|
|
|
+ // 累加同一个商品不同规格的数量
|
|
|
+ cartGoodsMap[goodsId] += cartItem.goods_number || 0
|
|
|
+ })
|
|
|
+
|
|
|
+ // 更新商品列表中的数量
|
|
|
+ this.goodsList.forEach(category => {
|
|
|
+ if (category.list && category.list.length > 0) {
|
|
|
+ category.list.forEach(goods => {
|
|
|
+ // 从购物车映射中获取该商品的总数量
|
|
|
+ goods.num = cartGoodsMap[goods.goods_id] || 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 更新分类列表中的商品数量
|
|
|
+ this.updateCategoryNum()
|
|
|
+ },
|
|
|
+ updateCategoryNum() {
|
|
|
+ // 更新分类的商品总数
|
|
|
+ if (!this.categoryList || !this.goodsList) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.categoryList.forEach(categoryItem => {
|
|
|
+ // 找到对应的商品分类
|
|
|
+ const goodsCategory = this.goodsList.find(
|
|
|
+ category => category.type === categoryItem.category_id
|
|
|
+ )
|
|
|
+
|
|
|
+ if (goodsCategory && goodsCategory.list) {
|
|
|
+ // 计算该分类下所有商品的总数量
|
|
|
+ const totalNum = goodsCategory.list.reduce((sum, goods) => {
|
|
|
+ return sum + (goods.num || 0)
|
|
|
+ }, 0)
|
|
|
+ categoryItem.num = totalNum
|
|
|
+ } else {
|
|
|
+ categoryItem.num = 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
goToOrder() {
|
|
|
uni.navigateTo({
|
|
|
url: 'pages/order/index'
|
|
|
@@ -413,16 +413,16 @@
|
|
|
})
|
|
|
},
|
|
|
selectType(item, itemTwo) {
|
|
|
- if (this.type != item.type) {
|
|
|
- this.type = item.type;
|
|
|
- this.idMark = 'scroll' + item.type
|
|
|
+ if (this.type != item.category_id) {
|
|
|
+ this.type = item.category_id;
|
|
|
+ this.idMark = 'scroll' + item.category_id
|
|
|
|
|
|
// 立即更新
|
|
|
this.$forceUpdate();
|
|
|
|
|
|
// 延迟执行滚动
|
|
|
setTimeout(() => {
|
|
|
- this.scrollToCategorySimple(item.type);
|
|
|
+ this.scrollToCategorySimple(item.category_id);
|
|
|
}, 100);
|
|
|
}
|
|
|
},
|
|
|
@@ -455,26 +455,6 @@
|
|
|
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();
|
|
|
},
|
|
|
addred(type, item) {
|
|
|
@@ -486,54 +466,37 @@
|
|
|
// 减
|
|
|
--item.num;
|
|
|
if (item.num >= 0) {
|
|
|
- this.addShoppingSave(item, item.num, type)
|
|
|
+ this.shoppingSave(item, item.num)
|
|
|
} else {
|
|
|
this.isAjax = false
|
|
|
}
|
|
|
} else if (type === 2) {
|
|
|
// 加
|
|
|
++item.num;
|
|
|
- if (item.is_infinite === 0 && item.num > item.stock) {
|
|
|
- --item.num
|
|
|
- this.isAjax = false
|
|
|
- } else if (item.is_quota > 0 && item.num > item.quota_num) {
|
|
|
- --item.num
|
|
|
- this.isAjax = false
|
|
|
- } else {
|
|
|
- this.addShoppingSave(item, item.num, type)
|
|
|
- }
|
|
|
-
|
|
|
+ this.shoppingSave(item, item.num)
|
|
|
} else if (type === 3) {
|
|
|
// 选规格
|
|
|
+ this.isAjax = false
|
|
|
uni.navigateTo({
|
|
|
- url: 'pages-takeout/new-specs-info'
|
|
|
+ url: `pages-takeout/new-specs-info?goods_id=${item.goods_id}&category_id=${item.category_id}`
|
|
|
})
|
|
|
- } 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(item, num) {
|
|
|
shoppingSave({
|
|
|
- type: 1,
|
|
|
goods_id: item.goods_id,
|
|
|
- shop_id: this.shop_id,
|
|
|
category_id: item.category_id,
|
|
|
- goods_spec_id: '',
|
|
|
+ goods_spec_id: item.goods_spec_id,
|
|
|
number: num
|
|
|
}).then((res) => {
|
|
|
if (res.code === 1) {
|
|
|
- if (type === 1) {
|
|
|
- tools.success('操作成功')
|
|
|
- } else {
|
|
|
- tools.success(res.msg)
|
|
|
- }
|
|
|
+ tools.success(res.msg)
|
|
|
this.isAjax = false
|
|
|
+ // 直接更新当前商品的数量(即时反馈)
|
|
|
+ const goods = this.findGoodsInList(item.goods_id)
|
|
|
+ if (goods) {
|
|
|
+ goods.num = num
|
|
|
+ }
|
|
|
this.getShopIngList()
|
|
|
} else {
|
|
|
this.isAjax = false
|
|
|
@@ -541,17 +504,17 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- 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();
|
|
|
+ findGoodsInList(goodsId) {
|
|
|
+ // 在商品列表中查找指定商品
|
|
|
+ for (let category of this.goodsList) {
|
|
|
+ if (category.list) {
|
|
|
+ const goods = category.list.find(item => item.goods_id === goodsId)
|
|
|
+ if (goods) {
|
|
|
+ return goods
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null
|
|
|
},
|
|
|
navHeight(e) {
|
|
|
this.newNavHeight = e
|
|
|
@@ -570,10 +533,7 @@
|
|
|
success: (res) => {
|
|
|
console.log(res)
|
|
|
if (res.confirm) {
|
|
|
- setShopIngDel({
|
|
|
- 'shop_id': this.shop_id,
|
|
|
- 'type': 1,
|
|
|
- }).then((res) => {
|
|
|
+ setShopIngDel().then((res) => {
|
|
|
if (res.code === 1) {
|
|
|
tools.success(res.msg)
|
|
|
this.getShopIngList()
|
|
|
@@ -587,53 +547,14 @@
|
|
|
});
|
|
|
},
|
|
|
setShoppingSave(item, type) {
|
|
|
- console.log(item, '11111111');
|
|
|
if (type === 1) {
|
|
|
// 加
|
|
|
item.goods_number = item.goods_number + 1
|
|
|
} else {
|
|
|
// 减
|
|
|
- if (item.goods_number < 0) {
|
|
|
- return
|
|
|
- }
|
|
|
item.goods_number = item.goods_number - 1
|
|
|
}
|
|
|
- return
|
|
|
- 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)
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ this.shoppingSave(item, item.goods_number)
|
|
|
},
|
|
|
setCartData(cartData) {
|
|
|
this.cartData = cartData
|
|
|
@@ -719,6 +640,10 @@
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+ .car-scroll-box {
|
|
|
+ padding: 12rpx 24rpx calc(env(safe-area-inset-bottom) + 48rpx);
|
|
|
+ }
|
|
|
+
|
|
|
.zh-icon {
|
|
|
width: 32rpx;
|
|
|
height: 32rpx;
|
|
|
@@ -967,7 +892,7 @@
|
|
|
}
|
|
|
|
|
|
.buy-card {
|
|
|
- height: 920rpx;
|
|
|
+ height: 60vh;
|
|
|
border-radius: 24rpx 24rpx 0rpx 0rpx;
|
|
|
}
|
|
|
|
|
|
@@ -980,7 +905,7 @@
|
|
|
|
|
|
.buy-card-item {
|
|
|
width: 100%;
|
|
|
- height: 176rpx;
|
|
|
+ // height: 176rpx;
|
|
|
margin-bottom: 32rpx;
|
|
|
}
|
|
|
|
|
|
@@ -1100,6 +1025,7 @@
|
|
|
|
|
|
.menu-box-left-box {
|
|
|
overflow-y: auto;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
.menu-type-list {
|
|
|
@@ -1108,6 +1034,7 @@
|
|
|
padding: 18rpx 28rpx;
|
|
|
position: relative;
|
|
|
z-index: 10;
|
|
|
+ border-radius: 0rpx 20rpx 20rpx 0rpx;
|
|
|
|
|
|
.menu-type-num {
|
|
|
position: absolute;
|
|
|
@@ -1118,7 +1045,7 @@
|
|
|
height: 32rpx;
|
|
|
text-align: center;
|
|
|
line-height: 32rpx;
|
|
|
- background: #FB3D03;
|
|
|
+ background: #FE6B2C;
|
|
|
border-radius: 50%;
|
|
|
}
|
|
|
}
|
|
|
@@ -1126,7 +1053,6 @@
|
|
|
.menu-type-list-f {
|
|
|
// width: 160rpx;
|
|
|
background-color: #007AFF;
|
|
|
-
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
overflow-y: auto;
|
|
|
@@ -1175,15 +1101,16 @@
|
|
|
|
|
|
.selectedNum {
|
|
|
position: absolute;
|
|
|
- right: 2rpx;
|
|
|
+ right: -10rpx;
|
|
|
top: -22rpx;
|
|
|
font-size: 24rpx;
|
|
|
color: #fff;
|
|
|
width: 32rpx;
|
|
|
height: 32rpx;
|
|
|
line-height: 32rpx;
|
|
|
- background: #FB3D03;
|
|
|
+ background: #FE6B2C;
|
|
|
border-radius: 50%;
|
|
|
+ border: 1rpx solid #FFFFFF;
|
|
|
}
|
|
|
}
|
|
|
|