diff --git a/src/pages/exchangecode/edit/edit.js b/src/pages/exchangecode/edit/edit.js index da0f82d7..3e6489e0 100644 --- a/src/pages/exchangecode/edit/edit.js +++ b/src/pages/exchangecode/edit/edit.js @@ -38,7 +38,7 @@ import { putCodes, putCodesBatch } from '../../../assets/api.js' -import _ from 'lodash' +import _, { isArray } from 'lodash' import Productform from '../product/add' import KnockGold from '../../plan/knockGold/' /* 立减金 */ @@ -619,7 +619,7 @@ export default class exchangedit extends React.Component { data = JSON.parse(sessionStorage.getItem('knockGoldData')) temp = _.map(data, (item) => { let index = this.state.tempdata.findIndex((o) => { - return o.product_id === item.uuid + return o.batch_number === item.batch_number }) if (index > -1) { @@ -629,15 +629,14 @@ export default class exchangedit extends React.Component { /* 转换商品结构 */ // temp return { - product_id: item.uuid, product_name: item.batch_goods_name, //名字 - cost_price: '', + batch_number: item.batch_number, //批次号 + type: 'knockGold', //类型 + upstream: item.channel === '1' ? '支付宝' : '微信', //上游 + effectDate: item.entry_time[0] + '至' + item.entry_time[1], //有效时间 contract_price: item.contract_price, //单价 official_price: item.denomination, //官方价 quantity: (item.all_budget / item.denomination).toFixed(0), //总库存 - stock: '', - usage: '', - type: 'knockGold', edit: 'edit' } }) @@ -646,7 +645,7 @@ export default class exchangedit extends React.Component { let arr = [] _.map(temp.concat(this.state.tempdata), (res) => { let obj = {} - obj.key = res.product_id + obj.key = res.batch_number obj.text = res.product_name arr.push(obj) return obj @@ -655,7 +654,7 @@ export default class exchangedit extends React.Component { this.setState({ rankoptions: arr }) } let newArray = temp.concat(this.state.tempdata) - newArray = deWeightThree(newArray, 'product_id') + newArray = deWeightThree(newArray, 'batch_number') this.setState({ tempdata: newArray }) }, 500) } @@ -872,7 +871,7 @@ export default class exchangedit extends React.Component { if (rowData.type === 'knockGold') { const temp = JSON.parse(sessionStorage.getItem('knockGoldData')) const editData = temp.filter( - (item) => item.uuid === rowData.product_id + (item) => item.batch_number === rowData.batch_number ) this.setState({ @@ -920,6 +919,13 @@ export default class exchangedit extends React.Component { width: 'auto', type: 'normal' }, + { + title: '立减金平台批次号', + width: '200px', + prop: 'batch_number', + name: 'batch_number', + type: 'normal' + }, { title: '商品名称', width: 'auto', @@ -927,6 +933,28 @@ export default class exchangedit extends React.Component { name: 'product_name', type: 'slot' }, + { + title: '类型', + width: 'auto', + prop: 'type', + name: 'type', + type: 'slot' + }, + { + title: '上游平台', + width: 'auto', + prop: 'upstream', + name: 'upstream', + type: 'normal' + }, + { + title: '有效时间段', + width: '250px', + prop: 'effectDate', + name: 'effectDate', + type: 'normal' + }, + { title: '当前成本价格', prop: 'cost_price', @@ -935,7 +963,7 @@ export default class exchangedit extends React.Component { type: 'normal' }, { - title: '合同价', + title: '合同单价', name: 'contract_price', prop: 'contract_price', type: 'slot', @@ -1163,6 +1191,13 @@ export default class exchangedit extends React.Component { /> ) } + if (com == 'type') { + return ( + <> + {rowData.type === 'knockGold' ? '立减金' : '商品'} + + ) + } if (com == 'quantity') { return (