diff --git a/src/assets/enum.js b/src/assets/enum.js index f239951d..37faec91 100644 --- a/src/assets/enum.js +++ b/src/assets/enum.js @@ -100,6 +100,8 @@ const menu={ case 3:return '兑换码';break; case 1:return '白名单';break; case 2:return '立减金';break; + case 4:return '优惠券';break; + case 8:return '优惠券白名单';break; } }, pageTypeStatusBg(params) { @@ -107,6 +109,8 @@ const menu={ case 1:return '#ffaa00';break; case 2:return '#e64c00';break; case 3:return '#55aaff';break; + case 4:return '#79AF83';break; + case 8:return '#F2A505';break; } }, keysStatus(params) { diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js index 579bce0a..6373852b 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js @@ -18,8 +18,8 @@ export default class edittemplate extends React.Component { componentWillMount(e) { let config = JSON.parse(sessionStorage.getItem('editorConfig')); - if (config && config.couponList && config.couponList.product_list) { - let { bgimg } = config.couponList.product_list.backgroundImg; + if (config && config.coupon && config.coupon.product_list) { + let { bgimg } = config.coupon.product_list.backgroundImg; this.setState({ bgimg }); } } @@ -102,9 +102,9 @@ export default class edittemplate extends React.Component { componentWillUnmount() { let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); - let couponList = oldobj.couponList; - couponList.product_list.backgroundImg = _.cloneDeep(this.state); - oldobj.couponList = couponList; + let coupon = oldobj.coupon; + coupon.product_list.backgroundImg = _.cloneDeep(this.state); + oldobj.coupon = coupon; sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); } render() { diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/bottomBar.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/bottomBar.js index 8a719ce9..49b16364 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/bottomBar.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/bottomBar.js @@ -13,7 +13,7 @@ export default class edittemplate extends React.Component { constructor(props) { super(props) this.state = { - iswitch:false, + iswitch:true, comType:1, navlist:[ { @@ -53,9 +53,14 @@ export default class edittemplate extends React.Component { } } componentWillMount(e) { + Bus.addListener('componentLibClose', (prop) => { + if(prop=='bottomBar'){ + this.setState({iswitch:false}) + } + }) let config = JSON.parse(sessionStorage.getItem('editorConfig')); - if (config && config.couponList && config.couponList.product_list) { - let { navlist, defaultText, selectText, background,iswitch } = config.couponList.product_list.bottomBar; + if (config && config.coupon && config.coupon.product_list) { + let { navlist, defaultText, selectText, background,iswitch } = config.coupon.product_list.bottomBar; this.setState({ navlist, defaultText, selectText, background,iswitch }); } } @@ -169,9 +174,9 @@ export default class edittemplate extends React.Component { }; componentWillUnmount() { let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); - let couponList = oldobj.couponList; - couponList.product_list.bottomBar = _.cloneDeep(this.state); - oldobj.couponList = couponList; + let coupon = oldobj.coupon; + coupon.product_list.bottomBar = _.cloneDeep(this.state); + oldobj.coupon = coupon; sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); } render() { diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/main.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/main.js index 2f9060ad..1e6f5e26 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/main.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/main.js @@ -25,8 +25,8 @@ export default class edittemplate extends React.Component { } componentWillMount(e) { let config = JSON.parse(sessionStorage.getItem('editorConfig')); - if (config && config.couponList && config.couponList.product_list) { - this.setState({ model: config.couponList.product_list }); + if (config && config.coupon && config.coupon.product_list) { + this.setState({ model: config.coupon.product_list }); } } onListChange(e) { @@ -187,15 +187,15 @@ export default class edittemplate extends React.Component { }; componentWillUnmount() { let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); - if (oldobj && oldobj.couponList) { - let couponList = oldobj.couponList - couponList.product_list = this.state.model; - oldobj.couponList = couponList; + if (oldobj && oldobj.coupon) { + let coupon = oldobj.coupon + coupon.product_list = this.state.model; + oldobj.coupon = coupon; } else { oldobj = {} - let couponList = {} - couponList.product_list = this.state.model; - oldobj.couponList = couponList; + let coupon = {} + coupon.product_list = this.state.model; + oldobj.coupon = coupon; } sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); } diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/picture.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/picture.js index 577b8dee..bd8587e6 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/picture.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/picture.js @@ -11,19 +11,22 @@ export default class edittemplate extends React.Component { constructor(props) { super(props) this.state = { - iswitch:false, + iswitch:true, img:'', jumpType:'0',//0不跳转 1跳转 jumpUrl:'' } } componentWillMount(e) { - + Bus.addListener('componentLibClose', (prop) => { + if(prop=='picture'){ + this.setState({iswitch:false}) + } + }) let config = JSON.parse(sessionStorage.getItem('editorConfig')); - if (config && config.couponList && config.couponList.product_list) { - let {img,jumpType,jumpUrl,iswitch}=config.couponList.product_list.picture; - console.log(21,config.couponList.product_list.picture); - this.setState({ img,jumpType,jumpUrl,iswitch}); + if (config && config.coupon && config.coupon.product_list) { + let {img,jumpType,jumpUrl}=config.coupon.product_list.picture; + this.setState({ img,jumpType,jumpUrl}); } } @@ -97,13 +100,14 @@ export default class edittemplate extends React.Component { }; componentWillUnmount() { let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); - let couponList = oldobj.couponList; - couponList.product_list.picture = _.cloneDeep(this.state); - oldobj.couponList = couponList; + let coupon = oldobj.coupon; + console.log(105,this.state); + coupon.product_list.picture = _.cloneDeep(this.state); + oldobj.coupon = coupon; sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); } render() { - console.log(105,this.state); + return (
¥0.00
diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index 81dce7a8..af7d6b4f 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -25,7 +25,6 @@ import CouponGoodsListForm from '../couponTemplate/goodsPage/config/main' //优 import CouponGoodsDetailForm from './couponconfig' //优惠券商品详情页 import CouponReduceDetailForm from './couponReduceDetail' //优惠券立减金详情页 import CouponComLib from '../couponTemplate/goodsPage/componentLib/main' //优惠券组件库 -// import import _ from 'lodash' //落地页 let model = { @@ -332,37 +331,45 @@ export default class edittemplate extends React.Component { whiteList['land'].title = newEditor.title whiteList['land'].sort = newEditor.sort //优惠券 - let couponList = newEditor.couponList - if (!couponList) { - couponList = {} - couponList.land = model - couponList.product_list = couponProduct_list - couponList.product_detail = product_detail + let coupon = newEditor.coupon + if (!coupon) { + coupon = {} + coupon.land = model + coupon.product_list = couponProduct_list + coupon.product_detail = product_detail } - couponList['land'].title = newEditor.title - couponList['land'].sort = newEditor.sort - newEditor.exchangeList = exchangeList - newEditor.whiteList = whiteList - newEditor.couponList = couponList; - if (template == 1) { //1-白名单 2-兑换码 + coupon['land'].title = newEditor.title + coupon['land'].sort = newEditor.sort + + 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 { + } 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 + }) } sessionStorage.setItem('editorConfig', JSON.stringify(newEditor)) if (mouldType != 0 && pageChange == 1) { this.setState({ pagedisable: true }) } } else {//新增数据 - let obj = {}, whiteList = {}, exchangeList = {}, couponList = {} + console.log(369,sessionStorage.getItem('editorConfig')); + let obj = {}, whiteList = {}, exchangeList = {}, coupon = {} let sourceObj = {//模板数据结构 land: model, product_list, @@ -375,10 +382,10 @@ export default class edittemplate extends React.Component { } whiteList = _.cloneDeep(sourceObj); exchangeList = _.cloneDeep(sourceObj); - couponList = _.cloneDeep(sourcecouponObj); + coupon = _.cloneDeep(sourcecouponObj); obj.exchangeList = exchangeList obj.whiteList = whiteList - obj.couponList = couponList + obj.coupon = coupon sessionStorage.setItem('editorConfig', JSON.stringify(obj)) } } @@ -488,11 +495,21 @@ export default class edittemplate extends React.Component { infoExchange.product_detail = exchangeState.product_detail delete infoExchange.land.sort delete infoExchange.land.title - if (this.state.showType == 3) { - //兑换码 - formdata.exchange = infoExchange - } else if (this.state.showType == 1) { - formdata.access_conf = infoExchange + switch(this.state.showType){ + case 3://兑换码 + formdata.exchange = infoExchange; + break; + case 1://白名单 + formdata.access_conf = infoExchange + break; + case 4://优惠券 + formdata.coupon = infoExchange; + break; + case 8://优惠券白名单 + formdata.coupon = infoExchange; + break; + default: + break; } if (myInfoData) { //编辑 @@ -638,7 +655,7 @@ export default class edittemplate extends React.Component { } onmodelChange(e) { this.setState({ showType: e.target.value, activeNavStatus: 1 }) - let editorData = JSON.parse(sessionStorage.getItem('editorConfig')) + let editorData = _.cloneDeep(JSON.parse(sessionStorage.getItem('editorConfig'))) if (e.target.value == 1) { let whiteData = editorData.whiteList let { land, product_list, product_detail } = whiteData; @@ -652,9 +669,10 @@ export default class edittemplate extends React.Component { let exchangeData = editorData.exchangeList let { land, product_list, product_detail } = exchangeData; this.setState({ model: land, product_list, product_detail }) - } else if (e.target.value == 2) { - let couponData = editorData.couponList + } else{//优惠券+优惠券白名单 + let couponData = editorData.coupon let { land, product_list, product_detail } = couponData; + console.log(222,this.state.model); this.setState({ model: land, product_list, product_detail }) } } @@ -800,7 +818,7 @@ export default class edittemplate extends React.Component { this.setState({ componentOfconfig: c }); } render() { - console.log(761,window.screen.width / 1920 * 100); + console.log(761,this.state); return (¥0.00