From a4b17864028eec15ccde9726ddae18769e2eb6a2 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Thu, 2 Jun 2022 11:36:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=20=E8=90=A5=E9=94=80?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/add/edit.js | 52 ++++++++++++++++++++++++++++-- src/pages/plan/add/step2.js | 9 ++---- src/pages/plan/knockGold/index.jsx | 10 +++--- 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/src/pages/plan/add/edit.js b/src/pages/plan/add/edit.js index 04a3aaeb..1b04a79a 100644 --- a/src/pages/plan/add/edit.js +++ b/src/pages/plan/add/edit.js @@ -119,10 +119,12 @@ export default class add extends React.Component { } if (req.keys.length > 0 && this.state.disabled == false) { this.setState({ curstep: 2 }) - + //转译 + req.keys = this.tranFormData(req) for (let i = 0; i < req.keys.length; i++) { this.addNewkey() } + setTimeout(() => { for (let i = 0; i < this.state.keys.length; i++) { console.log(req.keys[i]) @@ -155,7 +157,6 @@ export default class add extends React.Component { ) }) } else { - debugger //获取草稿信息 console.log('获取草稿信息 ==>') getDraftInfo(plan_id).then((res) => { @@ -176,10 +177,13 @@ export default class add extends React.Component { } if (req.keys.length > 0 && this.state.disabled == false) { this.setState({ curstep: 2 }) + //转译 + req.keys = this.tranFormData(req) for (let i = 0; i < req.keys.length; i++) { this.addNewkey() } + setTimeout(() => { for (let i = 0; i < this.state.keys.length; i++) { this.refs['step2-' + i].edit(req.keys[i]) @@ -196,6 +200,50 @@ export default class add extends React.Component { }) } } + + /* 转译 */ + tranFormData(req) { + req.keys.map((item) => { + item.code_batch.map((item1) => { + item1.products = [] + }) + }) + + req.keys.map((item) => { + item.code_batch.map((item1) => { + item1.product.legal.map((item2) => { + item2.only = item2.product_id + item2.type = 1 + item2.upstream = '直连天下' + item1.products.push(item2) + }) + item1.product.reduce.map((item3) => { + item3.product_name = item3.batch_goods_name //名字 + item3.channel_activity_id = item3.channel_activity_id //批次号 + item3.only = item3.channel_activity_id + item3.type = 2 //类型 + item3.upstream = item3.channel === '1' ? '支付宝' : '微信' //上游 + item3.effectDate = + item3.time_limit.effect_time.start_time + + ' 至 ' + + item3.time_limit.effect_time.end_time //有效时间 + item3.contract_price = item3.price //单价 + item3.official_price = item3.denomination //官方价 + item3.quantity = (item3.all_budget / item3.denomination).toFixed(0) //总库存 + item1.products.push(item3) + }) + }) + }) + + req.keys.map((item) => { + item.code_batch.map((item1) => { + item1.product = item1.products + delete item1.products + }) + }) + + return req.keys + } async onNextStep() { if (this.state.curstep >= 1) { if ((await this.refs.step1.submit()) == true) { diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index deb6ccb0..d349c5e1 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -315,7 +315,7 @@ export default class acclist extends React.Component { ) temp = _.map(data, (item) => { let index = this.state.tempdata.findIndex((o) => { - return o.product_id == item.product_id + return o.product_id == item.only }) if (index > -1) { @@ -345,7 +345,7 @@ export default class acclist extends React.Component { ) temp = _.map(data, (item) => { let index = this.state.tempdata.findIndex((o) => { - return o.channel_activity_id === item.channel_activity_id + return o.channel_activity_id === item.only }) if (index > -1) { @@ -386,6 +386,7 @@ export default class acclist extends React.Component { let newArray = temp.concat(this.state.tempdata) newArray = deWeightThree(newArray, 'only') this.setState({ tempdata: newArray }) + sessionStorage.setItem('knockGoldData', '') }, 500) } } @@ -688,9 +689,6 @@ export default class acclist extends React.Component { restrict: row.restrict } - /*审核中编辑 转换数据结构立减金和商品结构 */ - const newRowArray = row.product.legal.concat(row.product.reduce) - let arr = _.map(row.product, (res) => { let obj = {} obj.key = res.only @@ -709,7 +707,6 @@ export default class acclist extends React.Component { o.checked = true return o }) - sessionStorage.setItem('productData', JSON.stringify(row.product)) this.setState({ tempdata: temp, drawerVisible: true }) } diff --git a/src/pages/plan/knockGold/index.jsx b/src/pages/plan/knockGold/index.jsx index 17b055a7..cb81e748 100644 --- a/src/pages/plan/knockGold/index.jsx +++ b/src/pages/plan/knockGold/index.jsx @@ -611,7 +611,7 @@ export default class addKnockGold extends Component { unit='元' disabled={this.props?.data?.id ? true : false} countShow={false} - maxLength={16} + maxLength={14} height={'36px'} width={'231px'} alignment={'left'} @@ -631,7 +631,7 @@ export default class addKnockGold extends Component { unit='元' disabled={this.props?.data?.id ? true : false} countShow={false} - maxLength={16} + maxLength={14} height={'36px'} width={'231px'} alignment={'left'} @@ -651,7 +651,7 @@ export default class addKnockGold extends Component { kind='number' disabled={this.props?.data?.id ? true : false} labelWidth={'0px'} - maxLength={16} + maxLength={14} height={'36px'} unit='元' countShow={false} @@ -675,7 +675,7 @@ export default class addKnockGold extends Component { value={this.state.model.day_budget} placeholder={'请输入'} labelWidth={'0px'} - maxLength={16} + maxLength={14} height={'36px'} unit='元' countShow={false} @@ -699,7 +699,7 @@ export default class addKnockGold extends Component { value={this.state.model.receive_number} placeholder={'请输入'} labelWidth={'0px'} - maxLength={16} + maxLength={3} height={'36px'} unit='个' countShow={false}