区分兑换码编辑、新增、复制代码

This commit is contained in:
Wind-58 2022-09-01 11:21:04 +08:00
parent 72b4dae442
commit bcd82a9b16
3 changed files with 20 additions and 12 deletions

View File

@ -285,12 +285,13 @@ export default class exchangeAdd extends React.Component {
// //
this.getResellerFunction(reqCopy.plan.reseller_id) this.getResellerFunction(reqCopy.plan.reseller_id)
this.setState({ codeInfo: codeInfo }) this.setState({ codeInfo: codeInfo, isload: true })
this.setState({ isload: true })
_.map(reqCopy.goods, (res) => { _.map(reqCopy.goods, (res) => {
res.checked = true res.checked = true
return res return res
}) })
this.setState({ tempdata: reqCopy.goods || [] }) this.setState({ tempdata: reqCopy.goods || [] })
let a1 = reqCopy.goods.map((item) => { let a1 = reqCopy.goods.map((item) => {
@ -339,9 +340,9 @@ export default class exchangeAdd extends React.Component {
} }
} }
/* 审核中转换数据 */
transFormData1(req, type) { transFormData1(req, type) {
const newData = [] const newData = []
/* 转换数据结构 */
req.legal.map((item1) => { req.legal.map((item1) => {
item1.type = 1 item1.type = 1
item1.only = item1.product_id item1.only = item1.product_id
@ -362,6 +363,7 @@ export default class exchangeAdd extends React.Component {
obj.id = item1?.goods_id obj.id = item1?.goods_id
} }
obj.product_id = item1?.goods_id obj.product_id = item1?.goods_id
obj.code_batch_id = item1?.code_batch_id
obj.product_type_text = "立减金" obj.product_type_text = "立减金"
obj.contract_price = item1.price obj.contract_price = item1.price
obj.create_time = item1.create_time obj.create_time = item1.create_time
@ -392,12 +394,13 @@ export default class exchangeAdd extends React.Component {
return newData return newData
} }
/* 转换数据 */ /* 无审核转换数据 */
transFormData(reqCopy) { transFormData(reqCopy) {
const resData = [] const resData = []
reqCopy.goods.map((item) => { reqCopy.goods.map((item) => {
/* type 1为商品 2为立减金 转译字符方便处理 */ /* type 1为商品 2为立减金 转译字符方便处理 */
/* 此处only 商品为product_id 立减金为channel_activity_id */ /* 此处only 商品为product_id 立减金为channel_activity_id */
if (this.state.isState === 1) delete item.entity.id /* 复制时删除id */
if (item.type === 1) { if (item.type === 1) {
item.entity.upstream = "直连天下" item.entity.upstream = "直连天下"
item.entity.only = item.entity.product_id item.entity.only = item.entity.product_id
@ -407,6 +410,7 @@ export default class exchangeAdd extends React.Component {
resData.push(item.entity) resData.push(item.entity)
} else if (item.type === 2) { } else if (item.type === 2) {
item.entity.weight = item.weight item.entity.weight = item.weight
item.entity.code_batch_id = item.code_batch_id
resData.push({ resData.push({
origin: item.entity, origin: item.entity,
type: item.type, type: item.type,
@ -646,7 +650,7 @@ export default class exchangeAdd extends React.Component {
/* 复制\新增状态下数据提交 */ /* 复制\新增状态下数据提交 */
submitCopyOrAddCodeData() { submitCopyOrAddCodeData() {
let data = this.copyOrAddBuildData() let data = this.copyOrAddBuildData()
let id = sessionStorage.getItem("keybatch_id") let id = sessionStorage.getItem("keyBatch_id")
keyEditApproval(id, data).then((res) => { keyEditApproval(id, data).then((res) => {
handelResponse( handelResponse(
@ -1108,7 +1112,11 @@ export default class exchangeAdd extends React.Component {
prop='keyBatchSelect' prop='keyBatchSelect'
id='keyBatchSelect'> id='keyBatchSelect'>
<Select <Select
onChange={(e) => this.handleChange(e, "keyBatchSelect")} onChange={(e) => {
this.handleChange(e, "keyBatchSelect")
/* 新增时保存key批次 */
sessionStorage.setItem("keyBatch_id", e?.id)
}}
clearable clearable
value={this.state.codeInfo.keyBatchSelect} value={this.state.codeInfo.keyBatchSelect}
options={this.state.keyBatchSelectData} options={this.state.keyBatchSelectData}

View File

@ -161,8 +161,8 @@ export const init = () => {
tableLoading: false, tableLoading: false,
newGoldLoading: false, newGoldLoading: false,
addIsType: "", addIsType: "",
isState: 0, isState: 0 /* 0:新增 1:复制 2:编辑 */,
planSelectData: [] /* 营销计划数据 */, planSelectData: [] /* 归属计划数据 */,
keyBatchSelectData: [] /* 营销计划ID */ keyBatchSelectData: [] /* 归属key数据 */
} }
} }

View File

@ -172,12 +172,12 @@ export default class acclist extends React.Component {
"knockGold_effectDate", "knockGold_effectDate",
JSON.stringify(param.keyBatch.plan) JSON.stringify(param.keyBatch.plan)
) )
sessionStorage.setItem("keybatch_id", param.key_batch_id) /* 复制兑换码的key批次Id */
sessionStorage.setItem("key_reseller_id", param.keyBatch.plan.reseller_id) sessionStorage.setItem("keyBatch_id", param.key_batch_id)
sessionStorage.setItem("approval_id", param.keyBatch.approval_id)
} else if (type === 2) { } else if (type === 2) {
activerou[0].pagetitle = "编辑" activerou[0].pagetitle = "编辑"
activerou[0].items[1].name = `编辑:${param.title}兑换码的商品范围列表` activerou[0].items[1].name = `编辑:${param.title}兑换码的商品范围列表`
sessionStorage.setItem("approval_id", param.keyBatch.approval_id)
sessionStorage.setItem("approval_status", param.status) sessionStorage.setItem("approval_status", param.status)
} }