Compare commits
No commits in common. "884b7e5b38fa2b55427b9607d64776f20fef1363" and "414ea794631ece4ba412dcaa637a62c3f1d2c408" have entirely different histories.
884b7e5b38
...
414ea79463
@ -649,7 +649,7 @@ export default {
|
|||||||
addCar() {
|
addCar() {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = {
|
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = {
|
||||||
count: this.itemObj.one_one === 1 ? 2 : 1,
|
count: 1,
|
||||||
};
|
};
|
||||||
// this.info.commodity_goods_info_list.forEach((item) => {
|
// this.info.commodity_goods_info_list.forEach((item) => {
|
||||||
// console.log(item.cart_count);
|
// console.log(item.cart_count);
|
||||||
@ -659,7 +659,7 @@ export default {
|
|||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
|
||||||
let countVal = this.itemObj.one_one === 1 ? 2 : 1;
|
let countVal = 1
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
goods_id_and_count: [
|
goods_id_and_count: [
|
||||||
@ -683,7 +683,7 @@ export default {
|
|||||||
// 获取当前商品的购物车数量,如果不存在则设为0
|
// 获取当前商品的购物车数量,如果不存在则设为0
|
||||||
const currentCount = this.info.commodity_goods_info_list[this.currentGGIndex].cart_count?.count;
|
const currentCount = this.info.commodity_goods_info_list[this.currentGGIndex].cart_count?.count;
|
||||||
// 新的数量为当前数量加一
|
// 新的数量为当前数量加一
|
||||||
const newCount = this.itemObj.one_one === 1 ? currentCount + 2 : currentCount + 1;
|
const newCount = currentCount + 1;
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
user_id: uni.getStorageSync("userId"),
|
user_id: uni.getStorageSync("userId"),
|
||||||
@ -691,15 +691,13 @@ export default {
|
|||||||
{
|
{
|
||||||
goods_id: this.info.commodity_goods_info_list[this.currentGGIndex].id,
|
goods_id: this.info.commodity_goods_info_list[this.currentGGIndex].id,
|
||||||
count: newCount,
|
count: newCount,
|
||||||
price: this.changePrice
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
adver_id: this.itemObj.adver_id,
|
adver_id: this.itemObj.adver_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
request(apiArr.updateCar, "POST", params).then((res) => {
|
request(apiArr.updateCar, "POST", params).then((res) => {
|
||||||
return this.getShopCarList();
|
this.getShopCarList();
|
||||||
}).then(() => {
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "操作成功!",
|
title: "操作成功!",
|
||||||
success() { },
|
success() { },
|
||||||
|
|||||||
@ -284,11 +284,6 @@ image {
|
|||||||
margin-top: 26rpx;
|
margin-top: 26rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.car_right_disabled {
|
|
||||||
background: #CCCCCC;
|
|
||||||
color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cars {
|
.cars {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@ -175,22 +175,30 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="car_right" v-if="
|
<view class="car_right" v-if="
|
||||||
info.commodity_goods_info_list[currentGGIndex].stock_quantity > 0 &&
|
!info.commodity_goods_info_list[currentGGIndex].cart_count ||
|
||||||
(!info.commodity_goods_info_list[currentGGIndex].cart_count ||
|
info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0
|
||||||
info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0)
|
|
||||||
" @click="addCar">
|
" @click="addCar">
|
||||||
加入购物车
|
加入购物车
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="car_right" @click="changeCar" v-if="
|
<view class="car_right" v-if="info.commodity_goods_info_list[currentGGIndex].cart_count.count > 0">
|
||||||
info.commodity_goods_info_list[currentGGIndex].cart_count.count > 0
|
<!-- <view class="car_right"> -->
|
||||||
&& info.commodity_goods_info_list[currentGGIndex].stock_quantity > 0
|
<u-number-box v-model="info.commodity_goods_info_list[currentGGIndex].cart_count.count"
|
||||||
">
|
@change="changeCar" min="0">
|
||||||
加入购物车
|
<!-- <u-number-box > -->
|
||||||
|
<view slot="minus" class="minus">
|
||||||
|
<u-icon name="minus" size="36" bold></u-icon>
|
||||||
</view>
|
</view>
|
||||||
|
<text slot="input" style="width: 200rpx; text-align: center" class="input">
|
||||||
<view class="car_right car_right_disabled" v-if="info.commodity_goods_info_list[currentGGIndex].stock_quantity < 1">
|
{{ info.commodity_goods_info_list[currentGGIndex].cart_count.count }}
|
||||||
已售罄
|
</text>
|
||||||
|
<!-- text slot="input" style="width: 200rpx; text-align: center" class="input">
|
||||||
|
{{info.commodity_goods_info_list[currentGGIndex]}}
|
||||||
|
</text> -->
|
||||||
|
<view slot="plus" class="plus">
|
||||||
|
<u-icon name="plus" color="#FFFFFF" size="36" bold></u-icon>
|
||||||
|
</view>
|
||||||
|
</u-number-box>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -568,39 +576,32 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 购物车更改
|
// 购物车更改
|
||||||
changeCar() {
|
changeCar(newValue) {
|
||||||
// 直接增加商品数量,与addCar逻辑类似
|
// // 修改当前商品在购物车中的数量
|
||||||
const currentGoods = this.info.commodity_goods_info_list[this.currentGGIndex];
|
// this.info.commodity_goods_info_list[this.currentGGIndex].cart_count.count = newValue.value
|
||||||
const currentQuantity = currentGoods.cart_count ? currentGoods.cart_count.count : 0;
|
// // 修改购物车列表中的数量
|
||||||
const stockQuantity = currentGoods.stock_quantity || 0;
|
// this.carOrderList.forEach(item => {
|
||||||
|
// if (item.commodity_goods_info.id == this.info.commodity_goods_info_list[this.currentGGIndex].id) {
|
||||||
// 检查库存是否充足
|
// item.count = newValue.value
|
||||||
if (currentQuantity >= stockQuantity) {
|
// }
|
||||||
uni.showToast({
|
// })
|
||||||
title: "库存不足",
|
// // 计算购物车数量
|
||||||
icon: "none",
|
// let carNum = 0
|
||||||
duration: 2000
|
// this.carOrderList.forEach(item => {
|
||||||
});
|
// carNum += item.count
|
||||||
return;
|
// })
|
||||||
}
|
// this.carNum = carNum
|
||||||
|
//商品数量变化
|
||||||
// 增加商品数量
|
|
||||||
currentGoods.cart_count = {
|
|
||||||
count: currentQuantity + 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
user_id: uni.getStorageSync("userId"),
|
user_id: uni.getStorageSync("userId"),
|
||||||
goods_id_and_count: [{
|
goods_id_and_count: [{
|
||||||
goods_id: currentGoods.id,
|
goods_id: this.info.commodity_goods_info_list[this.currentGGIndex].id,
|
||||||
count: currentGoods.cart_count.count,
|
count: newValue.value,
|
||||||
}],
|
},],
|
||||||
};
|
};
|
||||||
|
|
||||||
request(apiArr.updateCar, "POST", params).then((res) => {
|
request(apiArr.updateCar, "POST", params).then((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
this.getShopCarList();
|
this.getShopCarList();
|
||||||
this.getShopCar();
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "操作成功!",
|
title: "操作成功!",
|
||||||
success() { },
|
success() { },
|
||||||
|
|||||||
@ -185,7 +185,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取购物车数据
|
// 获取购物车数据
|
||||||
getShopCarList() {
|
getShopCarList() {
|
||||||
return request(apiArr.getCar, "POST").then((res) => {
|
request(apiArr.getCar, "POST").then((res) => {
|
||||||
this.value = res.total;
|
this.value = 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 || [])
|
||||||
@ -408,12 +408,7 @@ export default {
|
|||||||
this.isSearched = false;
|
this.isSearched = false;
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getShopCarList().then(() => {
|
this.getShopCarList();
|
||||||
// 延迟一小段时间确保购物车数据已完全更新,然后同步商品数量
|
|
||||||
setTimeout(() => {
|
|
||||||
this.syncGoodsQuantities();
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
if (this.flag) {
|
if (this.flag) {
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
<view class="row">
|
<view class="row">
|
||||||
<view class="row_label">商家分类</view>
|
<view class="row_label">商家分类</view>
|
||||||
<view class="row_con" @click="chooseClassify">
|
<view class="row_con" @click="chooseClassify">
|
||||||
<input type="text" disabled v-model="confirmClassify.cate_name" placeholder="请选择商家分类">
|
<input type="text" disabled v-model="confirmClassify.short_name" placeholder="请选择商家分类">
|
||||||
<u-icon name="arrow-right" color="#999999" size="28"></u-icon>
|
<u-icon name="arrow-right" color="#999999" size="28"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -115,7 +115,7 @@
|
|||||||
@cancel="cancelCity"></u-picker>
|
@cancel="cancelCity"></u-picker>
|
||||||
<u-picker :show="show3" :columns="[buss]" keyName="short_name" @confirm="clickBuss"
|
<u-picker :show="show3" :columns="[buss]" keyName="short_name" @confirm="clickBuss"
|
||||||
@cancel="cancelBuss"></u-picker>
|
@cancel="cancelBuss"></u-picker>
|
||||||
<u-picker :show="show4" :columns="[classify]" keyName="cate_name" @confirm="clickClassify"
|
<u-picker :show="show4" :columns="[classify]" keyName="short_name" @confirm="clickClassify"
|
||||||
@cancel="cancelClassify"></u-picker>
|
@cancel="cancelClassify"></u-picker>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -301,7 +301,7 @@ export default {
|
|||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!that.confirmClassify.id) {
|
if (!that.confirmClassify.ad_code) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: '请选择商家分类',
|
title: '请选择商家分类',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
@ -319,7 +319,7 @@ export default {
|
|||||||
let license_photo = that.imgList6.join(",")
|
let license_photo = that.imgList6.join(",")
|
||||||
request(apiArr.createStore, "POST", {
|
request(apiArr.createStore, "POST", {
|
||||||
contact_name: that.contact_name,
|
contact_name: that.contact_name,
|
||||||
phone: that.contact_phone,
|
contact_phone: that.contact_phone,
|
||||||
bank_card: that.bank_card,
|
bank_card: that.bank_card,
|
||||||
store_name: that.store_name,
|
store_name: that.store_name,
|
||||||
address: that.address,
|
address: that.address,
|
||||||
@ -327,7 +327,7 @@ export default {
|
|||||||
facade_photo,
|
facade_photo,
|
||||||
interior_photo,
|
interior_photo,
|
||||||
license_photo,
|
license_photo,
|
||||||
merchant_cate_id: that.confirmClassify.id,
|
classify_code: that.confirmClassify.ad_code,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
that.contact_name = ''
|
that.contact_name = ''
|
||||||
that.contact_phone = ''
|
that.contact_phone = ''
|
||||||
@ -370,9 +370,20 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getClassify(e) {
|
getClassify(e) {
|
||||||
request(apiArr.getMerChantCateList, "POST", {}).then(res => {
|
this.classify = [
|
||||||
this.classify = res.rows
|
{
|
||||||
})
|
ad_code: "1",
|
||||||
|
short_name: "111"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ad_code: "2",
|
||||||
|
short_name: "222"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ad_code: "3",
|
||||||
|
short_name: "333"
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user