main
fanfan 6 months ago
parent c193a9da15
commit f8abcd9e3e
  1. 13
      src/views/goods/filter/Index.vue

@ -130,7 +130,8 @@ export default {
}, },
handleAddCondition() { handleAddCondition() {
const { form } = this const { form } = this
const keys = form.getFieldValue('fliter_condition') const key = form.getFieldValue('fliter_condition')
const keys = key ? key : []
const nextKeys = keys.concat([{ category: '', profit: '', profit_rate: '', id: this.generateRandomString(8) }]) const nextKeys = keys.concat([{ category: '', profit: '', profit_rate: '', id: this.generateRandomString(8) }])
form.setFieldsValue({ form.setFieldsValue({
fliter_condition: nextKeys, fliter_condition: nextKeys,
@ -166,7 +167,6 @@ export default {
x.id = this.generateRandomString(8) x.id = this.generateRandomString(8)
return x return x
}) })
record.fliter_condition.forEach((x, i) => { record.fliter_condition.forEach((x, i) => {
record[`profit${i}`] = x.profit record[`profit${i}`] = x.profit
record[`profit_rate${i}`] = x.profit_rate record[`profit_rate${i}`] = x.profit_rate
@ -181,7 +181,7 @@ export default {
} }
if (record.open_channel) { if (record.open_channel) {
const list = record.open_channel const list = record.open_channel
const channelAry = [] const channelAry=[]
this.checkList.map((item) => { this.checkList.map((item) => {
if (list.indexOf(item.id) != -1) { if (list.indexOf(item.id) != -1) {
channelAry.push(item.name) channelAry.push(item.name)
@ -193,7 +193,7 @@ export default {
!isEmpty(form.getFieldsValue()) && !isEmpty(form.getFieldsValue()) &&
$nextTick(() => { $nextTick(() => {
form.setFieldsValue( form.setFieldsValue(
pick(record, ['open_channel', 'fliter_condition', ...profitAry, ...profitRateAry, ...categoryAry]) pick(record, ['open_channel', 'fliter_condition',...profitAry, ...profitRateAry, ...categoryAry])
) )
this.$forceUpdate() this.$forceUpdate()
}) })
@ -209,7 +209,9 @@ export default {
Api.info() Api.info()
.then((result) => { .then((result) => {
// //
result.data.storeInfo.open_channel = result.data.storeInfo.open_channel.split(',') result.data.storeInfo.open_channel = result.data.storeInfo.open_channel
? result.data.storeInfo.open_channel.split(',')
: undefined
this.record = result.data.storeInfo this.record = result.data.storeInfo
// //
this.setFieldsValue() this.setFieldsValue()
@ -243,6 +245,7 @@ export default {
} }
}) })
params.open_channel = values.open_channel ? values.open_channel.join(',') : '' params.open_channel = values.open_channel ? values.open_channel.join(',') : ''
params.fliter_condition = params.fliter_condition.length > 0 ? params.fliter_condition : []
this.isLoading = true this.isLoading = true
Api.update({ form: params }) Api.update({ form: params })
.then((result) => { .then((result) => {

Loading…
Cancel
Save