Commit f0334db1 by wangql
2 parents aaa38028 d768ed1c
...@@ -59,10 +59,10 @@ ...@@ -59,10 +59,10 @@
> >
<gl-form-item label='选择用户:'> <gl-form-item label='选择用户:'>
<gl-select <gl-select
v-model="model.user" v-model="result.influenceScope"
placeholder="请选择用户" placeholder="请选择用户"
style="width:100%" style="width:100%"
name="user" name="influenceScope"
data-vv-as="用户" data-vv-as="用户"
v-validate="'required'" v-validate="'required'"
> >
...@@ -74,16 +74,16 @@ ...@@ -74,16 +74,16 @@
/> />
</gl-select> </gl-select>
<span <span
v-show="errorBags && errorBags.has('user')" v-show="errorBags && errorBags.has('influenceScope')"
class="error" class="error"
> >
{{ errorBags && errorBags.first('user') }} {{ errorBags && errorBags.first('influenceScope') }}
</span> </span>
</gl-form-item> </gl-form-item>
</gl-col> </gl-col>
<gl-col <gl-col
:span="24" :span="24"
v-if="!manufactureOnly && model.user==='LIST'" v-if="!manufactureOnly && result.influenceScope==='LIST'"
> >
<gl-form-item label='灰度用户:'> <gl-form-item label='灰度用户:'>
<gl-upload <gl-upload
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
name="grayscaleUserList" name="grayscaleUserList"
data-vv-as="灰度用户" data-vv-as="灰度用户"
v-validate="'required'" v-validate="'required'"
:file-list="model.file_list"
multiple multiple
> >
<gl-button <gl-button
...@@ -136,7 +137,8 @@ export default { ...@@ -136,7 +137,8 @@ export default {
width: String, width: String,
manufactureOnly: Boolean, manufactureOnly: Boolean,
in_row: Boolean, in_row: Boolean,
uploadAction: String uploadAction: String,
default_value: Object
// errorBags: Object // errorBags: Object
}, },
watch: { watch: {
...@@ -152,7 +154,7 @@ export default { ...@@ -152,7 +154,7 @@ export default {
this.result.merchants = this.merchant_list.filter( this.result.merchants = this.merchant_list.filter(
obj => this.model.merchantId === obj.merchantId obj => this.model.merchantId === obj.merchantId
)[0] )[0]
this.model.manufacturers = this.$emit('update:value', this.result) this.$emit('update:value', this.result)
}) })
}) })
}, },
...@@ -179,37 +181,50 @@ export default { ...@@ -179,37 +181,50 @@ export default {
{ label: '指定用户(灰度)', value: 'LIST' } { label: '指定用户(灰度)', value: 'LIST' }
], ],
model: { model: {
user: '',
merchantId: '', merchantId: '',
manufacturerId: '' manufacturerId: '',
file_list: [] //文件列表
}, },
result: { result: {
manufacturers: null, manufacturers: null, //生产厂商
merchants: null, merchants: null, //商户渠道
grayscaleUserList: null grayscaleUserList: null, //灰度用户列表
influenceScope: '' //用户类型
} }
} }
}, },
methods: { methods: {
get_manufacturer_list() { get_manufacturer_list() {
if (manufacturer_list_back_up.length) { return new Promise((resolve, reject) => {
this.manufacturer_list = manufacturer_list_back_up if (manufacturer_list_back_up.length) {
return // this.manufacturer_list = manufacturer_list_back_up
} resolve(manufacturer_list_back_up)
manufacturers }
.req({}) manufacturers
.then(res => (manufacturer_list_back_up = this.manufacturer_list = res)) .req({})
.catch(err => this.error(err)) .then(res =>
// manufacturer_list_back_up = this.manufacturer_list = res
// this.model.manufacturerId = this.default_value.manufacturerId
resolve(res)
)
.catch(err => reject(err))
})
}, },
get_merchant_list() { get_merchant_list() {
if (merchant_list_back_up.length) { return new Promise((resolve, reject) => {
this.merchant_list = merchant_list_back_up if (merchant_list_back_up.length) {
return // this.merchant_list = merchant_list_back_up
} resolve(merchant_list_back_up)
merchants }
.req({ merchantType: 401, merchantStatus: 0 }) merchants
.then(res => (merchant_list_back_up = this.merchant_list = res)) .req({ merchantType: 401, merchantStatus: 0 })
.catch(err => this.error(err)) .then(
res => resolve(res)
// merchant_list_back_up = this.merchant_list = res
// this.model.merchantId = this.default_value.merchantId
)
.catch(err => reject(err))
})
}, },
// 上传灰度用户成功后调接口解析Excel // 上传灰度用户成功后调接口解析Excel
success_grayscaleuser(res) { success_grayscaleuser(res) {
...@@ -237,9 +252,28 @@ export default { ...@@ -237,9 +252,28 @@ export default {
this.model.grayscaleUserList = '' this.model.grayscaleUserList = ''
} }
}, },
mounted() { created() {
this.get_manufacturer_list() if (this.default_value) {
this.get_merchant_list() this.model.merchantId = this.default_value.merchantId
this.model.manufacturerId = this.default_value.manufacturerId
this.result.influenceScope = this.default_value.influenceScope
this.model.file_list = this.default_value.file_list
this.result.grayscaleUserList = this.default_value.grayscaleuser
/**
* file_list
* [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}]
*/
}
Promise.all([this.get_manufacturer_list(), this.get_merchant_list()]).then(
result => {
manufacturer_list_back_up = this.manufacturer_list = result[0]
merchant_list_back_up = this.merchant_list = result[1]
if (this.default_value) {
this.model.merchantId = this.default_value.merchantId
this.model.manufacturerId = this.default_value.manufacturerId
}
}
)
} }
} }
</script> </script>
......
...@@ -14,24 +14,23 @@ ...@@ -14,24 +14,23 @@
> >
<gl-form-item <gl-form-item
label="活动标题:" label="活动标题:"
prop="title" prop="activityTitle"
> >
<gl-input <gl-input
name="title" name="activityTitle"
v-validate="'required'" v-validate="'required'"
data-vv-as="活动标题" data-vv-as="活动标题"
v-model="editForm.title" v-model="editForm.activityTitle"
></gl-input> ></gl-input>
<span <span
v-show="errorBags.has('title')" v-show="errorBags.has('activityTitle')"
class="error" class="error"
> >
{{ errorBags.first('title') }} {{ errorBags.first('activityTitle') }}
</span> </span>
</gl-form-item> </gl-form-item>
<gl-row> <gl-row>
<gl-col :span="24"> <gl-col :span="24">
<!-- <gl-form-item label='品牌厂商:'> -->
<Manufacturers <Manufacturers
width="100%" width="100%"
:eventBus="eventBus" :eventBus="eventBus"
...@@ -41,91 +40,67 @@ ...@@ -41,91 +40,67 @@
:in_row='true' :in_row='true'
:value.sync="editForm.manufacturer" :value.sync="editForm.manufacturer"
:uploadAction="uploadAction" :uploadAction="uploadAction"
:default_value="default_value"
/> />
<!-- </gl-form-item> -->
</gl-col> </gl-col>
<!-- <gl-col :span="12">
<gl-form-item label='选择用户:'>
<gl-select
v-model="editForm.user"
placeholder="请选择用户"
style="width:100%"
name="user"
data-vv-as="用户"
v-validate="'required'"
>
<gl-option
v-for="item in users"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</gl-select>
<span
v-show="errorBags.has('user')"
class="error"
>
{{ errorBags.first('user') }}
</span>
</gl-form-item>
</gl-col> -->
</gl-row> </gl-row>
<gl-form-item <gl-form-item
label="活动提示语:" label="活动提示语:"
prop="merchantId" prop="activityTip"
> >
<gl-input <gl-input
name="tips" name="activityTip"
v-validate="'required'" v-validate="'required'"
data-vv-as="活动提示语" data-vv-as="活动提示语"
v-model="editForm.tips" v-model="editForm.activityTip"
></gl-input> ></gl-input>
<span <span
v-show="errorBags.has('tips')" v-show="errorBags.has('activityTip')"
class="error" class="error"
> >
{{ errorBags.first('tips') }} {{ errorBags.first('activityTip') }}
</span> </span>
</gl-form-item> </gl-form-item>
<gl-form-item <gl-form-item
label="声控命令词:" label="声控命令词:"
prop="cmdWords" prop="voiceCommand"
> >
<gl-input <gl-input
name="cmdWords" name="voiceCommand"
v-validate="'required'" v-validate="'required'"
data-vv-as="声控命令词" data-vv-as="声控命令词"
v-model="editForm.cmdWords" v-model="editForm.voiceCommand"
></gl-input> ></gl-input>
<span <span
v-show="errorBags.has('cmdWords')" v-show="errorBags.has('voiceCommand')"
class="error" class="error"
> >
{{ errorBags.first('cmdWords') }} {{ errorBags.first('voiceCommand') }}
</span> </span>
</gl-form-item> </gl-form-item>
<gl-form-item <gl-form-item
label="活动回复语:" label="活动回复语:"
prop="feedback" prop="activityReply"
> >
<gl-input <gl-input
name="feedback" name="activityReply"
v-validate="'required'" v-validate="'required'"
data-vv-as="活动回复语" data-vv-as="活动回复语"
v-model="editForm.feedback" v-model="editForm.activityReply"
></gl-input> ></gl-input>
<span <span
v-show="errorBags.has('feedback')" v-show="errorBags.has('activityReply')"
class="error" class="error"
> >
{{ errorBags.first('feedback') }} {{ errorBags.first('activityReply') }}
</span> </span>
</gl-form-item> </gl-form-item>
<gl-row> <gl-row>
<gl-col :span="12"> <gl-col :span="12">
<gl-form-item label='触发方式:'> <gl-form-item label='触发方式:'>
<gl-checkbox v-model="triModel.pop">IP冒泡提示</gl-checkbox> <gl-checkbox v-model="tipType.BUBBLING">冒泡</gl-checkbox>
<gl-checkbox v-model="triModel.dialog">对话中提示</gl-checkbox> <gl-checkbox v-model="tipType.DIALOGUE">对话</gl-checkbox>
<gl-checkbox v-model="tipType.BOTH">冒泡和对话</gl-checkbox>
</gl-form-item> </gl-form-item>
</gl-col> </gl-col>
<gl-col :span="12"> <gl-col :span="12">
...@@ -142,7 +117,7 @@ ...@@ -142,7 +117,7 @@
<gl-col :span="12"> <gl-col :span="12">
<gl-form-item label='活动内容:'> <gl-form-item label='活动内容:'>
<gl-select <gl-select
v-model="editForm.content" v-model="editForm.activityForm"
placeholder="请选择活动" placeholder="请选择活动"
style="width:100%" style="width:100%"
> >
...@@ -158,7 +133,7 @@ ...@@ -158,7 +133,7 @@
<gl-col :span="12"> <gl-col :span="12">
<gl-form-item label='活动有效期:'> <gl-form-item label='活动有效期:'>
<gl-date-picker <gl-date-picker
v-model="time" v-model="editForm.time"
type="datetimerange" type="datetimerange"
:picker-options="pickerOptions" :picker-options="pickerOptions"
start-placeholder="开始日期" start-placeholder="开始日期"
...@@ -174,7 +149,7 @@ ...@@ -174,7 +149,7 @@
prop="moduleList" prop="moduleList"
> >
<div class="content-wrap"> <div class="content-wrap">
<gl-row v-if="editForm.content===0||editForm.content===2"> <gl-row v-if="editForm.activityForm==='GIFT'||editForm.activityForm==='GIFT_DYNAMIC'">
<gl-col :span="24"> <gl-col :span="24">
<gl-button <gl-button
type="primary" type="primary"
...@@ -189,7 +164,7 @@ ...@@ -189,7 +164,7 @@
></gl-table> ></gl-table>
</gl-col> </gl-col>
</gl-row> </gl-row>
<gl-row v-if="editForm.content===1||editForm.content===2"> <gl-row v-if="editForm.activityForm==='DYNAMIC_EFFECT'||editForm.activityForm==='GIFT_DYNAMIC'">
<gl-col :span="12"> <gl-col :span="12">
<gl-upload <gl-upload
class="upload-demo" class="upload-demo"
...@@ -251,6 +226,33 @@ ...@@ -251,6 +226,33 @@
import { Manufacturers } from '../components' import { Manufacturers } from '../components'
import Vue from 'vue' import Vue from 'vue'
import Gift from './gift' import Gift from './gift'
const form_init = {
activityTitle: '', // 活动标题
manufacturer: '', // 品牌厂商
grayscaleUserList: '', // 用户
activityTip: '', // 活动提示语
voiceCommand: '', // 声控命令词
activityReply: '', // 活动回复语
tipType: '', // 触发方式
count: 1, // 触发次数
activityForm: 'GIFT', // 活动内容
coupons: [], // 优惠券
pic: '', // 动效图标
voice: '', // 动效音频
time: '', // 活动结束时间
activityConfig: {
audioFilePath: '',
dynamicEffectIcon: '',
giftId: 0,
giftName: '',
giftType: ''
},
beginTime: '',
endTime: '',
triCount: 1,
time: ''
}
export default { export default {
name: 'Edit', name: 'Edit',
components: { components: {
...@@ -264,9 +266,6 @@ export default { ...@@ -264,9 +266,6 @@ export default {
eventBus: Object eventBus: Object
}, },
watch: { watch: {
updateVisible(val) {
this.$validator.errors.clear()
},
eventBus(val) { eventBus(val) {
if (val) { if (val) {
this.eventBus.$on('giftDialogClose', () => (this.giftVisible = false)) this.eventBus.$on('giftDialogClose', () => (this.giftVisible = false))
...@@ -280,6 +279,15 @@ export default { ...@@ -280,6 +279,15 @@ export default {
}) })
this.eventBus.$on('edit_event_data', data => { this.eventBus.$on('edit_event_data', data => {
this.title = data ? '编辑活动' : '新增活动' this.title = data ? '编辑活动' : '新增活动'
if (!data) {
this.editForm = this.$deep_clone(form_init)
this.$validator.errors.clear()
return
}
const __clone = this.$deep_clone(data)
this.editForm = __clone
this.editForm.time = [__clone.beginTime, __clone.endTime]
this.$validator.errors.clear()
}) })
// this.eventBus.$on( // this.eventBus.$on(
// 'manufacturers', // 'manufacturers',
...@@ -291,47 +299,34 @@ export default { ...@@ -291,47 +299,34 @@ export default {
data() { data() {
return { return {
title: '', title: '',
props: { manufacturerShow: false,
children: 'children', default_value: {
label: 'label' // // merchantId: 19180001,
// manufacturerId: 10012,
// file_list: [{ name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg' }],
// influenceScope: 'LIST',
// grayscaleuser: ['11']
}, },
triModel: { tipType: {
pop: false, BUBBLING: true,
dialog: true DIALOGUE: false,
BOTH: false
}, },
pickerOptions: {}, // 日期设置对象 pickerOptions: {}, // 日期设置对象
// 提交参数 // 提交参数
editForm: { editForm: {},
title: '', // 活动标题 updateRules: {
manufacturer: '', // 品牌厂商 channelName: [{ required: true }],
user: '', // 用户 merchantId: [{ required: true }],
tips: '', // 活动提示语 channelUrl: [{ required: true }],
cmdWords: '', // 声控命令词 moduleList: [{ required: true }]
feedback: '', // 活动回复语
trigger: '', // 触发方式
count: '', // 触发次数
content: 0, // 活动内容
coupons: [], // 优惠券
pic: '', // 动效图标
voice: '', // 动效音频
time: '' // 活动结束时间
}, },
aaa: {},
triCount: 1,
time: '',
uploadAction: '', uploadAction: '',
giftVisible: false, giftVisible: false,
contents: [ contents: [
{ label: '关联礼品', value: 0 }, { label: '关联礼品', value: 'GIFT' },
{ label: '关联瀑布特效', value: 1 }, { label: '关联瀑布特效', value: 'DYNAMIC_EFFECT' },
{ label: '关联礼品+瀑布特效', value: 2 } { label: '关联礼品+瀑布特效', value: 'GIFT_DYNAMIC' }
],
users: [
{ label: '已关联嘀嘀虎帐号用户', value: 0 },
{ label: '未关联嘀嘀虎帐号用户', value: 1 },
{ label: '广东用户', value: 2 },
{ label: '深圳用户', value: 3 },
{ label: '广西用户', value: 4 }
], ],
coupons: { coupons: {
height: 122, height: 122,
...@@ -367,12 +362,6 @@ export default { ...@@ -367,12 +362,6 @@ export default {
], ],
selection: {}, selection: {},
multipleSelection: [] multipleSelection: []
},
updateRules: {
channelName: [{ required: true }],
merchantId: [{ required: true }],
channelUrl: [{ required: true }],
moduleList: [{ required: true }]
} }
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!