Commit bd30008c by wangql
2 parents 53211b11 130a78c0
......@@ -2908,6 +2908,16 @@
"integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",
"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": {
"version": "1.2.3",
"resolved": "http://registry.npm.taobao.org/clipboardy/download/clipboardy-1.2.3.tgz",
......@@ -3893,6 +3903,11 @@
"resolved": "http://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz",
"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": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/delegates/download/delegates-1.0.0.tgz",
......@@ -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": {
"version": "4.1.11",
"resolved": "http://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.1.11.tgz",
......@@ -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": {
"version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/select-hose/download/select-hose-2.0.0.tgz",
......@@ -11442,6 +11470,11 @@
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=",
"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": {
"version": "0.0.33",
"resolved": "http://registry.npm.taobao.org/tmp/download/tmp-0.0.33.tgz",
......@@ -12010,6 +12043,11 @@
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"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": {
"version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/vendors/download/vendors-1.0.2.tgz",
......@@ -12040,6 +12078,14 @@
"resolved": "http://registry.npm.taobao.org/vue/download/vue-2.5.17.tgz",
"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": {
"version": "2.0.3",
"resolved": "http://registry.npm.taobao.org/vue-eslint-parser/download/vue-eslint-parser-2.0.3.tgz",
......
......@@ -13,9 +13,9 @@
"glsx-vue-components": "^1.0.13",
"node-sass": "^4.9.3",
"sass-loader": "^7.1.0",
"vee-validate": "^2.1.5",
"vee-validate": "^2.1.7",
"vue": "^2.5.17",
"vue-i18n": "^8.7.0"
"vue-clipboard2": "^0.2.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1",
......
......@@ -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'
})
}
/**
......@@ -19,7 +26,12 @@ const voiceList = {
*/
const manufacturers = {
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 = {
*/
const merchants = {
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 {
voiceList,
manufacturers,
merchants
merchants,
addActivity,
mergeActivity,
searchActivity,
searchCoupon
}
......@@ -4,18 +4,35 @@ import Vue from 'vue'
import GlsxVueComponents from 'glsx-vue-components'
import 'glsx-vue-components/dist/glsx-vue-components.css'
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 VueI18n from 'vue-i18n'
Vue.use(VueI18n)
const i18n = new VueI18n({
locale: 'zh_CN'
})
import VueClipboard2 from 'vue-clipboard2'
// const {
// Validator
// } = VeeValidate
// import VueI18n from 'vue-i18n'
// Vue.use(VueI18n)
// const i18n = new VueI18n({
// locale: 'zh_CN'
// })
Vue.use(VueClipboard2)
Vue.use(VeeValidate, {
i18n,
i18nRootKey: 'validation',
// i18n,
// i18nRootKey: 'validation',
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',
fieldsBagName: 'fieldBags',
......@@ -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') => {
return new Promise(resolve => {
const xhr = new XMLHttpRequest()
......
......@@ -7,12 +7,12 @@
placeholder="请选择品牌厂商"
name="manufacturerId"
data-vv-as="品牌厂商"
v-validate="'required'"
v-validate="!manufactureOnly && 'required'"
:style="{'width':(in_row?width:'100%')}"
>
<gl-option
v-for="item in manufacturer_list"
:key="item.manufacturer"
:key="item.manufacturerName"
:label="item.manufacturerName"
:value="item.manufacturer"
/>
......@@ -40,7 +40,7 @@
>
<gl-option
v-for="item in merchant_list"
:key="item.merchantId"
:key="item.merchantName"
:label="item.merchantName"
:value="item.merchantId"
/>
......@@ -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 = []
const manufacturer_list_back_up = [
{
manufacturer: null,
manufacturerName: '请选择品牌厂商',
merchantId: 0,
merchantName: ''
}
]
const merchant_list_back_up = [
{
merchantId: null,
merchantName: '请选择渠道商',
merchantStatus: 0,
merchantType: 401
}
]
export default {
name: 'Manufacturers',
mixins: [NoticeMixin],
......@@ -138,26 +152,40 @@ export default {
manufactureOnly: Boolean,
in_row: Boolean,
uploadAction: String,
default_value: Object
default_value: Object,
value: Object
// id: String
// errorBags: Object
},
watch: {
eventBus: {
handler(__eventBus) {
__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]
this.result.merchants = this.merchant_list.filter(
obj => this.model.merchantId === obj.merchantId
)[0]
// this.$emit('update:value', this.result)
callback && callback(this.result) && (callback = null)
})
if (__eventBus) {
// __eventBus.$on('submit', callback => {
// this.$validator.validate().then(result => {
// this.result.manufacturers = this.manufacturer_list.filter(
// obj => this.model.manufacturerId === obj.manufacturer
// )[0]
// 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__)
// // 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
// this.eventBus.$emit('manufacturerChanged', val)
......@@ -167,17 +195,53 @@ export default {
__sAction && (this.action = __sAction)
},
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() {
return {
value: '',
action: '',
template_url:
'http://qcimg01.glsx.net:7060/ddh-ai-m/AI管家-灰度用户导入模板.XLSX',
manufacturer_list: [],
merchant_list: [],
grayscaleUserList: [
users: [
{ label: '全量', value: 'ALL' },
{ label: '指定用户(灰度)', value: 'LIST' }
],
......@@ -197,33 +261,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)
)
.req({ pageNum: 1, pageSize: 999 })
.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
)
.req({ merchantType: 401 })
.then(res => resolve(res))
.catch(err => reject(err))
})
},
......@@ -232,10 +286,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,30 +303,50 @@ 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)
},
__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() {
if (this.default_value) {
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
// 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 => {
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>
......
import App from './index.vue'
import base from '@/base'
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 => {
const { vue, config } = data
const {
vue,
config
} = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
......@@ -8,16 +8,73 @@
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"
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-col>
<gl-col
<!-- <gl-col
:span="2"
class="transfer__col"
>
......@@ -39,8 +96,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 +105,7 @@
ref="checkedTable"
></gl-table>
</gl-card>
</gl-col>
</gl-col> -->
</gl-row>
<div
slot="footer"
......@@ -66,37 +123,57 @@
</template>
<script>
import { searchCoupon } from '@/api'
import { NoticeMixin } from '@/mixins'
export default {
name: 'Gift',
props: {
giftVisible: Boolean,
eventBus: Object
},
mixins: [NoticeMixin],
watch: {
eventBus(__eventBus) {
if (__eventBus) {
__eventBus.$on('checked_gift', value => {
this.checked = value
})
}
}
},
data() {
return {
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: {
highlightCurrentRow: true,
rowClick: (row, event, column) => {
const { id, name, type } = row
this.checked = {
giftId: id,
giftName: name,
giftType: type
}
},
selectionChange: this.handleGiftTableSelectionChange,
height: 400,
height: 330,
border: true,
data: [
{
name: '嘀嘀虎1',
id: '001'
},
{
name: '嘀嘀虎2',
id: '002'
},
{
name: '嘀嘀虎3',
id: '003'
},
{
name: '嘀嘀虎4',
id: '004'
}
],
data: [],
column: [
{
label: '优惠券编号',
......@@ -107,8 +184,8 @@ export default {
label: '优惠券名称',
prop: 'name'
}
],
selection: []
]
// selection: []
},
checkedTable: {
height: 400,
......@@ -130,13 +207,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 +281,7 @@ export default {
)
},
handleSubmit() {
this.eventBus.$emit('submitGift', this.checkedTable.data)
this.eventBus.$emit('submitGift', this.checked)
}
}
}
......@@ -197,5 +312,15 @@ export default {
.el-transfer__buttons {
padding: 0;
}
.gift-info {
margin: 4px;
.el-tag--success {
width: 100%;
text-align: center;
}
}
.current-row {
color: #865b10;
}
}
</style>
\ No newline at end of file
......@@ -5,16 +5,20 @@
: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'
:value.sync="com_value"
/>
</gl-form-item>
<gl-form-item>
<gl-button
......@@ -26,7 +30,7 @@
<gl-button
class="newButton"
type="primary"
@click="dialog"
@click="dialog(null,null)"
>添加活动</gl-button>
</gl-form-item>
</gl-form>
......@@ -47,11 +51,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>
......@@ -60,8 +64,7 @@
<script>
import Edit from './Edit'
import { Manufacturers } from '../components'
// import { fn, treeCheckKeys, deleteEmptyAttribute } from '@/common/common'
import { voiceList, manufacturers } from '@/api'
import { voiceList, manufacturers, mergeActivity } from '@/api'
import { NoticeMixin } from '@/mixins'
import Vue from 'vue'
export default {
......@@ -80,12 +83,15 @@ export default {
return {
searchCondition: {
manufacturer: '',
content: ''
activityTitle: ''
},
eventBus: null,
pageNum: 1,
pageSize: 10,
total: 10,
page: {
pageNum: 1,
pageSize: 10,
total: 10
},
com_value: {},
/* 组件params-start */
updateVisible: false,
// updateParams: this.$deep_clone(channelStructrue),
......@@ -143,10 +149,10 @@ export default {
}
}
},
{
label: '触发次数',
prop: 'triCount'
},
// {
// label: '触发次数',
// prop: 'triCount'
// },
{
label: '操作人',
prop: 'updatedBy'
......@@ -168,22 +174,22 @@ export default {
{
label: '上架',
type: 'text',
formatter: row => {
return row.status === { ON: '上架', OF: '下架' }[+row.status]
},
callback: (index, row) => {
formatter: rows =>
rows.status === { ON: '上架', OF: '下架' }[rows.status],
callback: (index, rows) => {
const { id, status } = rows[index]
this.$confirm(
`确定${
{ ON: '上架', OF: '下架' }[+row[index].status]
}该活动?`,
`确定${{ ON: '下架', OF: '上架' }[status]}该活动?`,
'',
{
type: 'warning'
}
)
.then(() => {
this.tableLoading = true
// this.carServerUpdate(this.$deep_clone(row), 'moduleStatus')
this.updateActivity({
id,
status: { ON: 'OF', OF: 'ON' }[status]
})
})
.catch(err => console.log(err))
}
......@@ -201,8 +207,10 @@ export default {
type: 'warning'
})
.then(() => {
this.tableLoading = true
this.deleteChannel(rows[index].id)
this.updateActivity({
id: rows[index].id,
deletedFlag: 'true'
})
})
.catch(err => this.error(err))
}
......@@ -213,78 +221,68 @@ export default {
}
},
mounted() {
this.getList()
this.getList(this.page)
this.eventBus = new Vue()
this.eventBus.$on('refresh_list', () => {
this.loadingGetList()
this.updateVisible = false
})
},
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, reject) => {
var __p = { condition: {}}
const { manufacturers } = this.com_value
try {
if (manufacturers && manufacturers.manufacturer) {
__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() {
const params = this.getParams()
// params = deleteEmptyAttribute(params)
getList(p) {
this.tableLoading = true
voiceList
.req(params)
.req(p)
.then(res => {
this.total = res.total
this.page.total = res.total
this.tableData.data = res.list
this.tableLoading = false
})
.catch(err => {
this.tableLoading = false
this.error(err)
})
.finally(() => {
this.tableLoading = false
})
},
updateChannel(params) {
// updateChannel
// .req(params)
// .then(res => {
// notice.okTips()
// this.loadingGetList()
// this.updateVisibleChange()
// })
// .catch(err => {
// this.updateLoading = false
// notice.errorTips(err)
// })
},
deleteChannel(params) {
// 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)
// })
updateActivity(param) {
this.tableLoading = true
mergeActivity
.req(param)
.then(res => {
this.success()
this.loadingGetList()
})
.catch(err => {
console.log(err)
this.error()
})
.finally(() => {
this.tableLoading = false
})
},
getManufacturer() {
manufacturers
......@@ -297,31 +295,19 @@ 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() {
this.updateVisible = !this.updateVisible
this.updateLoading = false
// if(!this.updateVisible) {
// this.allModulelist = []
// this.updateParams = this.$deep_clone(channelStructrue)
// }
},
dialog(index, rows) {
this.updateVisible = true
this.eventBus.$emit('edit_event_data', rows ? rows[index] : null)
},
updateDialogClose(updateData) {
this.updateLoading = true
updateData ? this.updateChannel(updateData) : this.updateVisibleChange()
},
recordVisibleChange() {
this.recordVisible = !this.recordVisible
updateDialogClose() {
this.updateVisible = false
}
}
}
......@@ -334,5 +320,8 @@ export default {
padding: 5px 10px;
}
}
.el-dialog {
margin-top: 3vh !important;
}
}
</style>
......@@ -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!