Commit b06f9296 by liimin

xiugai

1 parent 082859f1
......@@ -11,7 +11,11 @@ import {
import {
voiceList,
manufacturers,
merchants
merchants,
addActivity,
mergeActivity,
searchActivity,
searchCoupon
} from './voice'
export {
......@@ -24,5 +28,9 @@ export {
getExp,
mergeExp,
addBg,
mergeBg
mergeBg,
addActivity,
mergeActivity,
searchActivity,
searchCoupon
}
import {
GlAxios
} from 'glsx-vue-common'
const path = '/admin-ddh-aimanager/voice/activity'
const __sVoiceList = `${path}/get`
const __sGetManufacturer = `/admin-ddh-aimanager/manufacturer/search`
const __sGetMerchant = `/admin-ddh-aimanager/merchant/search`
const path = '/admin-ddh-aimanager'
const __sVoiceList = `${path}/voice/activity/search`
const __sGetManufacturer = `${path}/manufacturer/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 = {
p: [__sVoiceList],
req: params => GlAxios.post(__sVoiceList, {
params
req: params => GlAxios.post(__sVoiceList, params, {
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
requestType: 'jsonString'
})
}
/**
......@@ -30,8 +37,47 @@ const merchants = {
req: params => GlAxios.get(__sGetMerchant, params)
}
/**
* 添加语音活动
*/
const addActivity = {
p: [__sAdd],
req: params => GlAxios.post(__sAdd, {
params
})
}
/**
* 修改语音活动
*/
const mergeActivity = {
p: [__sMerge],
req: params => GlAxios.post(__sMerge, {
params
})
}
/**
* 查询语音活动
*/
const searchActivity = {
p: [__sSearch],
req: params => GlAxios.post(__sSearch, {
params
})
}
/**
* 查询语音活动
*/
const searchCoupon = {
p: [__sCouponSearch],
req: params => GlAxios.get(__sCouponSearch, params)
}
export {
voiceList,
manufacturers,
merchants
merchants,
addActivity,
mergeActivity,
searchActivity,
searchCoupon
}
......@@ -47,7 +47,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') => {
return new Promise(resolve => {
const xhr = new XMLHttpRequest()
......
......@@ -7,7 +7,7 @@
placeholder="请选择品牌厂商"
name="manufacturerId"
data-vv-as="品牌厂商"
v-validate="'required'"
v-validate="!manufactureOnly && 'required'"
:style="{'width':(in_row?width:'100%')}"
>
<gl-option
......@@ -67,7 +67,7 @@
v-validate="'required'"
>
<gl-option
v-for="item in grayscaleUserList"
v-for="item in users"
:key="item.value"
:label="item.label"
:value="item.value"
......@@ -103,7 +103,7 @@
size="small"
type="primary"
plain
>添加动效音频<i class="el-icon-upload el-icon--right"></i></gl-button>
>上传灰度用户<i class="el-icon-upload el-icon--right"></i></gl-button>
<div
slot="tip"
class="el-upload__tip"
......@@ -127,8 +127,22 @@
<script>
import { manufacturers, merchants, grayscaleuser } from '@/api'
import { NoticeMixin } from '@/mixins'
let manufacturer_list_back_up = []
let merchant_list_back_up = []
let manufacturer_list_back_up = [
{
manufacturer: null,
manufacturerName: '请选择品牌厂商',
merchantId: 0,
merchantName: ''
}
]
let merchant_list_back_up = [
{
merchantId: null,
merchantName: '请选择渠道商',
merchantStatus: 0,
merchantType: 401
}
]
export default {
name: 'Manufacturers',
mixins: [NoticeMixin],
......@@ -144,10 +158,9 @@ export default {
watch: {
eventBus: {
handler(__eventBus) {
__eventBus &&
if (__eventBus) {
__eventBus.$on('submit', callback => {
this.$validator.validateAll().then(result => {
// __eventBus.$emit('manufacturers', this.model)
this.result.manufacturers = this.manufacturer_list.filter(
obj => this.model.manufacturerId === obj.manufacturer
)[0]
......@@ -155,9 +168,16 @@ export default {
obj => this.model.merchantId === obj.merchantId
)[0]
this.$emit('update:value', this.result)
callback && callback()
callback && callback(this.result)
})
}),
__eventBus.$on('clear_error', () => {
this.$validator.errors.clear()
})
__eventBus.$on('reset', () => {
this.reset()
})
}
},
immediate: true
//this.eventBus.$emit('manufacturerChanged', val)
......@@ -177,7 +197,7 @@ export default {
'http://qcimg01.glsx.net:7060/ddh-ai-m/AI管家-灰度用户导入模板.XLSX',
manufacturer_list: [],
merchant_list: [],
grayscaleUserList: [
users: [
{ label: '全量', value: 'ALL' },
{ label: '指定用户(灰度)', value: 'LIST' }
],
......@@ -197,33 +217,23 @@ export default {
methods: {
get_manufacturer_list() {
return new Promise((resolve, reject) => {
if (manufacturer_list_back_up.length) {
// this.manufacturer_list = manufacturer_list_back_up
if (manufacturer_list_back_up.length > 1) {
resolve(manufacturer_list_back_up)
}
manufacturers
.req({})
.then(res =>
// manufacturer_list_back_up = this.manufacturer_list = res
// this.model.manufacturerId = this.default_value.manufacturerId
resolve(res)
)
.then(res => resolve(res))
.catch(err => reject(err))
})
},
get_merchant_list() {
return new Promise((resolve, reject) => {
if (merchant_list_back_up.length) {
// this.merchant_list = merchant_list_back_up
if (merchant_list_back_up.length > 1) {
resolve(merchant_list_back_up)
}
merchants
.req({ merchantType: 401, merchantStatus: 0 })
.then(
res => resolve(res)
// merchant_list_back_up = this.merchant_list = res
// this.model.merchantId = this.default_value.merchantId
)
.then(res => resolve(res))
.catch(err => reject(err))
})
},
......@@ -232,10 +242,8 @@ export default {
const { savePath } = res.data
grayscaleuser
.req({ grayscaleUserFilePath: savePath })
.then(res => {
this.model.grayscaleUserList = res
})
.catch(err => console.log(err))
.then(res => (this.result.grayscaleUserList = res))
.catch(err => this.error(err))
},
// 限制用户上传的灰度用户文件格式和大小
beforeUpload_grayscaleuser(file) {
......@@ -251,6 +259,18 @@ export default {
},
onRemove_grayscaleuser() {
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)
}
},
created() {
......@@ -265,16 +285,16 @@ export default {
* [{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]
Promise.all([this.get_manufacturer_list(), this.get_merchant_list()])
.then(result => {
this.manufacturer_list = manufacturer_list_back_up.concat(result[0])
this.merchant_list = merchant_list_back_up.concat(result[1])
if (this.default_value) {
this.model.merchantId = this.default_value.merchantId
this.model.manufacturerId = this.default_value.manufacturerId
}
}
)
})
.catch(err => this.error(err))
}
}
</script>
......
......@@ -10,7 +10,6 @@
<gl-form
:model="editForm"
label-width="120px"
:rules="updateRules"
>
<gl-form-item
label="活动标题:"
......@@ -108,6 +107,8 @@
<gl-input-number
v-model="editForm.count"
:min="1"
controls-position="right"
:disabled="true"
label="触发次数"
></gl-input-number>
</gl-form-item>
......@@ -228,29 +229,26 @@ import Vue from 'vue'
import Gift from './gift'
const form_init = {
activityTitle: '', // 活动标题
manufacturer: '', // 品牌厂商
grayscaleUserList: '', // 用户
activityForm: 'GIFT',
activityReply: '', // 活动回复语
activityTip: '', // 活动提示语
beginTime: '',
endTime: '',
manufacturer: '', // 品牌厂商
grayscaleUserList: [], // 用户
id: '',
influenceScope: 'ALL',
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 {
......@@ -269,37 +267,67 @@ export default {
eventBus(val) {
if (val) {
this.eventBus.$on('giftDialogClose', () => (this.giftVisible = false))
this.eventBus.$on(
'manufacturerChanged',
value => (this.editForm.manufacturer = value)
)
//礼品优惠券弹出框提交后 更新数据
this.eventBus.$on('submitGift', value => {
this.coupons.data = value
const { name, id, type } = value
this.setCouponsData({
giftType: type,
giftName: name,
giftId: id
})
this.giftVisible = false
})
this.eventBus.$on('edit_event_data', data => {
this.title = data ? '编辑活动' : '新增活动'
if (!data) {
this.editForm = this.$deep_clone(form_init)
this.$validator.errors.clear()
return
//新增活动
this.editForm = this.$deep_clone(form_init) //拷贝初始化数据
delete this.editForm.id //删除id
this.eventBus.$emit('reset') //广播 ---- 清空 组件 数据
} else {
//编辑活动
const __clone = this.$deep_clone(data) // 拷贝列表传入数据
this.editForm = __clone
const {
manufacturerId,
merchantId,
influenceScope,
grayscaleUserList,
endTime,
beginTime,
activityConfig
} = __clone
this.default_value = {
//设置组件默认值
manufacturerId,
merchantId,
influenceScope,
grayscaleUserList
}
this.editForm.time = [beginTime, endTime] //设置时间
this.editForm.count = this.editForm.count || 1 //触发次数暂时没有 默认 1 触发次数暂时不能选择
this.setCouponsData(this.$deep_clone(JSON.parse(activityConfig)))
}
const __clone = this.$deep_clone(data)
this.editForm = __clone
this.editForm.time = [__clone.beginTime, __clone.endTime]
this.$validator.errors.clear()
setTimeout(() => {
this.eventBus.$emit('clear_error') //
}, 100)
})
// this.eventBus.$on(
// 'manufacturers',
// result => (this.editForm.manufacturer = result)
// )
this.eventBus.$on('clear_error', () => this.$validator.errors.clear()) //箭头事件 清除页面错误信息
}
}
// 'editForm.activityConfig.giftId': {
// handle(val) {
// const { giftName, giftId, giftType } = this.editForm.activityConfig
// this.coupons.data = [{ giftName, giftId, giftType }]
// },
// immediate: true
// }
},
data() {
return {
//弹出框标题
title: '',
manufacturerShow: false,
//子组件默认值
default_value: {
// // merchantId: 19180001,
// manufacturerId: 10012,
......@@ -307,61 +335,39 @@ export default {
// influenceScope: 'LIST',
// grayscaleuser: ['11']
},
//触发类型
tipType: {
BUBBLING: true,
DIALOGUE: false,
BOTH: false
BUBBLING: true, //冒泡
DIALOGUE: false, //对话
BOTH: false //对话和冒泡
},
pickerOptions: {}, // 日期设置对象
// 提交参数
editForm: {},
updateRules: {
channelName: [{ required: true }],
merchantId: [{ required: true }],
channelUrl: [{ required: true }],
moduleList: [{ required: true }]
},
uploadAction: '',
uploadAction: '', //文件上传地址
giftVisible: false,
contents: [
//活动内容下拉框选项
{ label: '关联礼品', value: 'GIFT' },
{ label: '关联瀑布特效', value: 'DYNAMIC_EFFECT' },
{ label: '关联礼品+瀑布特效', value: 'GIFT_DYNAMIC' }
],
coupons: {
height: 122,
//礼物表格 目前只能选择一个礼物
height: 50,
border: true,
data: [
{
name: '嘀嘀虎1',
id: '001'
},
{
name: '嘀嘀虎2',
id: '002'
},
{
name: '嘀嘀虎3',
id: '003'
},
{
name: '嘀嘀虎4',
id: '004'
}
],
data: [],
column: [
{
label: '优惠券编号',
prop: 'id',
prop: 'giftId',
width: '180'
},
{
label: '优惠券名称',
prop: 'name'
prop: 'giftName'
}
],
selection: {},
multipleSelection: []
]
}
}
},
......@@ -372,14 +378,13 @@ export default {
// this.eventBus = new Vue()
},
methods: {
handleModuleChange(params, checked) {
// console.log(checked.checkedKeys)
this.editForm.moduleList = checked.checkedKeys
},
//提交数据
handleSubmit() {
this.eventBus.$emit('submit')
this.$validator.validateAll().then(result => {
console.log(this.editForm.manufacturer)
//发出提交事件广播 组件触发验证 并回调传入验证后的数据
this.eventBus.$emit('submit', data => {
this.$validator.validateAll().then(result => {
console.log(this.editForm)
})
})
},
handleClose() {
......@@ -387,6 +392,14 @@ export default {
},
addGift() {
this.giftVisible = true
},
setCouponsData(data) {
console.log(data)
const { giftName, giftId, giftType } = data
this.editForm.activityConfig.giftName = giftName
this.editForm.activityConfig.giftId = giftId
this.editForm.activityConfig.giftType = giftType
this.coupons.data = [this.editForm.activityConfig]
}
}
}
......
......@@ -8,16 +8,66 @@
width='800px '
>
<gl-row>
<gl-col :span="11">
<gl-col :span="24">
<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
:table="giftTable"
ref="giftTable"
v-loading="tableLoading"
></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">已选择优惠券编号:{{checked.id}} 名称:{{checked.name}}</gl-tag>
</gl-col>
</gl-row>
</gl-card>
</gl-col>
<gl-col
<!-- <gl-col
:span="2"
class="transfer__col"
>
......@@ -39,8 +89,8 @@
@click="handleDisSelectGift"
></gl-button>
</div>
</gl-col>
<gl-col :span="11">
</gl-col> -->
<!-- <gl-col :span="12">
<gl-card shadow="always">
已选择活动礼品
<gl-table
......@@ -48,7 +98,7 @@
ref="checkedTable"
></gl-table>
</gl-card>
</gl-col>
</gl-col> -->
</gl-row>
<div
slot="footer"
......@@ -66,18 +116,41 @@
</template>
<script>
import { searchCoupon } from '@/api'
import { NoticeMixin } from '@/mixins'
export default {
name: 'Gift',
props: {
giftVisible: Boolean,
eventBus: Object
},
mixins: [NoticeMixin],
data() {
return {
submiting: false,
tableLoading: false,
checked: { id: 274, name: '3.98优惠券', type: 1 },
searchCondition: {
name: '',
type: ''
},
page: {
pageNum: 1,
pageSize: 10,
total: 10
},
types: [
{ name: '抵扣券', value: 1 },
{ name: '折扣券', value: 2 },
{ name: '流量', value: 3 }
],
giftTable: {
highlightCurrentRow: true,
rowClick: (row, event, column) => {
this.checked = row
},
selectionChange: this.handleGiftTableSelectionChange,
height: 400,
height: 330,
border: true,
data: [
{
......@@ -107,8 +180,8 @@ export default {
label: '优惠券名称',
prop: 'name'
}
],
selection: []
]
// selection: []
},
checkedTable: {
height: 400,
......@@ -130,13 +203,51 @@ export default {
label: '优惠券名称',
prop: 'name'
}
],
selection: []
]
// selection: []
}
}
},
mounted() {},
mounted() {
this.getList(this.page)
},
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() {
this.eventBus.$emit('giftDialogClose')
},
......@@ -166,7 +277,7 @@ export default {
)
},
handleSubmit() {
this.eventBus.$emit('submitGift', this.checkedTable.data)
this.eventBus.$emit('submitGift', this.checked)
}
}
}
......@@ -197,5 +308,14 @@ export default {
.el-transfer__buttons {
padding: 0;
}
.gift-info {
margin: 4px;
.el-tag--success {
width: 100%;
}
}
.current-row {
color: #865b10;
}
}
</style>
\ No newline at end of file
......@@ -5,16 +5,19 @@
:inline="true"
:model="searchCondition"
>
<gl-form-item>
<gl-form-item label="活动主题:">
<gl-input
v-model="searchCondition.content"
v-model="searchCondition.activityTitle"
class="input-with-select"
placeholder="请输入活动主题"
clearable
/>
</gl-form-item>
<gl-form-item>
<Manufacturers :manufactureOnly="true" />
<Manufacturers
:manufactureOnly="true"
:eventBus='eventBus'
/>
</gl-form-item>
<gl-form-item>
<gl-button
......@@ -26,7 +29,7 @@
<gl-button
class="newButton"
type="primary"
@click="dialog"
@click="dialog(null,null)"
>添加活动</gl-button>
</gl-form-item>
</gl-form>
......@@ -47,11 +50,11 @@
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNum"
:current-page="page.pageNum"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:page-size="page.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
:total="page.total"
>
</gl-pagination>
</div>
......@@ -80,12 +83,14 @@ export default {
return {
searchCondition: {
manufacturer: '',
content: ''
activityTitle: ''
},
eventBus: null,
pageNum: 1,
pageSize: 10,
total: 10,
page: {
pageNum: 1,
pageSize: 10,
total: 10
},
/* 组件params-start */
updateVisible: false,
// updateParams: this.$deep_clone(channelStructrue),
......@@ -168,13 +173,12 @@ export default {
{
label: '上架',
type: 'text',
formatter: row => {
return row.status === { ON: '上架', OF: '下架' }[+row.status]
},
callback: (index, row) => {
formatter: row =>
row.status === { ON: '上架', OF: '下架' }[row.status],
callback: (index, row) =>
this.$confirm(
`确定${
{ ON: '上架', OF: '下架' }[+row[index].status]
{ ON: '上架', OF: '下架' }[row[index].status]
}该活动?`,
'',
{
......@@ -183,10 +187,8 @@ export default {
)
.then(() => {
this.tableLoading = true
// this.carServerUpdate(this.$deep_clone(row), 'moduleStatus')
})
.catch(err => console.log(err))
}
},
{
type: '',
......@@ -213,31 +215,36 @@ export default {
}
},
mounted() {
this.getList()
this.getList(this.page)
this.eventBus = new Vue()
},
methods: {
loadingGetList() {
this.tableLoading = true
this.getList()
this.getParams().then(__p => {
this.getList(Object.assign(__p, this.page))
})
},
/* 接口请求-start */
getParams() {
return Object.assign(
{
pageNum: this.pageNum,
pageSize: this.pageSize
},
this.searchCondition
)
return new Promise(resolve => {
var __p = { condition: {} }
this.eventBus.$emit('submit', data => {
if (data.manufacturers) {
__p.condition.manufacturerId = data.manufacturers.manufacturerId
}
if (this.searchCondition.activityTitle) {
__p.condition.activityTitle = this.searchCondition.activityTitle
}
resolve(__p)
})
})
},
getList() {
const params = this.getParams()
// params = deleteEmptyAttribute(params)
getList(p) {
voiceList
.req(params)
.req(p)
.then(res => {
this.total = res.total
this.page.total = res.total
this.tableData.data = res.list
this.tableLoading = false
})
......@@ -270,22 +277,6 @@ export default {
// 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() {
manufacturers
.req({})
......@@ -297,11 +288,11 @@ export default {
this.loadingGetList()
},
handleSizeChange(val) {
this.pageSize = val
this.page.pageSize = val
this.loadingGetList()
},
handleCurrentChange(val) {
this.pageNum = val
this.page.pageNum = val
this.loadingGetList()
},
updateVisibleChange() {
......
......@@ -21,13 +21,16 @@ module.exports = {
},
devServer: {
port: 8085,
host: '192.168.2.36',
open: true,
host: '0.0.0.0',
// open: process.platform === '192.168.0.21',
proxy: {
'/api': {
target: 'http://127.0.0.1:8080',
target: 'http://192.168.0.21:8080',
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!