21
This commit is contained in:
parent
4db5042b20
commit
fc7ad732bf
|
|
@ -314,6 +314,7 @@ export default {
|
|||
this.$c.msg('请先同意用户协议');
|
||||
return;
|
||||
}
|
||||
console.log(`[商城订单] confirmPay: zhifu=${this.zhifu} price=${this.goodsInfo.price} score=${this.orderData?.score}`);
|
||||
if (this.zhifu == 0) {
|
||||
await this.payByWechat();
|
||||
} else {
|
||||
|
|
@ -331,11 +332,14 @@ export default {
|
|||
coupon_id: '',
|
||||
use_money2_is: 2
|
||||
};
|
||||
console.log(`[商城订单] payByWechat 请求参数:`, JSON.stringify(data));
|
||||
const res = await createOrder(data);
|
||||
console.log(`[商城订单] payByWechat 响应: status=${res.status} msg=${res.msg} data.status=${res.data?.status}`);
|
||||
if (res.status == 1) {
|
||||
this.$refs.orderPop.close();
|
||||
if (res.data.status == 1) {
|
||||
const status = await this.$platform.pay({ data: res.data.res }, this);
|
||||
console.log(`[商城订单] 微信支付结果: ${status}`);
|
||||
if (status == 'success') {
|
||||
this.$c.msg('购买成功');
|
||||
this.loadDetail();
|
||||
|
|
@ -348,6 +352,7 @@ export default {
|
|||
|
||||
async payByCurrency() {
|
||||
const pri = this.goodsInfo.price * 100;
|
||||
console.log(`[商城订单] payByCurrency: price=${this.goodsInfo.price} 需要=${pri} 剩余score=${this.orderData.score}`);
|
||||
if ((this.orderData.score || 0) < pri) {
|
||||
this.$c.msg(this.$config.getAppSetting('currency2_name') + '不足');
|
||||
return;
|
||||
|
|
@ -357,12 +362,15 @@ export default {
|
|||
const remainStock = this.goodsInfo.goodslist_surplus_stock != null
|
||||
? this.goodsInfo.goodslist_surplus_stock
|
||||
: (this.goodsInfo.stock || 0) - (this.goodsInfo.sale_stock || 0);
|
||||
console.log(`[商城订单] payByCurrency 库存校验: goodslist_surplus_stock=${this.goodsInfo.goodslist_surplus_stock} remainStock=${remainStock}`);
|
||||
if (remainStock <= 0) {
|
||||
this.$c.msg('库存不足,兑换失败');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`[商城订单] createMallOrder 请求: goods_id=${this.goodsId}`);
|
||||
const res = await createMallOrder({ goods_id: this.goodsId, prize_num: 1 });
|
||||
console.log(`[商城订单] createMallOrder 响应: status=${res.status} msg=${res.msg} data.status=${res.data?.status}`);
|
||||
if (res.status == 1) {
|
||||
this.$refs.orderPop.close();
|
||||
if (res.data.status == 1) {
|
||||
|
|
|
|||
|
|
@ -851,6 +851,7 @@ public class OrderService : IOrderService
|
|||
Price = goods.Price.ToString("0.##"),
|
||||
Stock = goods.Stock,
|
||||
SaleStock = goods.SaleStock,
|
||||
SurplusStock = itemsStockSummary?.SurplusStock ?? (goods.Stock - goods.SaleStock),
|
||||
GoodslistStock = itemsStockSummary?.TotalStock ?? 0,
|
||||
GoodslistSurplusStock = itemsStockSummary?.SurplusStock ?? 0,
|
||||
Type = goods.Type,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user