This commit is contained in:
zpc 2026-03-14 15:43:23 +08:00
parent 4db5042b20
commit fc7ad732bf
2 changed files with 9 additions and 0 deletions

View File

@ -314,6 +314,7 @@ export default {
this.$c.msg('请先同意用户协议'); this.$c.msg('请先同意用户协议');
return; return;
} }
console.log(`[商城订单] confirmPay: zhifu=${this.zhifu} price=${this.goodsInfo.price} score=${this.orderData?.score}`);
if (this.zhifu == 0) { if (this.zhifu == 0) {
await this.payByWechat(); await this.payByWechat();
} else { } else {
@ -331,11 +332,14 @@ export default {
coupon_id: '', coupon_id: '',
use_money2_is: 2 use_money2_is: 2
}; };
console.log(`[商城订单] payByWechat 请求参数:`, JSON.stringify(data));
const res = await createOrder(data); const res = await createOrder(data);
console.log(`[商城订单] payByWechat 响应: status=${res.status} msg=${res.msg} data.status=${res.data?.status}`);
if (res.status == 1) { if (res.status == 1) {
this.$refs.orderPop.close(); this.$refs.orderPop.close();
if (res.data.status == 1) { if (res.data.status == 1) {
const status = await this.$platform.pay({ data: res.data.res }, this); const status = await this.$platform.pay({ data: res.data.res }, this);
console.log(`[商城订单] 微信支付结果: ${status}`);
if (status == 'success') { if (status == 'success') {
this.$c.msg('购买成功'); this.$c.msg('购买成功');
this.loadDetail(); this.loadDetail();
@ -348,6 +352,7 @@ export default {
async payByCurrency() { async payByCurrency() {
const pri = this.goodsInfo.price * 100; const pri = this.goodsInfo.price * 100;
console.log(`[商城订单] payByCurrency: price=${this.goodsInfo.price} 需要=${pri} 剩余score=${this.orderData.score}`);
if ((this.orderData.score || 0) < pri) { if ((this.orderData.score || 0) < pri) {
this.$c.msg(this.$config.getAppSetting('currency2_name') + '不足'); this.$c.msg(this.$config.getAppSetting('currency2_name') + '不足');
return; return;
@ -357,12 +362,15 @@ export default {
const remainStock = this.goodsInfo.goodslist_surplus_stock != null const remainStock = this.goodsInfo.goodslist_surplus_stock != null
? this.goodsInfo.goodslist_surplus_stock ? this.goodsInfo.goodslist_surplus_stock
: (this.goodsInfo.stock || 0) - (this.goodsInfo.sale_stock || 0); : (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) { if (remainStock <= 0) {
this.$c.msg('库存不足,兑换失败'); this.$c.msg('库存不足,兑换失败');
return; return;
} }
console.log(`[商城订单] createMallOrder 请求: goods_id=${this.goodsId}`);
const res = await createMallOrder({ goods_id: this.goodsId, prize_num: 1 }); 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) { if (res.status == 1) {
this.$refs.orderPop.close(); this.$refs.orderPop.close();
if (res.data.status == 1) { if (res.data.status == 1) {

View File

@ -851,6 +851,7 @@ public class OrderService : IOrderService
Price = goods.Price.ToString("0.##"), Price = goods.Price.ToString("0.##"),
Stock = goods.Stock, Stock = goods.Stock,
SaleStock = goods.SaleStock, SaleStock = goods.SaleStock,
SurplusStock = itemsStockSummary?.SurplusStock ?? (goods.Stock - goods.SaleStock),
GoodslistStock = itemsStockSummary?.TotalStock ?? 0, GoodslistStock = itemsStockSummary?.TotalStock ?? 0,
GoodslistSurplusStock = itemsStockSummary?.SurplusStock ?? 0, GoodslistSurplusStock = itemsStockSummary?.SurplusStock ?? 0,
Type = goods.Type, Type = goods.Type,