Commit bd30008c by wangql
2 parents 53211b11 130a78c0
...@@ -2908,6 +2908,16 @@ ...@@ -2908,6 +2908,16 @@
"integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",
"dev": true "dev": true
}, },
"clipboard": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.4.tgz",
"integrity": "sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ==",
"requires": {
"good-listener": "1.2.2",
"select": "1.1.2",
"tiny-emitter": "2.0.2"
}
},
"clipboardy": { "clipboardy": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "http://registry.npm.taobao.org/clipboardy/download/clipboardy-1.2.3.tgz", "resolved": "http://registry.npm.taobao.org/clipboardy/download/clipboardy-1.2.3.tgz",
...@@ -3893,6 +3903,11 @@ ...@@ -3893,6 +3903,11 @@
"resolved": "http://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz", "resolved": "http://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
}, },
"delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
},
"delegates": { "delegates": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/delegates/download/delegates-1.0.0.tgz", "resolved": "http://registry.npm.taobao.org/delegates/download/delegates-1.0.0.tgz",
...@@ -5532,6 +5547,14 @@ ...@@ -5532,6 +5547,14 @@
} }
} }
}, },
"good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
"requires": {
"delegate": "3.2.0"
}
},
"graceful-fs": { "graceful-fs": {
"version": "4.1.11", "version": "4.1.11",
"resolved": "http://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.1.11.tgz", "resolved": "http://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.1.11.tgz",
...@@ -10525,6 +10548,11 @@ ...@@ -10525,6 +10548,11 @@
} }
} }
}, },
"select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0="
},
"select-hose": { "select-hose": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/select-hose/download/select-hose-2.0.0.tgz", "resolved": "http://registry.npm.taobao.org/select-hose/download/select-hose-2.0.0.tgz",
...@@ -11442,6 +11470,11 @@ ...@@ -11442,6 +11470,11 @@
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=",
"dev": true "dev": true
}, },
"tiny-emitter": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.0.2.tgz",
"integrity": "sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow=="
},
"tmp": { "tmp": {
"version": "0.0.33", "version": "0.0.33",
"resolved": "http://registry.npm.taobao.org/tmp/download/tmp-0.0.33.tgz", "resolved": "http://registry.npm.taobao.org/tmp/download/tmp-0.0.33.tgz",
...@@ -12010,6 +12043,11 @@ ...@@ -12010,6 +12043,11 @@
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"dev": true "dev": true
}, },
"vee-validate": {
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/vee-validate/-/vee-validate-2.1.7.tgz",
"integrity": "sha512-IyPDTTvIRY6o9y14jXlgfY76Qv+hmvYDwNaMn9JY5KbQN8a1tJAu7H/+a/+EdHg1w8Zl9tsdG8lndGqY1lyMzQ=="
},
"vendors": { "vendors": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/vendors/download/vendors-1.0.2.tgz", "resolved": "http://registry.npm.taobao.org/vendors/download/vendors-1.0.2.tgz",
...@@ -12040,6 +12078,14 @@ ...@@ -12040,6 +12078,14 @@
"resolved": "http://registry.npm.taobao.org/vue/download/vue-2.5.17.tgz", "resolved": "http://registry.npm.taobao.org/vue/download/vue-2.5.17.tgz",
"integrity": "sha1-D4eJrXGL5oyhhyYpgy7VM1icato=" "integrity": "sha1-D4eJrXGL5oyhhyYpgy7VM1icato="
}, },
"vue-clipboard2": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/vue-clipboard2/-/vue-clipboard2-0.2.1.tgz",
"integrity": "sha512-n6ie/0g0bKohmLlC/5ja1esq2Q0jQ5hWmhNSZcvCsWfDeDnVARjl6cBB9p72XV1nlVfuqsZcfV8HTjjZAIlLBA==",
"requires": {
"clipboard": "2.0.4"
}
},
"vue-eslint-parser": { "vue-eslint-parser": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "http://registry.npm.taobao.org/vue-eslint-parser/download/vue-eslint-parser-2.0.3.tgz", "resolved": "http://registry.npm.taobao.org/vue-eslint-parser/download/vue-eslint-parser-2.0.3.tgz",
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
"glsx-vue-components": "^1.0.13", "glsx-vue-components": "^1.0.13",
"node-sass": "^4.9.3", "node-sass": "^4.9.3",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"vee-validate": "^2.1.5", "vee-validate": "^2.1.7",
"vue": "^2.5.17", "vue": "^2.5.17",
"vue-i18n": "^8.7.0" "vue-clipboard2": "^0.2.1"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1", "@vue/cli-plugin-babel": "^3.0.1",
......
...@@ -11,7 +11,11 @@ import { ...@@ -11,7 +11,11 @@ import {
import { import {
voiceList, voiceList,
manufacturers, manufacturers,
merchants merchants,
addActivity,
mergeActivity,
searchActivity,
searchCoupon
} from './voice' } from './voice'
export { export {
...@@ -24,5 +28,9 @@ export { ...@@ -24,5 +28,9 @@ export {
getExp, getExp,
mergeExp, mergeExp,
addBg, addBg,
mergeBg mergeBg,
addActivity,
mergeActivity,
searchActivity,
searchCoupon
} }
import { import {
GlAxios GlAxios
} from 'glsx-vue-common' } from 'glsx-vue-common'
const path = '/admin-ddh-aimanager/voice/activity' const path = '/admin-ddh-aimanager'
const __sVoiceList = `${path}/get` const __sVoiceList = `${path}/voice/activity/search`
const __sGetManufacturer = `/admin-ddh-aimanager/manufacturer/search` const __sGetManufacturer = `${path}/manufacturer/search`
const __sGetMerchant = `/admin-ddh-aimanager/merchant/search` const __sGetMerchant = `${path}/merchant/search`
const __sAdd = `${path}/voice/activity/add`
const __sMerge = `${path}/voice/activity/merge`
const __sSearch = `${path}/voice/activity/get`
const __sCouponSearch = `${path}/coupon/search`
/** /**
* 获取语音活动列表 * 获取语音活动列表
*/ */
const voiceList = { const voiceList = {
p: [__sVoiceList], p: [__sVoiceList],
req: params => GlAxios.post(__sVoiceList, { req: params => GlAxios.post(__sVoiceList, params, {
params headers: {
'Content-Type': 'application/json; charset=utf-8'
},
requestType: 'jsonString'
}) })
} }
/** /**
...@@ -19,7 +26,12 @@ const voiceList = { ...@@ -19,7 +26,12 @@ const voiceList = {
*/ */
const manufacturers = { const manufacturers = {
p: [__sGetManufacturer], p: [__sGetManufacturer],
req: params => GlAxios.get(__sGetManufacturer, params) req: params => GlAxios.post(__sGetManufacturer, params, {
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
requestType: 'jsonString'
})
} }
/** /**
...@@ -27,11 +39,61 @@ const manufacturers = { ...@@ -27,11 +39,61 @@ const manufacturers = {
*/ */
const merchants = { const merchants = {
p: [__sGetMerchant], p: [__sGetMerchant],
req: params => GlAxios.get(__sGetMerchant, params) req: params => GlAxios.post(__sGetMerchant, params, {
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
requestType: 'jsonString'
})
}
/**
* 添加语音活动
*/
const addActivity = {
p: [__sAdd],
req: params => GlAxios.post(__sAdd, params, {
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
requestType: 'jsonString'
})
}
/**
* 修改语音活动
*/
const mergeActivity = {
p: [__sMerge],
req: params => GlAxios.post(__sMerge, params, {
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
requestType: 'jsonString'
})
}
/**
* 查询语音活动
*/
const searchActivity = {
p: [__sSearch],
req: params => GlAxios.post(__sSearch, {
params
})
}
/**
* 查询语音活动
*/
const searchCoupon = {
p: [__sCouponSearch],
req: params => GlAxios.get(__sCouponSearch, params)
} }
export { export {
voiceList, voiceList,
manufacturers, manufacturers,
merchants merchants,
addActivity,
mergeActivity,
searchActivity,
searchCoupon
} }
...@@ -4,18 +4,35 @@ import Vue from 'vue' ...@@ -4,18 +4,35 @@ import Vue from 'vue'
import GlsxVueComponents from 'glsx-vue-components' import GlsxVueComponents from 'glsx-vue-components'
import 'glsx-vue-components/dist/glsx-vue-components.css' import 'glsx-vue-components/dist/glsx-vue-components.css'
import './styles/index.scss' import './styles/index.scss'
import zh_CN from 'vee-validate/dist/locale/zh_CN' // import zh_CN from 'vee-validate/dist/locale/zh_CN'
import VeeValidate from 'vee-validate' import VeeValidate from 'vee-validate'
import VueI18n from 'vue-i18n' import VueClipboard2 from 'vue-clipboard2'
Vue.use(VueI18n) // const {
const i18n = new VueI18n({ // Validator
locale: 'zh_CN' // } = VeeValidate
}) // import VueI18n from 'vue-i18n'
// Vue.use(VueI18n)
// const i18n = new VueI18n({
// locale: 'zh_CN'
// })
Vue.use(VueClipboard2)
Vue.use(VeeValidate, { Vue.use(VeeValidate, {
i18n, // i18n,
i18nRootKey: 'validation', // i18nRootKey: 'validation',
dictionary: { dictionary: {
zh_CN en: {
messages: {
required: (field) => `${field}不能为空`,
between: (field, data) => `${field}必须在${data[0]}~${data[1]}之间`,
confirmed: (field, data) => `${field}必须与${data[0]}相匹配`,
max: (field, data) => `${field}最大长度不能超过${data[0]}`,
min: (field, data) => `${field}最小长度不能小于${data[0]}`,
digits: (field, data) => `${field}必须为数字,且长度必须等于${data[0]}`,
min_value: (field, data) => `${field}数值不能小于${data[0]}`,
max_value: (field, data) => `${field}数值不能大于${data[0]}`,
not_in: (field, data) => `${field}不能为${data.join(',')}`
}
}
}, },
errorBagName: 'errorBags', errorBagName: 'errorBags',
fieldsBagName: 'fieldBags', fieldsBagName: 'fieldBags',
...@@ -47,7 +64,7 @@ var mixin = { ...@@ -47,7 +64,7 @@ var mixin = {
}) })
} }
} }
const URL = ' http://192.168.3.171:7300/mock/5be17454f31545347559d499/config' const URL = ' http://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
const getConfig = (url = URL + '/ai_manager_config') => { const getConfig = (url = URL + '/ai_manager_config') => {
return new Promise(resolve => { return new Promise(resolve => {
const xhr = new XMLHttpRequest() const xhr = new XMLHttpRequest()
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
placeholder="请选择品牌厂商" placeholder="请选择品牌厂商"
name="manufacturerId" name="manufacturerId"
data-vv-as="品牌厂商" data-vv-as="品牌厂商"
v-validate="'required'" v-validate="!manufactureOnly && 'required'"
:style="{'width':(in_row?width:'100%')}" :style="{'width':(in_row?width:'100%')}"
> >
<gl-option <gl-option
v-for="item in manufacturer_list" v-for="item in manufacturer_list"
:key="item.manufacturer" :key="item.manufacturerName"
:label="item.manufacturerName" :label="item.manufacturerName"
:value="item.manufacturer" :value="item.manufacturer"
/> />
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
> >
<gl-option <gl-option
v-for="item in merchant_list" v-for="item in merchant_list"
:key="item.merchantId" :key="item.merchantName"
:label="item.merchantName" :label="item.merchantName"
:value="item.merchantId" :value="item.merchantId"
/> />
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
v-validate="'required'" v-validate="'required'"
> >
<gl-option <gl-option
v-for="item in grayscaleUserList" v-for="item in users"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
size="small" size="small"
type="primary" type="primary"
plain plain
>添加动效音频<i class="el-icon-upload el-icon--right"></i></gl-button> >上传灰度用户<i class="el-icon-upload el-icon--right"></i></gl-button>
<div <div
slot="tip" slot="tip"
class="el-upload__tip" class="el-upload__tip"
...@@ -127,8 +127,22 @@ ...@@ -127,8 +127,22 @@
<script> <script>
import { manufacturers, merchants, grayscaleuser } from '@/api' import { manufacturers, merchants, grayscaleuser } from '@/api'
import { NoticeMixin } from '@/mixins' import { NoticeMixin } from '@/mixins'
let manufacturer_list_back_up = [] const manufacturer_list_back_up = [
let merchant_list_back_up = [] {
manufacturer: null,
manufacturerName: '请选择品牌厂商',
merchantId: 0,
merchantName: ''
}
]
const merchant_list_back_up = [
{
merchantId: null,
merchantName: '请选择渠道商',
merchantStatus: 0,
merchantType: 401
}
]
export default { export default {
name: 'Manufacturers', name: 'Manufacturers',
mixins: [NoticeMixin], mixins: [NoticeMixin],
...@@ -138,26 +152,40 @@ export default { ...@@ -138,26 +152,40 @@ export default {
manufactureOnly: Boolean, manufactureOnly: Boolean,
in_row: Boolean, in_row: Boolean,
uploadAction: String, uploadAction: String,
default_value: Object default_value: Object,
value: Object
// id: String
// errorBags: Object // errorBags: Object
}, },
watch: { watch: {
eventBus: { eventBus: {
handler(__eventBus) { handler(__eventBus) {
__eventBus && if (__eventBus) {
__eventBus.$on('submit', callback => { // __eventBus.$on('submit', callback => {
this.$validator.validateAll().then(result => { // this.$validator.validate().then(result => {
// __eventBus.$emit('manufacturers', this.model) // this.result.manufacturers = this.manufacturer_list.filter(
this.result.manufacturers = this.manufacturer_list.filter( // obj => this.model.manufacturerId === obj.manufacturer
obj => this.model.manufacturerId === obj.manufacturer // )[0]
)[0] // 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] // const __back__data__ = this.$deep_clone(this.result)
// this.$emit('update:value', this.result) // // this.$emit('update:value', __back__data__)
callback && callback(this.result) && (callback = null) // // console.log(result, this.result, this.errorBags)
}) // if (result || this.manufactureOnly) {
// this.$emit('update:value', __back__data__)
// //通过验证 回调结果 如果只有"制造商"选项 不需验证 此逻辑只适用于目前需求
// callback && callback(__back__data__)
// }
// })
// }),
__eventBus.$on('clear_error', () => {
this.$validator.errors.clear()
}) })
__eventBus.$on('reset', () => {
!this.manufactureOnly && this.__reset()
})
}
}, },
immediate: true immediate: true
// this.eventBus.$emit('manufacturerChanged', val) // this.eventBus.$emit('manufacturerChanged', val)
...@@ -167,17 +195,53 @@ export default { ...@@ -167,17 +195,53 @@ export default {
__sAction && (this.action = __sAction) __sAction && (this.action = __sAction)
}, },
immediate: true immediate: true
},
default_value: {
handler(__value) {
if (__value) {
this.__setDefault(__value)
// this.model.merchantId = __value.merchantId
// this.model.manufacturerId = __value.manufacturerId
}
},
immediate: true,
deep: true
},
'model.merchantId': {
handler(__value) {
this.result.merchants = this.merchant_list.filter(
obj => this.model.merchantId === obj.merchantId
)[0]
const __back__data__ = this.$deep_clone(this.result)
this.$emit('update:value', __back__data__)
}
},
'model.manufacturerId': {
handler(__value) {
this.result.manufacturers = this.manufacturer_list.filter(
obj => this.model.manufacturerId === obj.manufacturer
)[0]
const __back__data__ = this.$deep_clone(this.result)
this.$emit('update:value', __back__data__)
}
},
result: {
handler(__value) {
const __back__data__ = this.$deep_clone(__value)
this.$emit('update:value', __back__data__)
},
deep: true
} }
}, },
inject: ['$validator'],
data() { data() {
return { return {
value: '',
action: '', action: '',
template_url: template_url:
'http://qcimg01.glsx.net:7060/ddh-ai-m/AI管家-灰度用户导入模板.XLSX', 'http://qcimg01.glsx.net:7060/ddh-ai-m/AI管家-灰度用户导入模板.XLSX',
manufacturer_list: [], manufacturer_list: [],
merchant_list: [], merchant_list: [],
grayscaleUserList: [ users: [
{ label: '全量', value: 'ALL' }, { label: '全量', value: 'ALL' },
{ label: '指定用户(灰度)', value: 'LIST' } { label: '指定用户(灰度)', value: 'LIST' }
], ],
...@@ -197,33 +261,23 @@ export default { ...@@ -197,33 +261,23 @@ export default {
methods: { methods: {
get_manufacturer_list() { get_manufacturer_list() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (manufacturer_list_back_up.length) { if (manufacturer_list_back_up.length > 1) {
// this.manufacturer_list = manufacturer_list_back_up
resolve(manufacturer_list_back_up) resolve(manufacturer_list_back_up)
} }
manufacturers manufacturers
.req({}) .req({ pageNum: 1, pageSize: 999 })
.then(res => .then(res => resolve(res))
// manufacturer_list_back_up = this.manufacturer_list = res
// this.model.manufacturerId = this.default_value.manufacturerId
resolve(res)
)
.catch(err => reject(err)) .catch(err => reject(err))
}) })
}, },
get_merchant_list() { get_merchant_list() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (merchant_list_back_up.length) { if (merchant_list_back_up.length > 1) {
// this.merchant_list = merchant_list_back_up
resolve(merchant_list_back_up) resolve(merchant_list_back_up)
} }
merchants merchants
.req({ merchantType: 401, merchantStatus: 0 }) .req({ merchantType: 401 })
.then( .then(res => resolve(res))
res => resolve(res)
// merchant_list_back_up = this.merchant_list = res
// this.model.merchantId = this.default_value.merchantId
)
.catch(err => reject(err)) .catch(err => reject(err))
}) })
}, },
...@@ -232,10 +286,8 @@ export default { ...@@ -232,10 +286,8 @@ export default {
const { savePath } = res.data const { savePath } = res.data
grayscaleuser grayscaleuser
.req({ grayscaleUserFilePath: savePath }) .req({ grayscaleUserFilePath: savePath })
.then(res => { .then(res => (this.result.grayscaleUserList = res))
this.model.grayscaleUserList = res .catch(err => this.error(err))
})
.catch(err => console.log(err))
}, },
// 限制用户上传的灰度用户文件格式和大小 // 限制用户上传的灰度用户文件格式和大小
beforeUpload_grayscaleuser(file) { beforeUpload_grayscaleuser(file) {
...@@ -251,30 +303,50 @@ export default { ...@@ -251,30 +303,50 @@ export default {
}, },
onRemove_grayscaleuser() { onRemove_grayscaleuser() {
this.model.grayscaleUserList = '' this.model.grayscaleUserList = ''
},
__reset() {
// 初始化
this.model.manufacturerId = null
this.model.merchantId = null
this.result = {
manufacturers: null, // 生产厂商
merchants: null, // 商户渠道
grayscaleUserList: null, // 灰度用户列表
influenceScope: '' // 用户类型
}
// this.$emit('update:value', this.result)
},
__setDefault(__default) {
this.model.merchantId = __default.merchantId
this.model.manufacturerId = __default.manufacturerId
this.result.influenceScope = __default.influenceScope
this.model.file_list = __default.file_list
this.result.grayscaleUserList = __default.grayscaleuser
this.default_value = __default
} }
}, },
created() { created() {
if (this.default_value) { // if (this.default_value) {
this.model.merchantId = this.default_value.merchantId // this.model.merchantId = this.default_value.merchantId
this.model.manufacturerId = this.default_value.manufacturerId // this.model.manufacturerId = this.default_value.manufacturerId
this.result.influenceScope = this.default_value.influenceScope // this.result.influenceScope = this.default_value.influenceScope
this.model.file_list = this.default_value.file_list // this.model.file_list = this.default_value.file_list
this.result.grayscaleUserList = this.default_value.grayscaleuser // this.result.grayscaleUserList = this.default_value.grayscaleuser
/** // /**
* file_list // * file_list
* [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}] // * [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}]
*/ // */
} // }
Promise.all([this.get_manufacturer_list(), this.get_merchant_list()]).then( Promise.all([this.get_manufacturer_list(), this.get_merchant_list()])
result => { .then(result => {
manufacturer_list_back_up = this.manufacturer_list = result[0] this.manufacturer_list = manufacturer_list_back_up.concat(result[0])
merchant_list_back_up = this.merchant_list = result[1] this.merchant_list = merchant_list_back_up.concat(result[1])
if (this.default_value) { if (this.default_value) {
this.model.merchantId = this.default_value.merchantId this.model.merchantId = this.default_value.merchantId
this.model.manufacturerId = this.default_value.manufacturerId this.model.manufacturerId = this.default_value.manufacturerId
} }
} })
) .catch(err => this.error(err))
} }
} }
</script> </script>
......
import App from './index.vue' import App from './index.vue'
import base from '@/base' import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common' import GlsxVueCommon from 'glsx-vue-common'
// eslint-disable-next-line no-extend-native
Promise.prototype.finally = function(fn) {
function finFn(valueORreason) {
// eslint-disable-next-line no-useless-call
fn.call(null)
}
this.then(finFn, finFn)
return this
}
base.getConfig().then(data => { base.getConfig().then(data => {
const { vue, config } = data const {
vue,
config
} = data
vue.use(GlsxVueCommon, config) vue.use(GlsxVueCommon, config)
base.render(App) base.render(App)
}) })
...@@ -8,16 +8,73 @@ ...@@ -8,16 +8,73 @@
width='800px ' width='800px '
> >
<gl-row> <gl-row>
<gl-col :span="11"> <gl-col :span="24">
<gl-card shadow="always"> <gl-card shadow="always">
可选择活动礼品 <gl-form
:inline="true"
:model="searchCondition"
>
<gl-form-item label="优惠券名称:">
<gl-input
v-model="searchCondition.name"
class="input-with-select"
placeholder="请输入优惠券名称"
clearable
/>
</gl-form-item>
<gl-form-item label='优惠券类型:'>
<gl-select
v-model="searchCondition.type"
placeholder="请选择优惠券类型"
style="width:100%"
>
<gl-option
v-for="item in types"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</gl-select>
</gl-form-item>
<gl-form-item>
<gl-button
type="primary"
@click="handleSearch"
>搜索</gl-button>
</gl-form-item>
</gl-form>
<gl-table <gl-table
:table="giftTable" :table="giftTable"
ref="giftTable" ref="giftTable"
v-loading="tableLoading"
></gl-table> ></gl-table>
<gl-row class="gift-info">
<gl-col :span="12">
<gl-pagination
background
@current-change="handleCurrentChange"
:current-page="page.pageNum"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
layout="total, prev, pager, next"
:total="page.total"
>
</gl-pagination>
</gl-col>
<gl-col :span="12">
<gl-tag
type="success"
v-if="checked.giftId"
>已选择优惠券编号:{{checked.giftId}} 名称:{{checked.giftName}}</gl-tag>
<gl-tag
type="success"
v-else
>暂无选择</gl-tag>
</gl-col>
</gl-row>
</gl-card> </gl-card>
</gl-col> </gl-col>
<gl-col <!-- <gl-col
:span="2" :span="2"
class="transfer__col" class="transfer__col"
> >
...@@ -39,8 +96,8 @@ ...@@ -39,8 +96,8 @@
@click="handleDisSelectGift" @click="handleDisSelectGift"
></gl-button> ></gl-button>
</div> </div>
</gl-col> </gl-col> -->
<gl-col :span="11"> <!-- <gl-col :span="12">
<gl-card shadow="always"> <gl-card shadow="always">
已选择活动礼品 已选择活动礼品
<gl-table <gl-table
...@@ -48,7 +105,7 @@ ...@@ -48,7 +105,7 @@
ref="checkedTable" ref="checkedTable"
></gl-table> ></gl-table>
</gl-card> </gl-card>
</gl-col> </gl-col> -->
</gl-row> </gl-row>
<div <div
slot="footer" slot="footer"
...@@ -66,37 +123,57 @@ ...@@ -66,37 +123,57 @@
</template> </template>
<script> <script>
import { searchCoupon } from '@/api'
import { NoticeMixin } from '@/mixins'
export default { export default {
name: 'Gift', name: 'Gift',
props: { props: {
giftVisible: Boolean, giftVisible: Boolean,
eventBus: Object eventBus: Object
}, },
mixins: [NoticeMixin],
watch: {
eventBus(__eventBus) {
if (__eventBus) {
__eventBus.$on('checked_gift', value => {
this.checked = value
})
}
}
},
data() { data() {
return { return {
submiting: false, submiting: false,
tableLoading: false,
checked: {},
searchCondition: {
name: '',
type: ''
},
page: {
pageNum: 1,
pageSize: 10,
total: 10
},
types: [
{ name: '抵扣券', value: 1 },
{ name: '折扣券', value: 2 },
{ name: '流量', value: 3 }
],
giftTable: { giftTable: {
highlightCurrentRow: true,
rowClick: (row, event, column) => {
const { id, name, type } = row
this.checked = {
giftId: id,
giftName: name,
giftType: type
}
},
selectionChange: this.handleGiftTableSelectionChange, selectionChange: this.handleGiftTableSelectionChange,
height: 400, height: 330,
border: true, border: true,
data: [ data: [],
{
name: '嘀嘀虎1',
id: '001'
},
{
name: '嘀嘀虎2',
id: '002'
},
{
name: '嘀嘀虎3',
id: '003'
},
{
name: '嘀嘀虎4',
id: '004'
}
],
column: [ column: [
{ {
label: '优惠券编号', label: '优惠券编号',
...@@ -107,8 +184,8 @@ export default { ...@@ -107,8 +184,8 @@ export default {
label: '优惠券名称', label: '优惠券名称',
prop: 'name' prop: 'name'
} }
], ]
selection: [] // selection: []
}, },
checkedTable: { checkedTable: {
height: 400, height: 400,
...@@ -130,13 +207,51 @@ export default { ...@@ -130,13 +207,51 @@ export default {
label: '优惠券名称', label: '优惠券名称',
prop: 'name' prop: 'name'
} }
], ]
selection: [] // selection: []
} }
} }
}, },
mounted() {}, mounted() {
this.getList(this.page)
},
methods: { methods: {
getList(p) {
searchCoupon
.req(p)
.then(res => {
this.page.total = res.total
this.giftTable.data = res
this.tableLoading = false
})
.catch(err => {
this.tableLoading = false
this.error(err)
})
},
/* 接口请求-start */
getParams() {
return new Promise(resolve => {
var __p = {}
if (this.searchCondition.name) {
__p.name = this.searchCondition.name
}
if (this.searchCondition.type) {
__p.type = this.searchCondition.type
}
resolve(__p)
})
},
handleSearch() {
this.tableLoading = true
this.getParams().then(__p => {
this.getList(Object.assign(__p, this.page))
})
},
handleCurrentChange(val) {
this.page.pageNum = val
this.handleSearch()
},
handleClose() { handleClose() {
this.eventBus.$emit('giftDialogClose') this.eventBus.$emit('giftDialogClose')
}, },
...@@ -166,7 +281,7 @@ export default { ...@@ -166,7 +281,7 @@ export default {
) )
}, },
handleSubmit() { handleSubmit() {
this.eventBus.$emit('submitGift', this.checkedTable.data) this.eventBus.$emit('submitGift', this.checked)
} }
} }
} }
...@@ -197,5 +312,15 @@ export default { ...@@ -197,5 +312,15 @@ export default {
.el-transfer__buttons { .el-transfer__buttons {
padding: 0; padding: 0;
} }
.gift-info {
margin: 4px;
.el-tag--success {
width: 100%;
text-align: center;
}
}
.current-row {
color: #865b10;
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -5,16 +5,20 @@ ...@@ -5,16 +5,20 @@
:inline="true" :inline="true"
:model="searchCondition" :model="searchCondition"
> >
<gl-form-item> <gl-form-item label="活动主题:">
<gl-input <gl-input
v-model="searchCondition.content" v-model="searchCondition.activityTitle"
class="input-with-select" class="input-with-select"
placeholder="请输入活动主题" placeholder="请输入活动主题"
clearable clearable
/> />
</gl-form-item> </gl-form-item>
<gl-form-item> <gl-form-item>
<Manufacturers :manufactureOnly="true" /> <Manufacturers
:manufactureOnly="true"
:eventBus='eventBus'
:value.sync="com_value"
/>
</gl-form-item> </gl-form-item>
<gl-form-item> <gl-form-item>
<gl-button <gl-button
...@@ -26,7 +30,7 @@ ...@@ -26,7 +30,7 @@
<gl-button <gl-button
class="newButton" class="newButton"
type="primary" type="primary"
@click="dialog" @click="dialog(null,null)"
>添加活动</gl-button> >添加活动</gl-button>
</gl-form-item> </gl-form-item>
</gl-form> </gl-form>
...@@ -47,11 +51,11 @@ ...@@ -47,11 +51,11 @@
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pageNum" :current-page="page.pageNum"
:page-sizes="[10,20,30,40]" :page-sizes="[10,20,30,40]"
:page-size="pageSize" :page-size="page.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="total" :total="page.total"
> >
</gl-pagination> </gl-pagination>
</div> </div>
...@@ -60,8 +64,7 @@ ...@@ -60,8 +64,7 @@
<script> <script>
import Edit from './Edit' import Edit from './Edit'
import { Manufacturers } from '../components' import { Manufacturers } from '../components'
// import { fn, treeCheckKeys, deleteEmptyAttribute } from '@/common/common' import { voiceList, manufacturers, mergeActivity } from '@/api'
import { voiceList, manufacturers } from '@/api'
import { NoticeMixin } from '@/mixins' import { NoticeMixin } from '@/mixins'
import Vue from 'vue' import Vue from 'vue'
export default { export default {
...@@ -80,12 +83,15 @@ export default { ...@@ -80,12 +83,15 @@ export default {
return { return {
searchCondition: { searchCondition: {
manufacturer: '', manufacturer: '',
content: '' activityTitle: ''
}, },
eventBus: null, eventBus: null,
pageNum: 1, page: {
pageSize: 10, pageNum: 1,
total: 10, pageSize: 10,
total: 10
},
com_value: {},
/* 组件params-start */ /* 组件params-start */
updateVisible: false, updateVisible: false,
// updateParams: this.$deep_clone(channelStructrue), // updateParams: this.$deep_clone(channelStructrue),
...@@ -143,10 +149,10 @@ export default { ...@@ -143,10 +149,10 @@ export default {
} }
} }
}, },
{ // {
label: '触发次数', // label: '触发次数',
prop: 'triCount' // prop: 'triCount'
}, // },
{ {
label: '操作人', label: '操作人',
prop: 'updatedBy' prop: 'updatedBy'
...@@ -168,22 +174,22 @@ export default { ...@@ -168,22 +174,22 @@ export default {
{ {
label: '上架', label: '上架',
type: 'text', type: 'text',
formatter: row => { formatter: rows =>
return row.status === { ON: '上架', OF: '下架' }[+row.status] rows.status === { ON: '上架', OF: '下架' }[rows.status],
}, callback: (index, rows) => {
callback: (index, row) => { const { id, status } = rows[index]
this.$confirm( this.$confirm(
`确定${ `确定${{ ON: '下架', OF: '上架' }[status]}该活动?`,
{ ON: '上架', OF: '下架' }[+row[index].status]
}该活动?`,
'', '',
{ {
type: 'warning' type: 'warning'
} }
) )
.then(() => { .then(() => {
this.tableLoading = true this.updateActivity({
// this.carServerUpdate(this.$deep_clone(row), 'moduleStatus') id,
status: { ON: 'OF', OF: 'ON' }[status]
})
}) })
.catch(err => console.log(err)) .catch(err => console.log(err))
} }
...@@ -201,8 +207,10 @@ export default { ...@@ -201,8 +207,10 @@ export default {
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
this.tableLoading = true this.updateActivity({
this.deleteChannel(rows[index].id) id: rows[index].id,
deletedFlag: 'true'
})
}) })
.catch(err => this.error(err)) .catch(err => this.error(err))
} }
...@@ -213,78 +221,68 @@ export default { ...@@ -213,78 +221,68 @@ export default {
} }
}, },
mounted() { mounted() {
this.getList() this.getList(this.page)
this.eventBus = new Vue() this.eventBus = new Vue()
this.eventBus.$on('refresh_list', () => {
this.loadingGetList()
this.updateVisible = false
})
}, },
methods: { methods: {
loadingGetList() { loadingGetList() {
this.tableLoading = true this.getParams().then(__p => {
this.getList() this.getList(Object.assign(__p, this.page))
})
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams() { getParams() {
return Object.assign( return new Promise((resolve, reject) => {
{ var __p = { condition: {}}
pageNum: this.pageNum, const { manufacturers } = this.com_value
pageSize: this.pageSize try {
}, if (manufacturers && manufacturers.manufacturer) {
this.searchCondition __p.condition.manufacturerId = manufacturers.merchantId
) }
if (this.searchCondition.activityTitle) {
__p.condition.activityTitle = this.searchCondition.activityTitle
}
resolve(__p)
} catch (error) {
console.log(error)
reject(error)
}
})
}, },
getList() { getList(p) {
const params = this.getParams() this.tableLoading = true
// params = deleteEmptyAttribute(params)
voiceList voiceList
.req(params) .req(p)
.then(res => { .then(res => {
this.total = res.total this.page.total = res.total
this.tableData.data = res.list this.tableData.data = res.list
this.tableLoading = false
}) })
.catch(err => { .catch(err => {
this.tableLoading = false
this.error(err) this.error(err)
}) })
.finally(() => {
this.tableLoading = false
})
}, },
updateChannel(params) { updateActivity(param) {
// updateChannel this.tableLoading = true
// .req(params) mergeActivity
// .then(res => { .req(param)
// notice.okTips() .then(res => {
// this.loadingGetList() this.success()
// this.updateVisibleChange() this.loadingGetList()
// }) })
// .catch(err => { .catch(err => {
// this.updateLoading = false console.log(err)
// notice.errorTips(err) this.error()
// }) })
}, .finally(() => {
deleteChannel(params) { this.tableLoading = false
// deleteChannel })
// .req({ id: params })
// .then(res => {
// notice.okTips(res)
// this.loadingGetList()
// })
// .catch(err => {
// notice.errorTips(err)
// })
},
channelLog(params) {
// this.recordVisibleChange()
// channelLog
// .req({ channelId: params })
// .then(res => {
// // notice.okTips(res)
// this.recordTable.list = res.list
// this.recordTable.total = res.total
// this.recordLoading = false
// // console.log(this.recordTable)
// // this.recordVisibleChange()
// })
// .catch(err => {
// notice.errorTips(err)
// })
}, },
getManufacturer() { getManufacturer() {
manufacturers manufacturers
...@@ -297,31 +295,19 @@ export default { ...@@ -297,31 +295,19 @@ export default {
this.loadingGetList() this.loadingGetList()
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.pageSize = val this.page.pageSize = val
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.pageNum = val this.page.pageNum = val
this.loadingGetList() this.loadingGetList()
}, },
updateVisibleChange() {
this.updateVisible = !this.updateVisible
this.updateLoading = false
// if(!this.updateVisible) {
// this.allModulelist = []
// this.updateParams = this.$deep_clone(channelStructrue)
// }
},
dialog(index, rows) { dialog(index, rows) {
this.updateVisible = true this.updateVisible = true
this.eventBus.$emit('edit_event_data', rows ? rows[index] : null) this.eventBus.$emit('edit_event_data', rows ? rows[index] : null)
}, },
updateDialogClose(updateData) { updateDialogClose() {
this.updateLoading = true this.updateVisible = false
updateData ? this.updateChannel(updateData) : this.updateVisibleChange()
},
recordVisibleChange() {
this.recordVisible = !this.recordVisible
} }
} }
} }
...@@ -334,5 +320,8 @@ export default { ...@@ -334,5 +320,8 @@ export default {
padding: 5px 10px; padding: 5px 10px;
} }
} }
.el-dialog {
margin-top: 3vh !important;
}
} }
</style> </style>
...@@ -21,13 +21,16 @@ module.exports = { ...@@ -21,13 +21,16 @@ module.exports = {
}, },
devServer: { devServer: {
port: 8085, port: 8085,
host: '192.168.2.36', host: '0.0.0.0',
open: true, // open: process.platform === '192.168.0.21',
proxy: { proxy: {
'/api': { '/api': {
target: 'http://127.0.0.1:8080', target: 'http://192.168.0.21:8080',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^/api': '' } pathRewrite: {
'^/api': ''
},
ws: false
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!