fix(系统模板):修复【系统营销模板】兑换码、白名单、优惠券、优惠券白名单保存,前端传值有误

This commit is contained in:
Apple 2022-10-12 15:51:21 +08:00
parent e3c81251f9
commit ffe2bee7e0
1 changed files with 19 additions and 29 deletions

View File

@ -24,6 +24,12 @@ import CouponGoodsDetailForm from './couponCard/couponDetailconfig'; //优惠券
import CouponReduceDetailForm from './couponCard/couponReduceDetail'; //优惠券立减金详情页
import CouponComLib from './couponCard/goodsPage/componentLib/main'; //优惠券组件库
import CouponGoodsListForm from './couponCard/goodsPage/config/main'; //优惠券商品列表页
let typeList={//1 白名单 3 兑换码 4优惠券 8 优惠券白名单
'1':'whiteList',
'3':'exchange',
'4':'coupon',
'8':'coupon',
}
//落地页
let model = {
title: '落地页标题',
@ -274,25 +280,11 @@ export default class edittemplate extends React.Component {
newEditor.exchangeList = exchangeList
newEditor.whiteList = whiteList
newEditor.coupon = coupon;
if (template == 1) { //1-白名单 3-兑换码
this.setState({
model: newEditor.whiteList.land,
product_list: newEditor.whiteList.product_list,
product_detail: newEditor.whiteList.product_detail
})
} else if (template == 3) {
this.setState({
model: newEditor.exchangeList.land,
product_list: newEditor.exchangeList.product_list,
product_detail: newEditor.exchangeList.product_detail
})
} else {
this.setState({
model: newEditor.coupon.land,
product_list: newEditor.coupon.product_list,
product_detail: newEditor.coupon.product_detail
})
}
this.setState({//编辑回显
model: newEditor[typeList[template]].land,
product_list: newEditor[typeList[template]].product_list,
product_detail: newEditor[typeList[template]].product_detail
})
sessionStorage.setItem('editorConfig', JSON.stringify(newEditor))
if (mouldType != 0 && pageChange == 1) {
this.setState({ pagedisable: true })
@ -323,10 +315,9 @@ export default class edittemplate extends React.Component {
let self = this
let mouldType = sessionStorage.getItem('mouldType')
let myInfoData = JSON.parse(sessionStorage.getItem('pageInfo'))//判断是否有数据
let editorList = JSON.parse(sessionStorage.getItem('editorConfig'))
let addSystemData = _.cloneDeep(editorList)
let infoWhite = addSystemData.whiteList
let infoCoupon = addSystemData.coupon//优惠券
let addSystemData = _.cloneDeep(JSON.parse(sessionStorage.getItem('editorConfig')))
let infoWhite = _.omit(addSystemData.whiteList,['land[sort]','land[title]','land[type_id]','land[thumb]'])
let infoCoupon = _.omit(addSystemData.coupon,['land[sort]','land[title]',,'land[thumb]'])//优惠券
if (!this.state.model.top_image) {
Notify.clear()
Notify.error('请上传落地页顶部banner')
@ -355,16 +346,15 @@ export default class edittemplate extends React.Component {
return
}
this.setState({ loading_visible: true, activeNavStatus: 1 })
let thumbresult = null
if (mouldType == 0) {
//系统模板
this.setState({ activeNavStatus: 1 })
if (this.state.showType != 3) {
let exchangeFlag = await this.onmodelChange({ target: { value: 3 } })
this.onmodelChange({ target: { value: 3 } })
}
}
this.canvasImg.style.display = 'block'
thumbresult = await this.canvasImgFn()
let thumbresult = await this.canvasImgFn()
let formdata = {
title: exchangeStateData.model.title,
page: exchangeStateData.showType,
@ -373,16 +363,16 @@ export default class edittemplate extends React.Component {
}
if (mouldType == 0) {
//系统模板新增
formdata.sort = exchangeStateData.model.sort;
formdata.sort = exchangeStateData.model.sort;//权重
formdata.type_id = exchangeStateData.model.type_id.key;
let infoExchange = {}
infoExchange.land = exchangeStateData.model
infoExchange.product_list = exchangeStateData.product_list
infoExchange.product_detail = exchangeStateData.product_detail
formdata.exchange = infoExchange
formdata.exchange = _.omit(infoExchange,['land[sort]','land[title]','thumb'])//优惠券
formdata.access_conf = infoWhite
formdata.coupon = infoCoupon
console.log(387,exchangeStateData);
console.log(387,formdata);
if (myInfoData) {
//编辑
putSystemTemplate(myInfoData.id, formdata).then((res) => {