【优化】调整拼团单个商品配对多个规则的情况下,价格显示异常的情况。

This commit is contained in:
jianweie code
2024-02-01 12:54:20 +08:00
parent 6f6916ee91
commit f58d2a0257
2 changed files with 70 additions and 30 deletions

View File

@@ -337,8 +337,8 @@ namespace CoreCms.Net.Services
/// <param name="productId"></param> /// <param name="productId"></param>
/// <param name="userId">用户序列</param> /// <param name="userId">用户序列</param>
/// <param name="nums">加入购物车数量</param> /// <param name="nums">加入购物车数量</param>
/// <param name="teamId">团队序列</param> /// <param name="ruleId">规则序列</param>
public async Task<WebApiCallBack> AddCartHavePinTuan(int productId, int userId = 0, int nums = 1, int teamId = 0) public async Task<WebApiCallBack> AddCartHavePinTuan(int productId, int userId = 0, int nums = 1, int ruleId = 0)
{ {
var jm = new WebApiCallBack(); var jm = new WebApiCallBack();
var products = await _productsServices.QueryByIdAsync(productId); var products = await _productsServices.QueryByIdAsync(productId);
@@ -348,14 +348,14 @@ namespace CoreCms.Net.Services
jm.msg = GlobalErrorCodeVars.Code10000; jm.msg = GlobalErrorCodeVars.Code10000;
return jm; return jm;
} }
var pinTuanGoods = await _pinTuanGoodsServices.QueryByClauseAsync(p => p.goodsId == products.goodsId); var pinTuanGoods = await _pinTuanGoodsServices.QueryByClauseAsync(p => p.goodsId == products.goodsId && p.ruleId == ruleId);
if (pinTuanGoods == null) if (pinTuanGoods == null)
{ {
jm.data = 10000; jm.data = 10000;
jm.msg = GlobalErrorCodeVars.Code10000; jm.msg = GlobalErrorCodeVars.Code10000;
return jm; return jm;
} }
var pinTuanRule = await _pinTuanRuleServices.QueryByClauseAsync(p => p.id == pinTuanGoods.ruleId); var pinTuanRule = await _pinTuanRuleServices.QueryByClauseAsync(p => p.id == pinTuanGoods.ruleId && p.isStatusOpen == true);
if (pinTuanRule == null) if (pinTuanRule == null)
{ {
jm.data = 10000; jm.data = 10000;
@@ -377,15 +377,14 @@ namespace CoreCms.Net.Services
} }
//查询是否存在已经开团,并且自己是队长的拼团 //查询是否存在已经开团,并且自己是队长的拼团
var havaGroup = await _pinTuanRecordServices.ExistsAsync(p => var havaGroup = await _pinTuanRecordServices.ExistsAsync(p =>
p.id == p.teamId p.userId == userId
&& p.userId == userId
&& p.goodsId == products.goodsId && p.goodsId == products.goodsId
&& p.teamId == teamId
&& p.status == (int)GlobalEnumVars.PinTuanRecordStatus.InProgress); && p.status == (int)GlobalEnumVars.PinTuanRecordStatus.InProgress);
if (havaGroup) if (havaGroup)
{ {
jm.data = 15613; jm.data = 15613;
jm.msg = GlobalErrorCodeVars.Code15613; //jm.msg = GlobalErrorCodeVars.Code15613;
jm.msg = "您存在已开启的拼团";
return jm; return jm;
} }

View File

@@ -505,8 +505,10 @@
</view> </view>
</u-popup> </u-popup>
<vk-data-goods-sku-popup v-model="skuKey" border-radius="20" :amount-type="0" :localdata="goodsSkuInfo" mode="3" @open="openSkuPopup" @close="closeSkuPopup" @buy-now="buyNow"></vk-data-goods-sku-popup>
<vk-data-goods-sku-popup v-model="skuSingleKey" border-radius="20" :amount-type="0" :localdata="discountsGoodsSkuInfo" mode="3" @open="openSkuSinglePopup" @close="closeSkuSinglePopup" @buy-now="buyNow"></vk-data-goods-sku-popup> <vk-data-goods-sku-popup v-model="skuSingleKey" border-radius="20" :amount-type="0" :localdata="goodsSkuInfo" mode="3" @open="openSkuSinglePopup" @close="closeSkuSinglePopup" @buy-now="buyNowForSingle" buy-now-text="单独购买"></vk-data-goods-sku-popup>
<vk-data-goods-sku-popup v-model="skuKey" border-radius="20" :amount-type="0" :localdata="discountsGoodsSkuInfo" mode="3" @open="openSkuPopup" @close="closeSkuPopup" @buy-now="buyNow" buy-now-text="发起拼团"></vk-data-goods-sku-popup>
<!-- 右边浮动球 --> <!-- 右边浮动球 -->
<coreshop-fab horizontal="right" vertical="bottom" direction="vertical"></coreshop-fab> <coreshop-fab horizontal="right" vertical="bottom" direction="vertical"></coreshop-fab>
@@ -681,19 +683,7 @@
onChange(e) { onChange(e) {
this.timeData = e this.timeData = e
}, },
// 打开sku弹出
openSkuPopup() {
this.skuKey = true;
},
closeSkuPopup() {
this.skuKey = false;
},
openSkuSinglePopup() {
this.skuSingleKey = true;
},
closeSkuSinglePopup() {
this.skuSingleKey = false;
},
// 立即购买 // 立即购买
buyNow(selectShop) { buyNow(selectShop) {
var that = this; var that = this;
@@ -731,6 +721,37 @@
} }
that.closeSkuPopup(); that.closeSkuPopup();
}, },
// 立即购买
buyNowForSingle(selectShop) {
var that = this;
uni.showLoading({
title: '加载中'
});
if (!this.hasLogin) {
uni.hideLoading();
this.$store.commit('showLoginTip', true);
return false;
}
if (selectShop.buy_num > 0) {
let data = {
productId: selectShop._id,
nums: selectShop.buy_num,
type: 2,
cartType: this.$globalConstVars.paymentType.common
}
this.$u.api.addCart(data).then(res => {
if (res.status) {
let cartIds = res.data;
that.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds));
uni.hideLoading();
} else {
this.$u.toast(res.msg);
uni.hideLoading();
}
});
}
that.closeSkuPopup();
},
getServiceDescription() { getServiceDescription() {
let _this = this; let _this = this;
this.$u.api.getServiceDescription().then(res => { this.$u.api.getServiceDescription().then(res => {
@@ -844,6 +865,9 @@
if (userToken) { if (userToken) {
_this.goodsBrowsing(); _this.goodsBrowsing();
} }
} }
} }
}); });
@@ -1025,12 +1049,29 @@
} else { } else {
this.price = this.product.price; this.price = this.product.price;
} }
if (type == 1) { if (type === 1) {
this.openSkuPopup();
} else if (type == 2) {
this.openSkuSinglePopup(); this.openSkuSinglePopup();
} else if (type === 2) {
this.openSkuPopup();
} }
}, },
// 打开sku弹出
openSkuPopup() {
this.skuKey = true;
this.skuSingleKey = false;
},
closeSkuPopup() {
this.skuKey = false;
this.skuSingleKey = false;
},
openSkuSinglePopup() {
this.skuSingleKey = true;
this.skuKey = false;
},
closeSkuSinglePopup() {
this.skuSingleKey = false;
this.skuKey = false;
},
showModal() { showModal() {
this.bottomModal = true; this.bottomModal = true;
}, },