修复bug

This commit is contained in:
wangsongsole 2022-06-17 11:58:20 +08:00
parent a9ff8e1171
commit 4119501a49
1 changed files with 33 additions and 22 deletions

View File

@ -177,23 +177,39 @@ export default class acclist extends React.Component {
getApprovalsInfo(approval_id).then((res) => {
handelResponse(res, (req, msg) => {
/*当为创建中和审核驳回时 转换数据结构 */
const newProduct = []
req.code_batch.map((item) => {
item.product.legal.map((item1) => {
item1.type = 1
item1.only = item1.product_id
item1.upstream = '直连天下'
newProduct.push({
type: 1,
only: item1.product_id,
upstream: '直连天下',
...item1
})
})
item.product.reduce.map((item1) => {
item1.type = 2
item1.only = item1.channel_activity_id
item1.upstream =
String(item.channel) === '1' ? '支付宝' : '微信' //上游
item1.origin = item1
newProduct.push({
type: 2,
only: item1.channel_activity_id,
upstream:
String(item.channel) === '1' ? '支付宝' : '微信',
origin: item1,
product_name: item1.batch_goods_name,
effectDate:
item1.time_limit?.effect_time.start_time +
' 至 ' +
item1.time_limit?.effect_time.end_time, //有效时间
contract_price: item1.price, //单价
official_price: item1.reduce_amount, //官方价
quantity: Math.trunc(
item1.all_budget / item1.reduce_amount
), //总库
...item1
})
})
item.product = [
...item.product.legal,
...item.product.reduce
]
item.product = [...newProduct]
})
for (let i = 0; i < req.code_batch.length; i++) {
@ -201,12 +217,7 @@ export default class acclist extends React.Component {
let range = []
for (let j = 0; j < code_batch.product.length; j++) {
let product = code_batch.product[j]
/* 区分立减金和商品 */
if (product.type === 1) {
range.push(product.product_name)
} else {
range.push(product.batch_goods_name)
}
range.push(product.product_name)
}
req.code_batch[i].disabled = false
req.code_batch[i].checked = false
@ -420,7 +431,7 @@ export default class acclist extends React.Component {
/* 处理商品 */
if (this.state.addIsType === 'addProduct') {
data = JSON.parse(sessionStorage.getItem('productData')).filter(
(item) => item.type !== 2
(item) => item.type != 2
)
concatData = this.state.tempdata.filter((item) => item.type !== 1)
temp = _.map(data, (item) => {
@ -431,6 +442,7 @@ export default class acclist extends React.Component {
if (index > -1) {
item.checked = this.state.tempdata[index].checked
}
item.type = 1
item.only = item.product_id
item.upstream = '直连天下'
@ -439,7 +451,7 @@ export default class acclist extends React.Component {
} else {
/* 处理立减金 */
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
(item) => item.type !== 1
(item) => item.type != 1
)
concatData = this.state.tempdata.filter((item) => item.type !== 2)
temp = _.map(data, (item) => {
@ -675,7 +687,7 @@ export default class acclist extends React.Component {
dataCopy.map((item) =>
item.products.map(() => {
item.product = {
legal: item.products.filter((item2) => item2.type === 1),
legal: item.products.filter((item2) => item2.type == 1),
reduce: item.products
.filter((item3) => item3.type === 2)
.map((item4) => item4.origin)
@ -1034,7 +1046,6 @@ export default class acclist extends React.Component {
o.checked = true
return o
})
sessionStorage.setItem('productData', JSON.stringify(row.product))
sessionStorage.setItem('knockGoldData', JSON.stringify(row.product))
this.setState({ tempdata: temp, drawerVisible: true })