Commit c25de083 by zeven

修复无码商品无法扫码支付

parent ed07bc6e
......@@ -125,23 +125,16 @@ const CounterMixins = ComposeComponent => {
let totalCount = this.totalCount;
if (type === 'waiting') {
// 客户端等待,响应购物车列表
const {goodsArr} = this.state;
const goods = {};
this.token = token;
goodsArr.map(({barcode, num}) => {
if (!goods[barcode]) {
goods[barcode] = num;
} else {
goods[barcode] += num;
}
});
const {ids, noBarcode} = this.getGoods();
window.socket.emit(
'counterGoods',
sid,
JSON.stringify(goods),
JSON.stringify(ids),
totalPrice,
totalCount,
payType,
JSON.stringify(noBarcode),
);
} else if (type === 'fail') {
// 下单失败
......@@ -474,18 +467,7 @@ const CounterMixins = ComposeComponent => {
}
};
// 付款码支付
barcodepay = async (code, facepay) => {
if (this.barcodeBusy) {
return true;
}
const isWxpay = code.toString().match(/1[0-5]\d{16}/);
const isAlipay = code.toString().match(/^(2[5-9]|30)\d{14,22}$/);
if (!isWxpay && !isAlipay) {
return false;
}
this.barcodeBusy = true;
let successPay = false;
getGoods = () => {
const {goodsArr} = this.state;
const ids = {};
const noBarcode = [];
......@@ -508,6 +490,22 @@ const CounterMixins = ComposeComponent => {
});
}
});
return {ids, noBarcode};
};
// 付款码支付
barcodepay = async (code, facepay) => {
if (this.barcodeBusy) {
return true;
}
const isWxpay = code.toString().match(/1[0-5]\d{16}/);
const isAlipay = code.toString().match(/^(2[5-9]|30)\d{14,22}$/);
if (!isWxpay && !isAlipay) {
return false;
}
this.barcodeBusy = true;
let successPay = false;
const {ids, noBarcode} = this.getGoods();
const res = await this.props.dispatch({
type: 'goods/barcodepay',
ids,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment