1、修正立减金组件 金额长度限制和验证
2、修正新建营销计划bug 3、修正编辑营销计划草稿bug 4、修正新建key的bug 5、修正编辑key的bug 6、修正编辑兑换码中的bug
This commit is contained in:
parent
b2e299cb5e
commit
cd13f1486d
|
@ -410,6 +410,14 @@ export default class addKnockGold extends Component {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!/^[0-9]*$/.test(this.state.model.denomination) ||
|
||||||
|
!/^[0-9]*$/.test(this.state.model.reduce_amount)
|
||||||
|
) {
|
||||||
|
Notify.error('请输入正确的面额金额或立减金额')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.state.model.denomination - 0 <
|
this.state.model.denomination - 0 <
|
||||||
this.state.model.reduce_amount - 0
|
this.state.model.reduce_amount - 0
|
||||||
|
@ -559,7 +567,6 @@ export default class addKnockGold extends Component {
|
||||||
maxLength={7}
|
maxLength={7}
|
||||||
height={'36px'}
|
height={'36px'}
|
||||||
disabled={this.props?.data?.id ? true : false}
|
disabled={this.props?.data?.id ? true : false}
|
||||||
kind='number'
|
|
||||||
width={'520px'}
|
width={'520px'}
|
||||||
unit='元'
|
unit='元'
|
||||||
countShow={false}
|
countShow={false}
|
||||||
|
@ -583,9 +590,8 @@ export default class addKnockGold extends Component {
|
||||||
unit='元'
|
unit='元'
|
||||||
countShow={false}
|
countShow={false}
|
||||||
labelWidth={'0px'}
|
labelWidth={'0px'}
|
||||||
maxLength={7}
|
maxLength={9}
|
||||||
height={'36px'}
|
height={'36px'}
|
||||||
kind='number'
|
|
||||||
width={'520px'}
|
width={'520px'}
|
||||||
alignment={'left'}
|
alignment={'left'}
|
||||||
/>
|
/>
|
||||||
|
@ -617,11 +623,10 @@ export default class addKnockGold extends Component {
|
||||||
unit='元'
|
unit='元'
|
||||||
disabled={this.props?.data?.id ? true : false}
|
disabled={this.props?.data?.id ? true : false}
|
||||||
countShow={false}
|
countShow={false}
|
||||||
maxLength={14}
|
maxLength={4}
|
||||||
height={'36px'}
|
height={'36px'}
|
||||||
width={'231px'}
|
width={'231px'}
|
||||||
alignment={'left'}
|
alignment={'left'}
|
||||||
kind='number'
|
|
||||||
/>
|
/>
|
||||||
<span className='JIan'>减</span>
|
<span className='JIan'>减</span>
|
||||||
<Ipt
|
<Ipt
|
||||||
|
@ -637,11 +642,10 @@ export default class addKnockGold extends Component {
|
||||||
unit='元'
|
unit='元'
|
||||||
disabled={this.props?.data?.id ? true : false}
|
disabled={this.props?.data?.id ? true : false}
|
||||||
countShow={false}
|
countShow={false}
|
||||||
maxLength={14}
|
maxLength={4}
|
||||||
height={'36px'}
|
height={'36px'}
|
||||||
width={'231px'}
|
width={'231px'}
|
||||||
alignment={'left'}
|
alignment={'left'}
|
||||||
kind='number'
|
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem id='all_budget' labelname='总预算' prop='all_budget'>
|
<FormItem id='all_budget' labelname='总预算' prop='all_budget'>
|
||||||
|
@ -654,10 +658,9 @@ export default class addKnockGold extends Component {
|
||||||
}}
|
}}
|
||||||
value={this.state.model.all_budget}
|
value={this.state.model.all_budget}
|
||||||
placeholder={'请输入'}
|
placeholder={'请输入'}
|
||||||
kind='number'
|
|
||||||
disabled={this.props?.data?.id ? true : false}
|
disabled={this.props?.data?.id ? true : false}
|
||||||
labelWidth={'0px'}
|
labelWidth={'0px'}
|
||||||
maxLength={14}
|
maxLength={9}
|
||||||
height={'36px'}
|
height={'36px'}
|
||||||
unit='元'
|
unit='元'
|
||||||
countShow={false}
|
countShow={false}
|
||||||
|
@ -681,13 +684,12 @@ export default class addKnockGold extends Component {
|
||||||
value={this.state.model.day_budget}
|
value={this.state.model.day_budget}
|
||||||
placeholder={'请输入'}
|
placeholder={'请输入'}
|
||||||
labelWidth={'0px'}
|
labelWidth={'0px'}
|
||||||
maxLength={14}
|
maxLength={9}
|
||||||
height={'36px'}
|
height={'36px'}
|
||||||
unit='元'
|
unit='元'
|
||||||
countShow={false}
|
countShow={false}
|
||||||
width={'520px'}
|
width={'520px'}
|
||||||
alignment={'left'}
|
alignment={'left'}
|
||||||
kind='number'
|
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem
|
||||||
|
@ -705,13 +707,12 @@ export default class addKnockGold extends Component {
|
||||||
value={this.state.model.receive_number}
|
value={this.state.model.receive_number}
|
||||||
placeholder={'请输入'}
|
placeholder={'请输入'}
|
||||||
labelWidth={'0px'}
|
labelWidth={'0px'}
|
||||||
maxLength={3}
|
maxLength={4}
|
||||||
height={'36px'}
|
height={'36px'}
|
||||||
unit='个'
|
unit='个'
|
||||||
countShow={false}
|
countShow={false}
|
||||||
width={'520px'}
|
width={'520px'}
|
||||||
alignment={'left'}
|
alignment={'left'}
|
||||||
kind='number'
|
|
||||||
/>
|
/>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
disabled={this.props?.data?.id ? true : false}
|
disabled={this.props?.data?.id ? true : false}
|
||||||
|
@ -884,8 +885,7 @@ export default class addKnockGold extends Component {
|
||||||
value={this.state.model.effect_date}
|
value={this.state.model.effect_date}
|
||||||
placeholder={'请输入'}
|
placeholder={'请输入'}
|
||||||
labelWidth={'0px'}
|
labelWidth={'0px'}
|
||||||
maxLength={16}
|
maxLength={3}
|
||||||
kind='number'
|
|
||||||
height={'36px'}
|
height={'36px'}
|
||||||
unit='天'
|
unit='天'
|
||||||
countShow={false}
|
countShow={false}
|
||||||
|
@ -971,11 +971,10 @@ export default class addKnockGold extends Component {
|
||||||
this.filterEarlyPer()
|
this.filterEarlyPer()
|
||||||
this.setState({ input_early_per: '' })
|
this.setState({ input_early_per: '' })
|
||||||
}}
|
}}
|
||||||
kind='number'
|
|
||||||
value={this.state.input_early_per}
|
value={this.state.input_early_per}
|
||||||
placeholder={''}
|
placeholder={''}
|
||||||
labelWidth={'0px'}
|
labelWidth={'0px'}
|
||||||
maxLength={16}
|
maxLength={3}
|
||||||
height={'36px'}
|
height={'36px'}
|
||||||
unit='%'
|
unit='%'
|
||||||
countShow={false}
|
countShow={false}
|
||||||
|
|
|
@ -425,18 +425,6 @@ export default class acclist extends React.Component {
|
||||||
item.upstream = '直连天下'
|
item.upstream = '直连天下'
|
||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
|
|
||||||
//select数据
|
|
||||||
let arr = []
|
|
||||||
_.map(temp.concat(this.state.tempdata), (res) => {
|
|
||||||
let obj = {}
|
|
||||||
obj.key = res.only
|
|
||||||
obj.text = res.product_name
|
|
||||||
arr.push(obj)
|
|
||||||
return obj
|
|
||||||
})
|
|
||||||
arr = deWeightThree(arr, 'key')
|
|
||||||
this.setState({ rankoptions: arr })
|
|
||||||
} else {
|
} else {
|
||||||
/* 处理立减金 */
|
/* 处理立减金 */
|
||||||
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
|
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
|
||||||
|
@ -444,7 +432,7 @@ export default class acclist extends React.Component {
|
||||||
)
|
)
|
||||||
temp = _.map(data, (item) => {
|
temp = _.map(data, (item) => {
|
||||||
let index = this.state.tempdata.findIndex((o) => {
|
let index = this.state.tempdata.findIndex((o) => {
|
||||||
return o.channel_activity_id === item.only
|
return o.channel_activity_id === item.channel_activity_id
|
||||||
})
|
})
|
||||||
|
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
|
@ -453,38 +441,50 @@ export default class acclist extends React.Component {
|
||||||
|
|
||||||
/* 转换商品结构 */
|
/* 转换商品结构 */
|
||||||
// temp
|
// temp
|
||||||
return {
|
const newObj = {}
|
||||||
product_name: item.batch_goods_name, //名字
|
newObj.product_name = item.batch_goods_name
|
||||||
channel_activity_id: item.channel_activity_id, //批次号
|
? item.batch_goods_name
|
||||||
only: item.channel_activity_id, //批次号
|
: item.product_name //名字
|
||||||
type: 2, //类型
|
newObj.map_product_name = item.product_name
|
||||||
upstream: item.channel === '1' ? '支付宝' : '微信', //上游
|
newObj.channel_activity_id = item.channel_activity_id //批次号
|
||||||
effectDate:
|
newObj.only = item.channel_activity_id //批次号
|
||||||
item.time_limit.effect_time.start_time +
|
newObj.type = 2 //类型
|
||||||
|
newObj.checked = item?.checked
|
||||||
|
newObj.upstream = item.channel === '1' ? '支付宝' : '微信' //上游
|
||||||
|
newObj.edit = 'edit'
|
||||||
|
newObj.effectDate = item.effectDate
|
||||||
|
? item.effectDate
|
||||||
|
: item.time_limit?.effect_time.start_time +
|
||||||
' 至 ' +
|
' 至 ' +
|
||||||
item.time_limit.effect_time.end_time, //有效时间
|
item.time_limit?.effect_time.end_time //有效时间
|
||||||
contract_price: item.price, //单价
|
newObj.contract_price = item.contract_price
|
||||||
official_price: item.denomination, //官方价
|
? item.contract_price
|
||||||
quantity: (item.all_budget / item.denomination).toFixed(0), //总库存
|
: item.price //单价
|
||||||
edit: 'edit'
|
newObj.official_price = item.official_price
|
||||||
}
|
? item.official_price
|
||||||
|
: item.denomination //官方价
|
||||||
|
newObj.quantity = item.quantity
|
||||||
|
? item.quantity
|
||||||
|
: (item.all_budget / item.denomination).toFixed(0) //总库
|
||||||
|
newObj.origin = item?.origin ? item?.origin : item
|
||||||
|
return newObj
|
||||||
})
|
})
|
||||||
|
|
||||||
//select数据
|
|
||||||
let arr = []
|
|
||||||
_.map(temp.concat(this.state.tempdata), (res) => {
|
|
||||||
let obj = {}
|
|
||||||
obj.key = res.only
|
|
||||||
obj.text = res.product_name
|
|
||||||
arr.push(obj)
|
|
||||||
return obj
|
|
||||||
})
|
|
||||||
arr = deWeightThree(arr, 'key')
|
|
||||||
this.setState({ rankoptions: arr })
|
|
||||||
}
|
}
|
||||||
let newArray = temp.concat(this.state.tempdata)
|
let newArray = temp.concat(this.state.tempdata)
|
||||||
newArray = deWeightThree(newArray, 'only')
|
newArray = deWeightThree(newArray, 'only')
|
||||||
this.setState({ tempdata: newArray })
|
|
||||||
|
//select数据
|
||||||
|
let arr = []
|
||||||
|
let rank = []
|
||||||
|
_.map(newArray, (res) => {
|
||||||
|
arr.push({ key: res.only, text: res.product_name })
|
||||||
|
if (res.checked) {
|
||||||
|
rank.push({ key: res.only, text: res.product_name })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
arr = deWeightThree(arr, 'key')
|
||||||
|
this.setState({ tempdata: newArray, rankoptions: arr, rank })
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,6 +559,7 @@ export default class acclist extends React.Component {
|
||||||
if (item.type === 2) {
|
if (item.type === 2) {
|
||||||
obj.channel_activity_id = item.channel_activity_id //批次号
|
obj.channel_activity_id = item.channel_activity_id //批次号
|
||||||
obj.effectDate = item.effectDate //有效时间
|
obj.effectDate = item.effectDate //有效时间
|
||||||
|
obj.origin = item.origin // 原始数据
|
||||||
}
|
}
|
||||||
obj.only = item.only
|
obj.only = item.only
|
||||||
obj.type = item.type
|
obj.type = item.type
|
||||||
|
@ -625,10 +626,6 @@ export default class acclist extends React.Component {
|
||||||
} else {
|
} else {
|
||||||
if (this.refs.form1.validator()) {
|
if (this.refs.form1.validator()) {
|
||||||
/* 处理数据 区分立减金和商品 开始 2022-05-30 13:40*/
|
/* 处理数据 区分立减金和商品 开始 2022-05-30 13:40*/
|
||||||
let reduce = []
|
|
||||||
if (sessionStorage.getItem('knockGoldData')) {
|
|
||||||
reduce = JSON.parse(sessionStorage.getItem('knockGoldData'))
|
|
||||||
}
|
|
||||||
const dataCopy = this.refs.bindObj.getSelectData()
|
const dataCopy = this.refs.bindObj.getSelectData()
|
||||||
|
|
||||||
dataCopy.map((item) => {
|
dataCopy.map((item) => {
|
||||||
|
@ -640,16 +637,10 @@ export default class acclist extends React.Component {
|
||||||
item.product = {
|
item.product = {
|
||||||
legal: item.products.filter((item2) => item2.type === 1),
|
legal: item.products.filter((item2) => item2.type === 1),
|
||||||
reduce: item.products
|
reduce: item.products
|
||||||
.filter((item3) => item3.type === 2)
|
.map((item2) => {
|
||||||
.map(
|
if (item2.type === 2) return item2.origin
|
||||||
(item4) =>
|
|
||||||
reduce
|
|
||||||
.map((item5) => {
|
|
||||||
if (item4.only === item5.channel_activity_id)
|
|
||||||
return item5
|
|
||||||
})
|
})
|
||||||
.filter((item6) => item6)[0]
|
.filter((item3) => item3)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -768,7 +759,7 @@ export default class acclist extends React.Component {
|
||||||
})
|
})
|
||||||
|
|
||||||
sessionStorage.setItem('productData', JSON.stringify(row.product))
|
sessionStorage.setItem('productData', JSON.stringify(row.product))
|
||||||
|
sessionStorage.setItem('knockGoldData', JSON.stringify(row.product))
|
||||||
this.setState({ drawerVisible: true, tempdata: temp })
|
this.setState({ drawerVisible: true, tempdata: temp })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1032,14 +1023,9 @@ export default class acclist extends React.Component {
|
||||||
if (this.state.direct_reseller_id > 0) {
|
if (this.state.direct_reseller_id > 0) {
|
||||||
/* 区分立减金 */
|
/* 区分立减金 */
|
||||||
if (row.type === 2) {
|
if (row.type === 2) {
|
||||||
const temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
|
|
||||||
const editData = temp.filter(
|
|
||||||
(item) => item.channel_activity_id === row.only
|
|
||||||
)
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
product_title: '编辑立减金',
|
product_title: '编辑立减金',
|
||||||
productData: editData[0],
|
productData: row.origin,
|
||||||
addIsType: 'addKnockGold',
|
addIsType: 'addKnockGold',
|
||||||
drawerVisible2: true
|
drawerVisible2: true
|
||||||
})
|
})
|
||||||
|
|
|
@ -656,7 +656,6 @@ export default class exchangedit extends React.Component {
|
||||||
|
|
||||||
//渲染范围列表数据以及数据转换
|
//渲染范围列表数据以及数据转换
|
||||||
async productSubmit() {
|
async productSubmit() {
|
||||||
// sessionStorage.setItem('knockGoldData', '')
|
|
||||||
let visible = ''
|
let visible = ''
|
||||||
if (this.state.addIsType === 'addProduct') {
|
if (this.state.addIsType === 'addProduct') {
|
||||||
visible = await this.refs.product.submit()
|
visible = await this.refs.product.submit()
|
||||||
|
@ -687,18 +686,6 @@ export default class exchangedit extends React.Component {
|
||||||
item.upstream = '直连天下'
|
item.upstream = '直连天下'
|
||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
|
|
||||||
//select数据
|
|
||||||
let arr = []
|
|
||||||
_.map(temp.concat(this.state.tempdata), (res) => {
|
|
||||||
let obj = {}
|
|
||||||
obj.key = res.only
|
|
||||||
obj.text = res.product_name
|
|
||||||
arr.push(obj)
|
|
||||||
return obj
|
|
||||||
})
|
|
||||||
arr = deWeightThree(arr, 'key')
|
|
||||||
this.setState({ rankoptions: arr })
|
|
||||||
} else {
|
} else {
|
||||||
/* 处理立减金 */
|
/* 处理立减金 */
|
||||||
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
|
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
|
||||||
|
@ -743,22 +730,23 @@ export default class exchangedit extends React.Component {
|
||||||
newObj.id = item.goods_id ? item.goods_id : item.id
|
newObj.id = item.goods_id ? item.goods_id : item.id
|
||||||
return newObj
|
return newObj
|
||||||
})
|
})
|
||||||
|
|
||||||
//select数据
|
|
||||||
let arr = []
|
|
||||||
_.map(temp.concat(this.state.tempdata), (res) => {
|
|
||||||
let obj = {}
|
|
||||||
obj.key = res.only
|
|
||||||
obj.text = res.product_name
|
|
||||||
arr.push(obj)
|
|
||||||
return obj
|
|
||||||
})
|
|
||||||
arr = deWeightThree(arr, 'key')
|
|
||||||
this.setState({ rankoptions: arr })
|
|
||||||
}
|
}
|
||||||
let newArray = temp.concat(this.state.tempdata)
|
let newArray = temp.concat(this.state.tempdata)
|
||||||
newArray = deWeightThree(newArray, 'only')
|
newArray = deWeightThree(newArray, 'only')
|
||||||
this.setState({ tempdata: newArray })
|
|
||||||
|
//select数据
|
||||||
|
let arr = []
|
||||||
|
let rank = []
|
||||||
|
_.map(newArray, (res) => {
|
||||||
|
arr.push({ key: res.only, text: res.product_name })
|
||||||
|
if (res.checked) {
|
||||||
|
rank.push({ key: res.only, text: res.product_name })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
arr = deWeightThree(arr, 'key')
|
||||||
|
|
||||||
|
this.setState({ tempdata: newArray, rankoptions: arr, rank })
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,6 @@ export default class add extends React.Component {
|
||||||
componentDidMount(e) {
|
componentDidMount(e) {
|
||||||
sessionStorage.setItem('white', 3)
|
sessionStorage.setItem('white', 3)
|
||||||
sessionStorage.setItem('plan_id', '')
|
sessionStorage.setItem('plan_id', '')
|
||||||
sessionStorage.setItem('knockGoldData', '')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onConfirm(e) {
|
onConfirm(e) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ import {
|
||||||
} from '../../../assets/api.js'
|
} from '../../../assets/api.js'
|
||||||
|
|
||||||
import Productform from '../product/add' /* 商品 */
|
import Productform from '../product/add' /* 商品 */
|
||||||
import KnockGold from '@/components/knockGold' /* 立减金 */
|
import KnockGold from '../../../components/knockGold' /* 立减金 */
|
||||||
import Bus from '../../../assets/eventBus.js'
|
import Bus from '../../../assets/eventBus.js'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
@ -124,11 +124,6 @@ export default class acclist extends React.Component {
|
||||||
let valide = false
|
let valide = false
|
||||||
if (this.refs.form1.validator()) {
|
if (this.refs.form1.validator()) {
|
||||||
/* 处理数据 区分立减金和商品 开始 2022-05-30 13:40*/
|
/* 处理数据 区分立减金和商品 开始 2022-05-30 13:40*/
|
||||||
|
|
||||||
let reduce = []
|
|
||||||
if (sessionStorage.getItem('knockGoldData')) {
|
|
||||||
reduce = JSON.parse(sessionStorage.getItem('knockGoldData'))
|
|
||||||
}
|
|
||||||
const dataCopy = this.refs.tempdata.getSelectData()
|
const dataCopy = this.refs.tempdata.getSelectData()
|
||||||
|
|
||||||
dataCopy.map((item) => {
|
dataCopy.map((item) => {
|
||||||
|
@ -140,15 +135,10 @@ export default class acclist extends React.Component {
|
||||||
item.product = {
|
item.product = {
|
||||||
legal: item.products.filter((item2) => item2.type === 1),
|
legal: item.products.filter((item2) => item2.type === 1),
|
||||||
reduce: item.products
|
reduce: item.products
|
||||||
.filter((item3) => item3.type === 2)
|
.map((item2) => {
|
||||||
.map(
|
if (item2.type === 2) return item2.origin
|
||||||
(item4) =>
|
|
||||||
reduce
|
|
||||||
.map((item5) => {
|
|
||||||
if (item4.only === item5.channel_activity_id) return item5
|
|
||||||
})
|
})
|
||||||
.filter((item6) => item6)[0]
|
.filter((item3) => item3)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -173,6 +163,7 @@ export default class acclist extends React.Component {
|
||||||
}
|
}
|
||||||
return valide
|
return valide
|
||||||
}
|
}
|
||||||
|
|
||||||
onCancel() {
|
onCancel() {
|
||||||
this.refs.form1.cancel()
|
this.refs.form1.cancel()
|
||||||
}
|
}
|
||||||
|
@ -225,6 +216,7 @@ export default class acclist extends React.Component {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
sessionStorage.setItem('productData', '')
|
sessionStorage.setItem('productData', '')
|
||||||
|
sessionStorage.setItem('knockGoldData', '')
|
||||||
|
|
||||||
let codeInfo = {
|
let codeInfo = {
|
||||||
//数据模型不可少
|
//数据模型不可少
|
||||||
|
@ -321,23 +313,12 @@ export default class acclist extends React.Component {
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
item.checked = this.state.tempdata[index].checked
|
item.checked = this.state.tempdata[index].checked
|
||||||
}
|
}
|
||||||
|
|
||||||
item.type = 1
|
item.type = 1
|
||||||
item.only = item.product_id
|
item.only = item.product_id
|
||||||
item.upstream = '直连天下'
|
item.upstream = '直连天下'
|
||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
|
|
||||||
//select数据
|
|
||||||
let arr = []
|
|
||||||
_.map(temp.concat(this.state.tempdata), (res) => {
|
|
||||||
let obj = {}
|
|
||||||
obj.key = res.only
|
|
||||||
obj.text = res.product_name
|
|
||||||
arr.push(obj)
|
|
||||||
return obj
|
|
||||||
})
|
|
||||||
arr = deWeightThree(arr, 'key')
|
|
||||||
this.setState({ rankoptions: arr })
|
|
||||||
} else {
|
} else {
|
||||||
/* 处理立减金 */
|
/* 处理立减金 */
|
||||||
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
|
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
|
||||||
|
@ -359,6 +340,7 @@ export default class acclist extends React.Component {
|
||||||
newObj.product_name = item.batch_goods_name
|
newObj.product_name = item.batch_goods_name
|
||||||
? item.batch_goods_name
|
? item.batch_goods_name
|
||||||
: item.product_name //名字
|
: item.product_name //名字
|
||||||
|
newObj.map_product_name = item.product_name
|
||||||
newObj.channel_activity_id = item.channel_activity_id //批次号
|
newObj.channel_activity_id = item.channel_activity_id //批次号
|
||||||
newObj.only = item.channel_activity_id //批次号
|
newObj.only = item.channel_activity_id //批次号
|
||||||
newObj.type = 2 //类型
|
newObj.type = 2 //类型
|
||||||
|
@ -382,22 +364,23 @@ export default class acclist extends React.Component {
|
||||||
newObj.origin = item?.origin ? item?.origin : item
|
newObj.origin = item?.origin ? item?.origin : item
|
||||||
return newObj
|
return newObj
|
||||||
})
|
})
|
||||||
|
|
||||||
//select数据
|
|
||||||
let arr = []
|
|
||||||
_.map(temp.concat(this.state.tempdata), (res) => {
|
|
||||||
let obj = {}
|
|
||||||
obj.key = res.only
|
|
||||||
obj.text = res.product_name
|
|
||||||
arr.push(obj)
|
|
||||||
return obj
|
|
||||||
})
|
|
||||||
arr = deWeightThree(arr, 'key')
|
|
||||||
this.setState({ rankoptions: arr })
|
|
||||||
}
|
}
|
||||||
let newArray = temp.concat(this.state.tempdata)
|
let newArray = temp.concat(this.state.tempdata)
|
||||||
newArray = deWeightThree(newArray, 'only')
|
newArray = deWeightThree(newArray, 'only')
|
||||||
this.setState({ tempdata: newArray })
|
|
||||||
|
//select数据
|
||||||
|
let arr = []
|
||||||
|
let rank = []
|
||||||
|
_.map(newArray, (res) => {
|
||||||
|
arr.push({ key: res.only, text: res.product_name })
|
||||||
|
if (res.checked) {
|
||||||
|
rank.push({ key: res.only, text: res.product_name })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
arr = deWeightThree(arr, 'key')
|
||||||
|
|
||||||
|
this.setState({ tempdata: newArray, rankoptions: arr, rank })
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,6 +453,7 @@ export default class acclist extends React.Component {
|
||||||
range: rank.toString()
|
range: rank.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(productlist)
|
||||||
let arr = _.map(productlist, (item) => {
|
let arr = _.map(productlist, (item) => {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj.product_id = item.product_id
|
obj.product_id = item.product_id
|
||||||
|
@ -1482,46 +1466,9 @@ export default class acclist extends React.Component {
|
||||||
this.setState({ rank: arr })
|
this.setState({ rank: arr })
|
||||||
}}
|
}}
|
||||||
ComponentHandler={(com, rowData, rowIndex) => {
|
ComponentHandler={(com, rowData, rowIndex) => {
|
||||||
// if (com == 'product_name') {
|
|
||||||
// return (
|
|
||||||
// <Input
|
|
||||||
// width={100}
|
|
||||||
// placeholder='请输入商品名称'
|
|
||||||
// value={rowData.product_name}
|
|
||||||
// onChange={(e) => {
|
|
||||||
// this.onNameChange(e, rowData, rowIndex)
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// if (com == 'quantity') {
|
|
||||||
// return (
|
|
||||||
// <Input
|
|
||||||
// width={100}
|
|
||||||
// placeholder='请输入数量'
|
|
||||||
// value={rowData.quantity}
|
|
||||||
// onChange={(e) => {
|
|
||||||
// this.onQuantityChange(e, rowData, rowIndex)
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
if (com == 'type') {
|
if (com == 'type') {
|
||||||
return <>{rowData.type === 2 ? '立减金' : '商品'}</>
|
return <>{rowData.type === 2 ? '立减金' : '商品'}</>
|
||||||
}
|
}
|
||||||
// if (com == 'contract_price') {
|
|
||||||
// return (
|
|
||||||
// <Input
|
|
||||||
// width={100}
|
|
||||||
// placeholder='请输入合同价'
|
|
||||||
// value={rowData.contract_price}
|
|
||||||
// onChange={(e) => {
|
|
||||||
// this.onPriceChange(e, rowData, rowIndex)
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (com == 'edit') {
|
if (com == 'edit') {
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
|
|
|
@ -435,18 +435,6 @@ export default class acclist extends React.Component {
|
||||||
item.upstream = '直连天下'
|
item.upstream = '直连天下'
|
||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
|
|
||||||
//select数据
|
|
||||||
let arr = []
|
|
||||||
_.map(temp.concat(this.state.tempdata), (res) => {
|
|
||||||
let obj = {}
|
|
||||||
obj.key = res.only
|
|
||||||
obj.text = res.product_name
|
|
||||||
arr.push(obj)
|
|
||||||
return obj
|
|
||||||
})
|
|
||||||
arr = deWeightThree(arr, 'key')
|
|
||||||
this.setState({ rankoptions: arr })
|
|
||||||
} else {
|
} else {
|
||||||
/* 处理立减金 */
|
/* 处理立减金 */
|
||||||
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
|
data = JSON.parse(sessionStorage.getItem('knockGoldData')).filter(
|
||||||
|
@ -454,7 +442,7 @@ export default class acclist extends React.Component {
|
||||||
)
|
)
|
||||||
temp = _.map(data, (item) => {
|
temp = _.map(data, (item) => {
|
||||||
let index = this.state.tempdata.findIndex((o) => {
|
let index = this.state.tempdata.findIndex((o) => {
|
||||||
return o.channel_activity_id === item.only
|
return o.channel_activity_id === item.channel_activity_id
|
||||||
})
|
})
|
||||||
|
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
|
@ -463,39 +451,51 @@ export default class acclist extends React.Component {
|
||||||
|
|
||||||
/* 转换商品结构 */
|
/* 转换商品结构 */
|
||||||
// temp
|
// temp
|
||||||
return {
|
const newObj = {}
|
||||||
product_name: item.batch_goods_name, //名字
|
newObj.product_name = item.batch_goods_name
|
||||||
channel_activity_id: item.channel_activity_id, //批次号
|
? item.batch_goods_name
|
||||||
type: 2, //类型
|
: item.product_name //名字
|
||||||
only: item.channel_activity_id,
|
newObj.channel_activity_id = item.channel_activity_id //批次号
|
||||||
upstream: item.channel === '1' ? '支付宝' : '微信', //上游
|
newObj.only = item.channel_activity_id //批次号
|
||||||
effectDate:
|
newObj.type = 2 //类型
|
||||||
item.time_limit.effect_time.start_time +
|
newObj.checked = item?.checked
|
||||||
|
newObj.upstream = item.channel === '1' ? '支付宝' : '微信' //上游
|
||||||
|
newObj.edit = 'edit'
|
||||||
|
newObj.effectDate = item.effectDate
|
||||||
|
? item.effectDate
|
||||||
|
: item.time_limit?.effect_time.start_time +
|
||||||
' 至 ' +
|
' 至 ' +
|
||||||
item.time_limit.effect_time.end_time, //有效时间
|
item.time_limit?.effect_time.end_time //有效时间
|
||||||
contract_price: item.price, //单价
|
newObj.contract_price = item.contract_price
|
||||||
official_price: item.denomination, //官方价
|
? item.contract_price
|
||||||
quantity: (item.all_budget / item.denomination).toFixed(0), //总库存
|
: item.price //单价
|
||||||
edit: 'edit',
|
newObj.official_price = item.official_price
|
||||||
origin: item
|
? item.official_price
|
||||||
}
|
: item.denomination //官方价
|
||||||
|
newObj.quantity = item.quantity
|
||||||
|
? item.quantity
|
||||||
|
: (item.all_budget / item.denomination).toFixed(0) //总库
|
||||||
|
newObj.origin = item.origin ? item.origin : item
|
||||||
|
newObj.id = item.goods_id ? item.goods_id : item.id
|
||||||
|
return newObj
|
||||||
})
|
})
|
||||||
|
|
||||||
//select数据
|
|
||||||
let arr = []
|
|
||||||
_.map(temp.concat(this.state.tempdata), (res) => {
|
|
||||||
let obj = {}
|
|
||||||
obj.key = res.only
|
|
||||||
obj.text = res.product_name
|
|
||||||
arr.push(obj)
|
|
||||||
return obj
|
|
||||||
})
|
|
||||||
arr = deWeightThree(arr, 'key')
|
|
||||||
this.setState({ rankoptions: arr })
|
|
||||||
}
|
}
|
||||||
let newArray = temp.concat(this.state.tempdata)
|
let newArray = temp.concat(this.state.tempdata)
|
||||||
newArray = deWeightThree(newArray, 'only')
|
newArray = deWeightThree(newArray, 'only')
|
||||||
this.setState({ tempdata: newArray })
|
|
||||||
|
//select数据
|
||||||
|
let arr = []
|
||||||
|
let rank = []
|
||||||
|
_.map(newArray, (res) => {
|
||||||
|
arr.push({ key: res.only, text: res.product_name })
|
||||||
|
if (res.checked) {
|
||||||
|
rank.push({ key: res.only, text: res.product_name })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
arr = deWeightThree(arr, 'key')
|
||||||
|
|
||||||
|
this.setState({ tempdata: newArray, rankoptions: arr, rank })
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1002,7 +1002,6 @@ export default class acclist extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
rowItemClick(row, rowIndex) {
|
rowItemClick(row, rowIndex) {
|
||||||
debugger
|
|
||||||
let codeInfo = {
|
let codeInfo = {
|
||||||
//数据模型不可少
|
//数据模型不可少
|
||||||
code_name: row.title,
|
code_name: row.title,
|
||||||
|
@ -1035,7 +1034,7 @@ export default class acclist extends React.Component {
|
||||||
})
|
})
|
||||||
|
|
||||||
sessionStorage.setItem('productData', JSON.stringify(row.product))
|
sessionStorage.setItem('productData', JSON.stringify(row.product))
|
||||||
|
sessionStorage.setItem('knockGoldData', JSON.stringify(row.product))
|
||||||
this.setState({ tempdata: temp, drawerVisible: true })
|
this.setState({ tempdata: temp, drawerVisible: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1120,10 +1119,6 @@ export default class acclist extends React.Component {
|
||||||
if (this.state.direct_reseller_id > 0) {
|
if (this.state.direct_reseller_id > 0) {
|
||||||
/* 区分立减金 */
|
/* 区分立减金 */
|
||||||
if (row.type === 2) {
|
if (row.type === 2) {
|
||||||
// const temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
|
|
||||||
// const editData = temp.filter(
|
|
||||||
// (item) => item.channel_activity_id === row.only
|
|
||||||
// )
|
|
||||||
this.setState({
|
this.setState({
|
||||||
product_title: '编辑立减金',
|
product_title: '编辑立减金',
|
||||||
productData: row.origin,
|
productData: row.origin,
|
||||||
|
|
Loading…
Reference in New Issue