对接 营销计划编辑
This commit is contained in:
parent
9bbb42ce07
commit
a4b1786402
|
@ -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) {
|
||||
|
|
|
@ -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 })
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue