Commit b315613e by 修福龙

实现无码商品的功能

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