Compare commits
11 Commits
916e41e424
...
ad58591164
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad58591164 | ||
|
|
14826e746d | ||
|
|
389951eeb6 | ||
|
|
03ef856fd3 | ||
|
|
15afc855fc | ||
|
|
f2983a3de5 | ||
|
|
0c7b906afd | ||
|
|
5218893ae7 | ||
|
|
5d77e6f407 | ||
|
|
e7108f6182 | ||
|
|
4036939b9c |
@ -5,6 +5,7 @@
|
|||||||
:class="['tabItem', selectedTab === index ? 'active2' : '']" @click="selectTab(index, item)">
|
:class="['tabItem', selectedTab === index ? 'active2' : '']" @click="selectTab(index, item)">
|
||||||
{{ item.category_name }}
|
{{ item.category_name }}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="content">
|
<view class="content">
|
||||||
|
|||||||
@ -51,7 +51,7 @@ export default {
|
|||||||
color: '请选择',
|
color: '请选择',
|
||||||
show: false,
|
show: false,
|
||||||
// 颜色选项列表
|
// 颜色选项列表
|
||||||
colorOptions: ['蓝色', '黄色', '黑色', '白色', '绿色', '渐变绿底黑字', '黄绿双拼底黑字'],
|
colorOptions: ['蓝牌', '黄牌', '黑牌', '白牌', '绿牌', '渐变绿底黑字', '黄绿双拼底黑字'],
|
||||||
// 当前选中的颜色索引
|
// 当前选中的颜色索引
|
||||||
selectedColorIndex: -1
|
selectedColorIndex: -1
|
||||||
};
|
};
|
||||||
|
|||||||
@ -32,7 +32,7 @@ page {
|
|||||||
/* 车牌类型标签样式 */
|
/* 车牌类型标签样式 */
|
||||||
.plate-type-box{
|
.plate-type-box{
|
||||||
padding: 11rpx 2rpx;
|
padding: 11rpx 2rpx;
|
||||||
border: 1rpx solid #1890ff;
|
/* border: 1rpx solid #1890ff; */
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,11 +7,11 @@
|
|||||||
<view class="license-plate">
|
<view class="license-plate">
|
||||||
<view class="plate-type-box">
|
<view class="plate-type-box">
|
||||||
<text class="plate-type" :class="{
|
<text class="plate-type" :class="{
|
||||||
'plate-color-blue': item.car_number_color === '蓝色',
|
'plate-color-blue': item.car_number_color === '蓝牌',
|
||||||
'plate-color-yellow': item.car_number_color === '黄色',
|
'plate-color-yellow': item.car_number_color === '黄牌',
|
||||||
'plate-color-black': item.car_number_color === '黑色',
|
'plate-color-black': item.car_number_color === '黑牌',
|
||||||
'plate-color-white': item.car_number_color === '白色',
|
'plate-color-white': item.car_number_color === '白牌',
|
||||||
'plate-color-green': item.car_number_color === '绿色',
|
'plate-color-green': item.car_number_color === '绿牌',
|
||||||
'plate-color-gradient-green': item.car_number_color === '渐变绿底黑字',
|
'plate-color-gradient-green': item.car_number_color === '渐变绿底黑字',
|
||||||
'plate-color-yellow-green': item.car_number_color === '黄绿双拼底黑字'
|
'plate-color-yellow-green': item.car_number_color === '黄绿双拼底黑字'
|
||||||
}">{{ item.car_number_color }}</text>
|
}">{{ item.car_number_color }}</text>
|
||||||
|
|||||||
@ -158,7 +158,7 @@ export default {
|
|||||||
color: '请选择',
|
color: '请选择',
|
||||||
show: false,
|
show: false,
|
||||||
// 颜色选项列表
|
// 颜色选项列表
|
||||||
colorOptions: ['蓝色', '黄色', '黑色', '白色', '绿色', '渐变绿底黑字', '黄绿双拼底黑字'],
|
colorOptions: ['蓝牌', '黄牌', '黑牌', '白牌', '绿牌', '渐变绿底黑字', '黄绿双拼底黑字'],
|
||||||
// 当前选中的颜色索引
|
// 当前选中的颜色索引
|
||||||
selectedColorIndex: -1,
|
selectedColorIndex: -1,
|
||||||
|
|
||||||
|
|||||||
@ -24,15 +24,15 @@ image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.isDay {
|
.isDay {
|
||||||
background-color: orangered;
|
background-color: orangered;
|
||||||
height: 35rpx;
|
height: 35rpx;
|
||||||
border-radius: 5rpx;
|
border-radius: 5rpx;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 5rpx 10rpx;
|
padding: 5rpx 10rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
@ -188,7 +188,7 @@ image {
|
|||||||
margin: 0 20rpx;
|
margin: 0 20rpx;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Msg {
|
.Msg {
|
||||||
@ -598,15 +598,17 @@ image {
|
|||||||
margin: 5rpx 5rpx 0 5rpx;
|
margin: 5rpx 5rpx 0 5rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.itemSizeBox {
|
||||||
|
margin: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.itemSize {
|
.itemSize {
|
||||||
width: 30%;
|
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
background: #F6F7FB;
|
background: #F6F7FB;
|
||||||
border-radius: 40rpx;
|
border-radius: 40rpx;
|
||||||
padding: 10rpx 15rpx;
|
padding: 10rpx 15rpx;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin:20rpx 30rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemSize_active {
|
.itemSize_active {
|
||||||
@ -614,15 +616,14 @@ image {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemSize-img{
|
.itemSize-img {
|
||||||
width: 100rpx;
|
width: 100rpx;
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
border:1rpx solid red;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemSize_top{
|
.itemSize_top {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: 30rpx;
|
margin-left: 30rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
{{ item.goods_spec }} / {{ item.goods_unit }}
|
{{ item.goods_spec }} / {{ item.goods_unit }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="GG_rigth">
|
<view class="GG_rigth" @click="showSizePopup">
|
||||||
共{{ info.commodity_goods_info_list.length }}款<u-icon size="26rpx" name="arrow-right"></u-icon>
|
共{{ info.commodity_goods_info_list.length }}款<u-icon size="26rpx" name="arrow-right"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -297,9 +297,9 @@
|
|||||||
<view class="itemSize_price">¥{{ changePrice }}/袋</view>
|
<view class="itemSize_price">¥{{ changePrice }}/袋</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="itemSize" v-for="(item, index) in info.commodity_goods_info_list" :key="item.id"
|
<view class="itemSizeBox" v-for="(item, index) in info.commodity_goods_info_list" :key="item.id"
|
||||||
@click="changeGG(item, index)" :class="index == currentGGIndex ? 'itemSize_active' : ''">
|
@click="changeGG(item, index)">
|
||||||
{{ item.goods_name }} {{ item.goods_spec }} / {{ item.goods_unit }}
|
<text class="itemSize" :class="index == currentGGIndex ? 'itemSize_active' : ''">{{ item.goods_name }} {{ item.goods_spec }} / {{ item.goods_unit }}</text>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
</view>
|
</view>
|
||||||
@ -459,7 +459,7 @@ export default {
|
|||||||
console.log("this.currentGG", this.currentGG);
|
console.log("this.currentGG", this.currentGG);
|
||||||
this.currentGGIndex = 0;
|
this.currentGGIndex = 0;
|
||||||
|
|
||||||
this.changeImg = this.currentGG.commodity_pic[0]
|
this.changeImg = picUrl + this.currentGG.commodity_pic[0]
|
||||||
this.changeName = this.currentGG.goods_alias
|
this.changeName = this.currentGG.goods_alias
|
||||||
this.changePrice = this.currentGG.sales_price
|
this.changePrice = this.currentGG.sales_price
|
||||||
});
|
});
|
||||||
@ -490,7 +490,7 @@ export default {
|
|||||||
count: 0
|
count: 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.changeImg = item.commodity_pic[0]
|
this.changeImg = picUrl + item.commodity_pic[0]
|
||||||
this.changeName = item.goods_alias
|
this.changeName = item.goods_alias
|
||||||
this.changePrice = item.sales_price
|
this.changePrice = item.sales_price
|
||||||
this.getComment(item.goods_id)
|
this.getComment(item.goods_id)
|
||||||
@ -515,20 +515,35 @@ export default {
|
|||||||
|
|
||||||
addCar() {
|
addCar() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
// 获取当前商品
|
||||||
|
const currentGoods = this.info.commodity_goods_info_list[this.currentGGIndex];
|
||||||
|
|
||||||
|
// 获取当前购物车数量和库存数量
|
||||||
|
const currentQuantity = currentGoods.cart_count ? currentGoods.cart_count.count : 0;
|
||||||
|
const stockQuantity = currentGoods.stock_quantity || 0;
|
||||||
|
|
||||||
|
// 检查库存是否充足
|
||||||
|
if (currentQuantity >= stockQuantity) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "库存不足",
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//如果没有当前商品 直接添加一个
|
//如果没有当前商品 直接添加一个
|
||||||
let goods_id_and_count = [];
|
let goods_id_and_count = [];
|
||||||
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = {
|
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = {
|
||||||
count: 1,
|
count: currentQuantity + 1,
|
||||||
};
|
};
|
||||||
this.info.commodity_goods_info_list.forEach((item) => {
|
this.info.commodity_goods_info_list.forEach((item) => {
|
||||||
console.log(item.cart_count);
|
|
||||||
goods_id_and_count.push({
|
goods_id_and_count.push({
|
||||||
goods_id: item.id,
|
goods_id: item.id,
|
||||||
count: item.cart_count ? item.cart_count.count : 0,
|
count: item.cart_count ? item.cart_count.count : 0,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(goods_id_and_count);
|
|
||||||
//因为是当前商品没有 调用update就是增加商品。增加商品之后再获取购物车数量
|
//因为是当前商品没有 调用update就是增加商品。增加商品之后再获取购物车数量
|
||||||
request(apiArr.updateCar, "POST", {
|
request(apiArr.updateCar, "POST", {
|
||||||
goods_id_and_count,
|
goods_id_and_count,
|
||||||
|
|||||||
@ -177,7 +177,10 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getShopdetail() {
|
getShopdetail() {
|
||||||
return request(shopApi.getCar, "POST").then((res) => {
|
const params = {
|
||||||
|
is_group_buy: 1,
|
||||||
|
}
|
||||||
|
return request(shopApi.getCar, "POST", params).then((res) => {
|
||||||
this.carNum = res.total;
|
this.carNum = res.total;
|
||||||
// 合并当日达和普通商品数据
|
// 合并当日达和普通商品数据
|
||||||
this.goodsDetail = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
this.goodsDetail = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
||||||
@ -206,7 +209,11 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
toDetail(item) {
|
toDetail(itemObj) {
|
||||||
|
const item = {
|
||||||
|
...itemObj,
|
||||||
|
groupById: itemObj.group_buy_activity_info.id
|
||||||
|
};
|
||||||
NavgateTo(`/packages/shop/groupPurchaseDetail/index?item=${JSON.stringify(item)}`)
|
NavgateTo(`/packages/shop/groupPurchaseDetail/index?item=${JSON.stringify(item)}`)
|
||||||
},
|
},
|
||||||
// 获取商品价格范围
|
// 获取商品价格范围
|
||||||
@ -295,7 +302,10 @@ export default {
|
|||||||
},
|
},
|
||||||
// 跳转到购物车
|
// 跳转到购物车
|
||||||
shopCar() {
|
shopCar() {
|
||||||
NavgateTo("../shopCar/index");
|
const item = {
|
||||||
|
is_group_buy: 1,
|
||||||
|
}
|
||||||
|
NavgateTo("../shopCar/index?item=" + JSON.stringify(item));
|
||||||
},
|
},
|
||||||
// 计算距离结束日期的剩余时间
|
// 计算距离结束日期的剩余时间
|
||||||
getEndTheCountdown(endTime) {
|
getEndTheCountdown(endTime) {
|
||||||
|
|||||||
@ -328,6 +328,7 @@ export default {
|
|||||||
boxshadow1: false,
|
boxshadow1: false,
|
||||||
boxshadow2: false,
|
boxshadow2: false,
|
||||||
id: "",
|
id: "",
|
||||||
|
groupById: "",
|
||||||
info: "",
|
info: "",
|
||||||
currentIndex: "1", //当前轮播图
|
currentIndex: "1", //当前轮播图
|
||||||
|
|
||||||
@ -568,9 +569,11 @@ export default {
|
|||||||
},
|
},
|
||||||
//商品详情
|
//商品详情
|
||||||
getGoodsInfo() {
|
getGoodsInfo() {
|
||||||
request(apiArr.getGoodsInfo, "POST", {
|
const params = {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
}).then((res) => {
|
group_buy_activity_id: this.groupById
|
||||||
|
}
|
||||||
|
request(apiArr.getGoodsInfo, "POST", params).then((res) => {
|
||||||
// 分割图片
|
// 分割图片
|
||||||
res.commodity_goods_info_list.forEach((item) => {
|
res.commodity_goods_info_list.forEach((item) => {
|
||||||
item.goods_detail_pic = item.goods_detail_pic ? item.goods_detail_pic.split(",") : [];
|
item.goods_detail_pic = item.goods_detail_pic ? item.goods_detail_pic.split(",") : [];
|
||||||
@ -590,10 +593,14 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentTime = new Date().getTime();
|
||||||
|
|
||||||
// 过滤掉group_buy_activity_info为空的数据
|
// 过滤掉group_buy_activity_info为空的数据
|
||||||
if (res.commodity_goods_info_list && Array.isArray(res.commodity_goods_info_list)) {
|
if (res.commodity_goods_info_list && Array.isArray(res.commodity_goods_info_list)) {
|
||||||
res.commodity_goods_info_list = res.commodity_goods_info_list.filter(item => {
|
res.commodity_goods_info_list = res.commodity_goods_info_list.filter(item => {
|
||||||
return item.group_buy_activity_info !== null
|
const startTime = new Date(item.group_buy_goods_activity.group_buy_activity_info?.start_time).getTime();
|
||||||
|
const endTime = new Date(item.group_buy_goods_activity.group_buy_activity_info?.end_time).getTime();
|
||||||
|
return item.group_buy_activity_info !== null && currentTime >= startTime && currentTime <= endTime
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,7 +677,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getShopCarList() {
|
getShopCarList() {
|
||||||
return request(apiArr.getCar, "POST", {}).then((res) => {
|
const params = {
|
||||||
|
is_group_buy: 1,
|
||||||
|
}
|
||||||
|
return request(apiArr.getCar, "POST", params).then((res) => {
|
||||||
// 合并当日达和普通商品数据
|
// 合并当日达和普通商品数据
|
||||||
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
||||||
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
|
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
|
||||||
@ -809,6 +819,7 @@ export default {
|
|||||||
this.top = meun.top;
|
this.top = meun.top;
|
||||||
this.localHeight = meun.height;
|
this.localHeight = meun.height;
|
||||||
this.id = this.itemObj.commodity_id ? this.itemObj.commodity_id : this.itemObj.id;
|
this.id = this.itemObj.commodity_id ? this.itemObj.commodity_id : this.itemObj.id;
|
||||||
|
this.groupById = this.itemObj.groupById
|
||||||
if (this.itemObj.commodity_id) {
|
if (this.itemObj.commodity_id) {
|
||||||
this.endTime = this.itemObj.group_buy_activity_info.end_time
|
this.endTime = this.itemObj.group_buy_activity_info.end_time
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -168,8 +168,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 运费 -->
|
<!-- 运费 -->
|
||||||
<view class="goods-desc" style="margin-top: 10rpx;">运费 ¥{{
|
<!-- <view class="goods-desc" style="margin-top: 10rpx;">运费 ¥{{
|
||||||
item.commodity_goods_info.freight }}</view>
|
item.commodity_goods_info.freight }}</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="quantity-control">
|
<view class="quantity-control">
|
||||||
<view class="decrease-btn" @tap.stop="decreaseQuantity(item)">-</view>
|
<view class="decrease-btn" @tap.stop="decreaseQuantity(item)">-</view>
|
||||||
@ -420,14 +420,24 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
increaseQuantity(item) {
|
increaseQuantity(item) {
|
||||||
|
console.log("🚀 ~ increaseQuantity ~ item:", item)
|
||||||
const currentTime = new Date().getTime();
|
const currentTime = new Date().getTime();
|
||||||
const startTime = new Date(item.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
const startTime = new Date(item.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
||||||
const endTime = new Date(item.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
|
const endTime = new Date(item.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
|
||||||
|
|
||||||
|
if (item.count >= item.commodity_goods_info.stock_quantity) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '库存不足',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (currentTime >= startTime && currentTime <= endTime) {
|
if (currentTime >= startTime && currentTime <= endTime) {
|
||||||
if (item.count == 0) {
|
if (item.count == 0) {
|
||||||
item.count += item.commodity_goods_info.min_order_quantity
|
item.count += item.commodity_goods_info.min_order_quantity
|
||||||
} else {
|
} else {
|
||||||
if (item.count == item.commodity_goods_info.total_stock) {
|
if (item.count >= item.commodity_goods_info.stock_quantity) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '库存不足',
|
title: '库存不足',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@ -474,9 +484,11 @@ export default {
|
|||||||
const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
||||||
const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
|
const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
|
||||||
if (currentTime >= startTime && currentTime <= endTime) {
|
if (currentTime >= startTime && currentTime <= endTime) {
|
||||||
total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight;
|
// total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight;
|
||||||
|
total += goods.commodity_goods_info.group_buy_price * goods.count;
|
||||||
} else {
|
} else {
|
||||||
total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight;
|
// total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight;
|
||||||
|
total += goods.commodity_goods_info.sales_price * goods.count;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 加运费
|
// 加运费
|
||||||
@ -488,9 +500,11 @@ export default {
|
|||||||
const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
const startTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.start_time).getTime();
|
||||||
const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
|
const endTime = new Date(goods.commodity_goods_info.group_buy_activity_info?.end_time).getTime();
|
||||||
if (currentTime >= startTime && currentTime <= endTime) {
|
if (currentTime >= startTime && currentTime <= endTime) {
|
||||||
total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight;
|
// total += goods.commodity_goods_info.group_buy_price * goods.count + goods.commodity_goods_info.freight;
|
||||||
|
total += goods.commodity_goods_info.group_buy_price * goods.count;
|
||||||
} else {
|
} else {
|
||||||
total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight;
|
// total += goods.commodity_goods_info.sales_price * goods.count + goods.commodity_goods_info.freight;
|
||||||
|
total += goods.commodity_goods_info.sales_price * goods.count;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 加运费
|
// 加运费
|
||||||
|
|||||||
@ -320,7 +320,7 @@ page {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
/* position: relative; */
|
/* position: relative; */
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 999;
|
z-index: 15;
|
||||||
padding: 20rpx 10rpx;
|
padding: 20rpx 10rpx;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
@ -404,7 +404,7 @@ page {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 160rpx;
|
top: 160rpx;
|
||||||
z-index: 11;
|
z-index: 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header2 .slide .slide_con .slide_conBox:nth-child(5n) {
|
.header2 .slide .slide_con .slide_conBox:nth-child(5n) {
|
||||||
|
|||||||
@ -33,17 +33,6 @@
|
|||||||
|
|
||||||
<!-- 整体展开的顶部 -->
|
<!-- 整体展开的顶部 -->
|
||||||
<view class="header header2" v-if="topShow">
|
<view class="header header2" v-if="topShow">
|
||||||
<!-- <view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
|
|
||||||
<view class="searchBox_left">
|
|
||||||
<u-icon name="arrow-left" size="20px" color="#000"></u-icon>
|
|
||||||
</view>
|
|
||||||
<view class="searchBox_ipt">
|
|
||||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"
|
|
||||||
mode="aspectFill"></image>
|
|
||||||
<input type="text" placeholder="输入商品名称" />
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
|
|
||||||
<view class="slide">
|
<view class="slide">
|
||||||
<view class="slide_con">
|
<view class="slide_con">
|
||||||
<view v-for="(item, index) in CateList" :key="index" class="slide_conBox" @click="changeCate(item.id)">
|
<view v-for="(item, index) in CateList" :key="index" class="slide_conBox" @click="changeCate(item.id)">
|
||||||
@ -95,7 +84,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 右下阴影 -->
|
<!-- 右下阴影 -->
|
||||||
<view class="boxshadow2" v-if="cateListShow"></view>
|
<view class="boxshadow2" v-if="cateListShow" @click="changeCateListShow"></view>
|
||||||
|
|
||||||
<view class="CateIte">
|
<view class="CateIte">
|
||||||
<view class="CateInfo"
|
<view class="CateInfo"
|
||||||
@ -312,9 +301,8 @@ export default {
|
|||||||
NavgateTo('1')
|
NavgateTo('1')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
changeCate(id) {
|
changeCate(id) {
|
||||||
|
this.checkItem(0)
|
||||||
// 更新当前选中的顶级分类ID
|
// 更新当前选中的顶级分类ID
|
||||||
this.currentCategoryId = id;
|
this.currentCategoryId = id;
|
||||||
// 根据id查找对应的分类
|
// 根据id查找对应的分类
|
||||||
@ -322,6 +310,7 @@ export default {
|
|||||||
if (category) {
|
if (category) {
|
||||||
// 将leftCateList设置为该分类的二级分类,若为null则设为空数组
|
// 将leftCateList设置为该分类的二级分类,若为null则设为空数组
|
||||||
this.leftCateList = category.level_two_category || [];
|
this.leftCateList = category.level_two_category || [];
|
||||||
|
this.tagList1 = category.level_three_category || [];
|
||||||
if (this.leftCateList.length > 0) {
|
if (this.leftCateList.length > 0) {
|
||||||
this.currentLeftCateId = this.leftCateList[0].id;
|
this.currentLeftCateId = this.leftCateList[0].id;
|
||||||
this.secondId = this.leftCateList[0].id;
|
this.secondId = this.leftCateList[0].id;
|
||||||
@ -342,7 +331,7 @@ export default {
|
|||||||
this.cateListShow = false
|
this.cateListShow = false
|
||||||
this.rightTopActive = index;
|
this.rightTopActive = index;
|
||||||
// 获取选中的标签ID
|
// 获取选中的标签ID
|
||||||
this.selectedTagId = this.tagList[index].id;
|
this.selectedTagId = this.tagList[index]?.id;
|
||||||
},
|
},
|
||||||
//右下角点击更多
|
//右下角点击更多
|
||||||
topOpen() {
|
topOpen() {
|
||||||
@ -448,26 +437,42 @@ export default {
|
|||||||
},
|
},
|
||||||
//商品数量变化
|
//商品数量变化
|
||||||
handleQuantityChange(val, item) {
|
handleQuantityChange(val, item) {
|
||||||
// 先在前端直接更新数量,确保页面显示及时变化
|
|
||||||
// 注意:这里的val可能是直接的数值,也可能是包含value属性的对象
|
|
||||||
// 我们需要先确定正确的值
|
|
||||||
const quantity = typeof val === 'object' && val !== null && 'value' in val ? val.value : val;
|
const quantity = typeof val === 'object' && val !== null && 'value' in val ? val.value : val;
|
||||||
|
|
||||||
|
// 检查库存数量
|
||||||
|
let currentQuantity = 0;
|
||||||
|
let stockQuantity = 0;
|
||||||
|
let goodsToUpdate = null;
|
||||||
|
|
||||||
// 对于有规格的主商品(绑定到items.commodity_goods_info_list[0].quantity)
|
// 对于有规格的主商品(绑定到items.commodity_goods_info_list[0].quantity)
|
||||||
if (
|
if (
|
||||||
item.commodity_goods_info_list &&
|
item.commodity_goods_info_list &&
|
||||||
item.commodity_goods_info_list.length
|
item.commodity_goods_info_list.length
|
||||||
) {
|
) {
|
||||||
this.goodsId = item.commodity_goods_info_list[0].id;
|
this.goodsId = item.commodity_goods_info_list[0].id;
|
||||||
// 使用$set确保响应式更新
|
currentQuantity = item.commodity_goods_info_list[0].quantity || 0;
|
||||||
this.$set(item.commodity_goods_info_list[0], 'quantity', quantity);
|
stockQuantity = item.commodity_goods_info_list[0].stock_quantity || 0;
|
||||||
|
goodsToUpdate = item.commodity_goods_info_list[0];
|
||||||
}
|
}
|
||||||
// 对于规格列表中的商品(绑定到ite.quantity)
|
// 对于规格列表中的商品(绑定到ite.quantity)
|
||||||
else {
|
else {
|
||||||
this.goodsId = item.id;
|
this.goodsId = item.id;
|
||||||
// 使用$set确保响应式更新
|
currentQuantity = item.quantity || 0;
|
||||||
this.$set(item, 'quantity', quantity);
|
stockQuantity = item.stock_quantity || 0;
|
||||||
|
goodsToUpdate = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断是否增加数量且库存不足
|
||||||
|
if (quantity > currentQuantity && currentQuantity >= stockQuantity) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "库存不足",
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用$set确保响应式更新
|
||||||
|
this.$set(goodsToUpdate, 'quantity', quantity);
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
user_id: uni.getStorageSync("userId"),
|
user_id: uni.getStorageSync("userId"),
|
||||||
|
|||||||
@ -228,7 +228,7 @@ export default {
|
|||||||
isDayshow: false,
|
isDayshow: false,
|
||||||
isParcelPostchecked: false,
|
isParcelPostchecked: false,
|
||||||
parcelPostshow: false,
|
parcelPostshow: false,
|
||||||
|
is_group_buy: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// watch: {
|
// watch: {
|
||||||
@ -303,7 +303,10 @@ export default {
|
|||||||
|
|
||||||
// 获取购物车列表
|
// 获取购物车列表
|
||||||
getShopCar() {
|
getShopCar() {
|
||||||
request(apiArr.getCar, "POST", {}).then((res) => {
|
const params = {
|
||||||
|
is_group_buy: this.is_group_buy
|
||||||
|
}
|
||||||
|
request(apiArr.getCar, "POST", params).then((res) => {
|
||||||
if (res.normal_cart_list.length > 0) {
|
if (res.normal_cart_list.length > 0) {
|
||||||
res.normal_cart_list.forEach((item) => {
|
res.normal_cart_list.forEach((item) => {
|
||||||
item.checked = false;
|
item.checked = false;
|
||||||
@ -614,6 +617,13 @@ export default {
|
|||||||
this.shopCarTotal++;
|
this.shopCarTotal++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (carItem.count >= carItem.commodity_goods_info.stock_quantity) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '库存不足',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
carItem.count++;
|
carItem.count++;
|
||||||
this.shopCarTotal++;
|
this.shopCarTotal++;
|
||||||
}
|
}
|
||||||
@ -717,6 +727,7 @@ export default {
|
|||||||
const meun = menuButtonInfo();
|
const meun = menuButtonInfo();
|
||||||
this.top = meun.top;
|
this.top = meun.top;
|
||||||
this.localHeight = meun.height;
|
this.localHeight = meun.height;
|
||||||
|
this.is_group_buy = options.item ? JSON.parse(options.item).is_group_buy : ''
|
||||||
this.getShopCar();
|
this.getShopCar();
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user