Commit b315613e by 修福龙

实现无码商品的功能

parent 556cb926
......@@ -458,7 +458,7 @@ const CounterMixins = ComposeComponent => {
name: '无码商品',
unit: 1,
num: 1,
price: NP.round(price, 2).toFixed(2),
// price: NP.round(price, 2).toFixed(2),
prePrice: NP.round(price, 2).toFixed(2),
numChange: false,
};
......@@ -488,11 +488,24 @@ const CounterMixins = ComposeComponent => {
let successPay = false;
const {goodsArr} = this.state;
const ids = {};
goodsArr.map(({barcode, num}) => {
if (!ids[barcode]) {
ids[barcode] = num;
const noBarcode = [];
goodsArr.map(({barcode, num, prePrice, name}) => {
if (barcode !== '000000') {
//非无码商品
if (!ids[barcode]) {
ids[barcode] = num;
} else {
ids[barcode] += num;
}
} else {
ids[barcode] += num;
noBarcode.push({
name,
barcode,
price: 0,
purPrice: 0,
prePrice,
num,
});
}
});
const res = await this.props.dispatch({
......@@ -500,6 +513,7 @@ const CounterMixins = ComposeComponent => {
ids,
code,
facepay,
noBarcode,
});
if (res.code !== 1) {
await this.setState({voiceModal: true, voiceTitle: res.msg});
......
......@@ -9,10 +9,10 @@ export function getBags() {
return axios.get('/store/goods/bags');
}
export function barcodepay({ids, code, facepay}) {
export function barcodepay({ids, code, facepay, noBarcode}) {
return axios.post(
'/store/goods/barcodepay',
qs.stringify({ids, code, facepay}),
qs.stringify({ids, code, facepay, noBarcode}),
);
}
......
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