|
@@ -10,9 +10,10 @@
|
|
</view>
|
|
</view>
|
|
</u-col>
|
|
</u-col>
|
|
<view class="container">
|
|
<view class="container">
|
|
- <u-tag plain :text="tags ? '营业中' : '离线'" :type="tags ? 'success' : 'error'" size="mini"></u-tag>
|
|
|
|
|
|
+ <u-tag plain :text="cList.openState ? '营业中' : '离线'" :type="cList.openState ? 'success' : 'error'"
|
|
|
|
+ size="mini"></u-tag>
|
|
<view @click="btnIc">
|
|
<view @click="btnIc">
|
|
- <u-icon label="当前餐车名称" labelPos="left" size="16" name="arrow-down"></u-icon>
|
|
|
|
|
|
+ <u-icon :label="cList.name" labelPos="left" size="16" name="arrow-down"></u-icon>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-col span="3">
|
|
<u-col span="3">
|
|
@@ -22,34 +23,17 @@
|
|
</u-col>
|
|
</u-col>
|
|
</u-row>
|
|
</u-row>
|
|
</view>
|
|
</view>
|
|
- <!-- <top-search :isSearch="false" @searchClick="searchClick"></top-search>
|
|
|
|
- <view class="w-full padding-lr-sm box-sizing-b dflex-b">
|
|
|
|
- <scroll-view class="goods-category" scroll-x>
|
|
|
|
- <view class="category-box">
|
|
|
|
- <view class="category-item padding-lr-lg" v-for="item in 8" :key="item" :class="{'on-category':onIndex === item}">分类{{item+1}}</view>
|
|
|
|
- </view>
|
|
|
|
- </scroll-view>
|
|
|
|
- <view class="classify-icon">
|
|
|
|
- <u-icon name="grid-fill" size="30" @click="show = true" />
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
- <u-popup :show="show" mode="left" @close="show = false">
|
|
|
|
- <view class="classify-popup padding-lr-lg padding-tb box-sizing-b">
|
|
|
|
- <view class="padding-tb-sm">全部</view>
|
|
|
|
- <view class="padding-tb-sm" v-for="index in 8">分类{{index+1}}</view>
|
|
|
|
- </view>
|
|
|
|
- </u-popup> -->
|
|
|
|
<view class="w-full dflex-b padding-xs box-sizing-b dflex-wrap-w">
|
|
<view class="w-full dflex-b padding-xs box-sizing-b dflex-wrap-w">
|
|
<view class="goods-item margin-bottom-sm" v-for="(item, gindex) in goods" :key="gindex">
|
|
<view class="goods-item margin-bottom-sm" v-for="(item, gindex) in goods" :key="gindex">
|
|
- <view class="img dflex-c" @click="toDetial">
|
|
|
|
- <image mode="aspectFit" :src="'../../static/x'+ gindex%2 +'.jpg'"></image>
|
|
|
|
|
|
+ <view class="img dflex-c" @click="toDetial(item)">
|
|
|
|
+ <image mode="aspectFit" :src="item.imgList[0].url"></image>
|
|
</view>
|
|
</view>
|
|
- <view class="title">{{item.goods_name}}</view>
|
|
|
|
|
|
+ <view class="title">{{item.spuName}}</view>
|
|
<view class="dflex padding-bottom-xs">
|
|
<view class="dflex padding-bottom-xs">
|
|
<u-tag plain text="销量: 199" borderColor="#FF6D20" color="#FF6D20" size="mini"></u-tag>
|
|
<u-tag plain text="销量: 199" borderColor="#FF6D20" color="#FF6D20" size="mini"></u-tag>
|
|
</view>
|
|
</view>
|
|
<view class="w-full dflex-b">
|
|
<view class="w-full dflex-b">
|
|
- <view class="price">{{item.goods_price}}</view>
|
|
|
|
|
|
+ <view class="price">{{item.minPrice ? item.minPrice : '无'}}</view>
|
|
<view>
|
|
<view>
|
|
<u-button type="primary" shape="circle" size="small"
|
|
<u-button type="primary" shape="circle" size="small"
|
|
color="linear-gradient(to right, #F54319, #FF6D20)" @click="goCart(item)">
|
|
color="linear-gradient(to right, #F54319, #FF6D20)" @click="goCart(item)">
|
|
@@ -59,7 +43,7 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <my-gap :height="130" />
|
|
|
|
|
|
+ <my-gap :height="10" />
|
|
<specPopup class='spec-box' ref="specPopup" :cardMsg="cardMsg" @update-shopmsg="handleUpdateShopMsg">
|
|
<specPopup class='spec-box' ref="specPopup" :cardMsg="cardMsg" @update-shopmsg="handleUpdateShopMsg">
|
|
</specPopup>
|
|
</specPopup>
|
|
<view class="cart-bottom padding-sm dflex-b">
|
|
<view class="cart-bottom padding-sm dflex-b">
|
|
@@ -97,89 +81,39 @@
|
|
shoppingCart: shoppingCart,
|
|
shoppingCart: shoppingCart,
|
|
tags: 1,
|
|
tags: 1,
|
|
txts: 1,
|
|
txts: 1,
|
|
- goods: [ // 购物车数据列表
|
|
|
|
- {
|
|
|
|
- id: 1,
|
|
|
|
- goods_name: "小乳酸菌牛奶酸奶",
|
|
|
|
- goods_price: 5.20,
|
|
|
|
- goods_type: '大份',
|
|
|
|
- goods_num: 1,
|
|
|
|
- src: '../../static/x0.jpg',
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: 2,
|
|
|
|
- goods_name: "饮料整箱饮品",
|
|
|
|
- goods_price: 5.20,
|
|
|
|
- goods_type: '大份',
|
|
|
|
- goods_num: 1,
|
|
|
|
- src: '../../static/x1.jpg',
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: 3,
|
|
|
|
- goods_name: "饮品早餐酸乳益生菌",
|
|
|
|
- goods_price: 5.20,
|
|
|
|
- goods_type: '小份',
|
|
|
|
- goods_num: 1,
|
|
|
|
- src: '../../static/x0.jpg',
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: 4,
|
|
|
|
- goods_name: "酸奶饮料",
|
|
|
|
- goods_price: 5.20,
|
|
|
|
- goods_type: '小份',
|
|
|
|
- goods_num: 1,
|
|
|
|
- src: '../../static/x1.jpg',
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: 5,
|
|
|
|
- goods_name: "小乳酸菌",
|
|
|
|
- goods_price: 5.20,
|
|
|
|
- goods_type: '小份',
|
|
|
|
- goods_num: 1,
|
|
|
|
- src: '../../static/x0.jpg',
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: 6,
|
|
|
|
- goods_name: "酸乳益生菌",
|
|
|
|
- goods_price: 5.20,
|
|
|
|
- goods_type: '大份',
|
|
|
|
- goods_num: 1,
|
|
|
|
- src: '../../static/x1.jpg',
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
|
|
+ carList: {},
|
|
|
|
+ goods: [],
|
|
total: 0,
|
|
total: 0,
|
|
- carList: [],
|
|
|
|
|
|
+ cList: {},
|
|
cardMsg: {},
|
|
cardMsg: {},
|
|
selectedList: [],
|
|
selectedList: [],
|
|
buyCount: 0
|
|
buyCount: 0
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- created() {
|
|
|
|
- this.fatchDate()
|
|
|
|
|
|
+ onLoad() {
|
|
|
|
+ const e = uni.getStorageSync('carl')
|
|
|
|
+ this.cList = e
|
|
|
|
+ this.fatchDate(e)
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 加购
|
|
// 加购
|
|
goCart(e) {
|
|
goCart(e) {
|
|
console.log('================', e)
|
|
console.log('================', e)
|
|
this.cardMsg = e
|
|
this.cardMsg = e
|
|
- this.$refs.specPopup.open();
|
|
|
|
- //this.$refs.specPopup.change(true);
|
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.specPopup.open();
|
|
|
|
+ });
|
|
|
|
+ this.carList = e
|
|
},
|
|
},
|
|
handleSelectedChanged(selectedItems) {
|
|
handleSelectedChanged(selectedItems) {
|
|
console.log('选中的数据:', selectedItems)
|
|
console.log('选中的数据:', selectedItems)
|
|
this.carList = selectedItems
|
|
this.carList = selectedItems
|
|
- if(selectedItems.length > 0){
|
|
|
|
|
|
+ if (selectedItems.length > 0) {
|
|
this.buyCount = this.carList.length
|
|
this.buyCount = this.carList.length
|
|
} else {
|
|
} else {
|
|
this.buyCount = 0
|
|
this.buyCount = 0
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
this.totalPrice();
|
|
this.totalPrice();
|
|
},
|
|
},
|
|
handleUpdateShopMsg(shopMsg) {
|
|
handleUpdateShopMsg(shopMsg) {
|
|
@@ -207,7 +141,7 @@
|
|
this.buyCount = this.carList.length
|
|
this.buyCount = this.carList.length
|
|
// 您可以在这里执行其他逻辑,比如保存到本地存储或发送到服务器
|
|
// 您可以在这里执行其他逻辑,比如保存到本地存储或发送到服务器
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
console.log('购物车列表更新:', this.carList);
|
|
console.log('购物车列表更新:', this.carList);
|
|
this.totalPrice();
|
|
this.totalPrice();
|
|
},
|
|
},
|
|
@@ -257,9 +191,9 @@
|
|
url: `/pages/diningList/diningList`
|
|
url: `/pages/diningList/diningList`
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- toDetial() {
|
|
|
|
|
|
+ toDetial(e) {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url: `/pages/goodDetail/goodDetail`
|
|
|
|
|
|
+ url: `/pages/goodDetail/goodDetail?id=${e}`
|
|
})
|
|
})
|
|
},
|
|
},
|
|
toBuy() {
|
|
toBuy() {
|
|
@@ -273,14 +207,35 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
onMyInfo() {
|
|
onMyInfo() {
|
|
|
|
+
|
|
|
|
+ const info = {
|
|
|
|
+ customerPhone: this.cList.customerPhone
|
|
|
|
+ }
|
|
|
|
+ console.log('======================', info)
|
|
|
|
+ uni.setStorageSync("info", info)
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
url: `/pages/user/user`
|
|
url: `/pages/user/user`
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 获取餐车列表
|
|
// 获取餐车列表
|
|
- fatchDate() {
|
|
|
|
-
|
|
|
|
|
|
+ async fatchDate(e) {
|
|
|
|
+ var queryParmas = {
|
|
|
|
+ id: e.id
|
|
|
|
+ }
|
|
|
|
+ console.log('idididididid', queryParmas)
|
|
|
|
+ const result = await this.$request('post', '/sale/diningCarProduct/queryDiningCarProduct', queryParmas,
|
|
|
|
+ true)
|
|
|
|
+ if (result) {
|
|
|
|
+ const queIds = new Set(result.rows.map(item => item.spuId));
|
|
|
|
+ const spuIds = Array.from(queIds).join(',');
|
|
|
|
+ const res = await this.$request('get', `/item/spu/queryByIds?spuIds=${spuIds}`)
|
|
|
|
+ const data = res.data
|
|
|
|
+ this.goods = data.filter(item => item.status !== 1)
|
|
|
|
+
|
|
|
|
+ console.log('res', res.data)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|