Commit 2ca8dab3 by 李伟康

提交

1 parent bc284cd2
...@@ -56,6 +56,74 @@ export default { ...@@ -56,6 +56,74 @@ export default {
data: params data: params
}) })
}, },
/**
* /新建活动文件校验上传文件接口
*/
createCheckFile (params) {
params.method = 'marketing.api.activityRedEnvelope.createCheckFile'
return http({
url,
data: params
})
},
/**
* /编辑活动文件校验上传文件接口
*/
updateCheckFile (params) {
params.method = 'marketing.api.activityRedEnvelope.updateCheckFile'
return http({
url,
data: params
})
},
/** 红包配置列表导出 */
exportActivityRedEnvelope (params) {
params.method = 'marketing.api.activityRedEnvelope.export'
return http({
url,
data: params
})
},
/** 查询红包链接详情 */
getActivityRedEnvelopeLinkDetailPage (params) {
params.method = 'marketing.api.activityRedEnvelope.linkDetailPage'
return http({
url,
data: params
})
},
/**获取红包记录列表 */
getRedEnvelopeRecordList (params) {
params.method = 'marketing.api.activityRedEnvelope.record.page'
return http({
url,
data: params
})
},
/**
* /校验中奖记录导入
*/
checkImport (params) {
params.method = 'marketing.api.activityRedEnvelope.winningRecord.checkImport'
return http({
url,
data: params
})
},
/** 导入中奖记录 */
importRedEnvelopeRecord (params) {
params.method = 'marketing.api.activityRedEnvelope.winningRecord.import'
return http({
url,
data: params
})
},
} }
\ No newline at end of file \ No newline at end of file
...@@ -184,6 +184,14 @@ function exportFn (url) { ...@@ -184,6 +184,14 @@ function exportFn (url) {
iframe.src = url iframe.src = url
document.body.appendChild(iframe) document.body.appendChild(iframe)
} }
const activityStatusList = [
// 0:活动待进行;1:活动进行中;2:红包已用完;3:活动已结束
{ text: '全部', id: '' },
{ text: '活动待开始', id: 0 },
{ text: '活动进行中', id: 1 },
{ text: '红包已用完', id: 2 },
{ text: '活动已结束', id: 3 }
]
export { export {
limitPrice, limitPrice,
orderManageStatusList, orderManageStatusList,
...@@ -196,5 +204,6 @@ export { ...@@ -196,5 +204,6 @@ export {
orderTypesList, orderTypesList,
orderStatusList, orderStatusList,
exportFn, exportFn,
getExplorer getExplorer,
activityStatusList
} }
\ No newline at end of file \ No newline at end of file
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
:size="size" :size="size"
v-model="configForm.activityType" v-model="configForm.activityType"
style="width: 400px;" style="width: 400px;"
:disabled="disabled"
> >
<el-radio :label="0">随机红包</el-radio> <el-radio :label="0">随机红包</el-radio>
<el-radio :label="1">九宫格</el-radio> <el-radio :label="1">九宫格</el-radio>
...@@ -204,6 +205,7 @@ export default { ...@@ -204,6 +205,7 @@ export default {
id id
} }
this.disabled = true this.disabled = true
this.configRules.exportUrl[0].required = false
console.log(res) console.log(res)
} catch (error) { } catch (error) {
this.$message.error(error) this.$message.error(error)
...@@ -231,9 +233,9 @@ export default { ...@@ -231,9 +233,9 @@ export default {
handleConfirm () { handleConfirm () {
this.$refs.configRef.validate(async (valid) => { this.$refs.configRef.validate(async (valid) => {
if (valid) { if (valid) {
const { configForm, merchantList, disabled } = this const { configForm, merchantList } = this
let params = this.$common.utils.deepClone(configForm), let params = this.$common.utils.deepClone(configForm),
targetName = params.id ? 'updateActivityRedEnvelope' : 'createActivityRedEnvelope' targetName = params.id ? 'updateActivityRedEnvelope' : 'createActivityRedEnvelope'
params.activityStartTime = dayjs(params.activityTime[0]).format('YYYY-MM-DD') params.activityStartTime = dayjs(params.activityTime[0]).format('YYYY-MM-DD')
params.activityEndTime = dayjs(params.activityTime[1]).format('YYYY-MM-DD') params.activityEndTime = dayjs(params.activityTime[1]).format('YYYY-MM-DD')
params.merchantName = merchantList.find(e => e.confId == params.merchantId).confName params.merchantName = merchantList.find(e => e.confId == params.merchantId).confName
...@@ -241,20 +243,33 @@ export default { ...@@ -241,20 +243,33 @@ export default {
console.log(JSON.parse(JSON.stringify(params))) console.log(JSON.parse(JSON.stringify(params)))
const res = await this.$apis.redenvelope[targetName](params) const res = await this.$apis.redenvelope[targetName](params)
console.log(res) console.log(res)
if (res) {
this.$message({
message: params.id ? '编辑成功' : '创建成功',
type: 'success'
})
this.handleClose()
this.$parent.handleSearch()
}
else throw params.id ? '编辑失败' : '创建失败'
try { try {
} catch (error) { } catch (error) {
this.$message.error(error) this.$message.error(error)
} }
} else {
return false
} }
}) })
}, },
async uploadFile (e) { async uploadFile (e) {
const { id } = this.configForm,
target = id ? 'updateCheckFile' : 'createCheckFile'
try { try {
const res = await commonFun.uploadFile(e, this) const res = await commonFun.uploadFile(e, this),
this.configForm.exportUrl = res params = { exportUrl: res }
if (id) params.id = id
this.$refs.file.value = '' this.$refs.file.value = ''
const { failCount } = await this.$apis.redenvelope[target](params)
if (failCount && failCount > 0) return this.$message.error('红包链接导入失败')
this.configForm.exportUrl = res
} catch (error) { } catch (error) {
console.log(error) console.log(error)
if (error) this.$message.error(error) if (error) this.$message.error(error)
......
...@@ -28,18 +28,11 @@ ...@@ -28,18 +28,11 @@
<GLTable <GLTable
ref="listRef" ref="listRef"
:getListApi="getListApi" :getListApi="getListApi"
:searchForm="searchForm" :searchForm="tableSearchForm"
:noDataImg="url" :noDataImg="url"
:tableParams="tableParams" :tableParams="tableParams"
:pageConf="pageConf" :pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
> >
<div
slot-scope="scope"
slot="activityStatus"
>
{{ activityStatusList.find(e => e.id === scope.scope.activityStatus).text || '--' }}
</div>
<span <span
slot="auth-button" slot="auth-button"
slot-scope="scope" slot-scope="scope"
...@@ -52,13 +45,8 @@ ...@@ -52,13 +45,8 @@
</span> </span>
</GLTable> </GLTable>
</div> </div>
<link-detail :show.sync="showLinkDetail"></link-detail> <link-detail :linkDetailObj.sync="linkDetailObj"></link-detail>
<edit <edit :editObj.sync="editObj"></edit>
:editObj.sync="editObj"
></edit>
<!--
:title="editObj.title"
:edit="editObj.edit" -->
</div> </div>
</template> </template>
...@@ -67,21 +55,12 @@ import url from '@/assets/empty.png' ...@@ -67,21 +55,12 @@ import url from '@/assets/empty.png'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import linkDetail from './linkDetail.vue' import linkDetail from './linkDetail.vue'
import edit from './edit.vue' import edit from './edit.vue'
import { exportFn } from '@/common/constant' import { exportFn, activityStatusList } from '@/common/constant'
const activityStatusList = [
// 0:活动待进行;1:活动进行中;2:红包已用完;3:活动已结束
{ text: '全部', id: '' },
{ text: '活动待开始', id: 0 },
{ text: '活动进行中', id: 1 },
{ text: '红包已用完', id: 2 },
{ text: '活动已结束', id: 3 }
]
export default { export default {
components: { linkDetail, edit }, components: { linkDetail, edit },
name: 'RedEnvelopeConfig', name: 'RedEnvelopeConfig',
data () { data () {
return { return {
activityStatusList,
url, url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
searchForm: { searchForm: {
...@@ -166,7 +145,7 @@ export default { ...@@ -166,7 +145,7 @@ export default {
}, },
{ {
label: '状态', label: '状态',
addHtml: 'activityStatus', prop: 'activityStatusStr',
minWidth: 100 minWidth: 100
}, },
] ]
...@@ -190,40 +169,41 @@ export default { ...@@ -190,40 +169,41 @@ export default {
type: 'text', type: 'text',
}, },
listeners: { listeners: {
click: row => this.jumpDetail(row.staffUuid) click: row => this.jumpDetail(row)
} }
} }
], ],
editObj: {}, editObj: {},
showLinkDetail: false linkDetailObj: {},
tableSearchForm: {}
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
beforeSearchFn () { getParams () {
return new Promise(resolve => { const searchForm = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.activityTime) { if (searchForm.activityTime) {
this.searchForm.activityStartTime = new Date(this.searchForm.activityTime[0]).toLocaleDateString().replace(/-/g, '/') searchForm.activityStartTime = dayjs(this.searchForm.activityTime[0]).format('YYYY-MM-DD')
this.searchForm.activityEndTime = new Date(this.searchForm.activityTime[1]).toLocaleDateString().replace(/-/g, '/') searchForm.activityEndTime = dayjs(this.searchForm.activityTime[1]).format('YYYY-MM-DD')
} else { }
delete this.searchForm.activityStartTime delete searchForm.activityTime
delete this.searchForm.activityEndTime return searchForm
}
delete this.searchForm.activityTime
resolve()
})
}, },
handleSearch () { handleSearch () {
this.tableSearchForm = this.getParams()
this.$refs.listRef.refreshTable() this.$refs.listRef.refreshTable()
}, },
handleReset () { handleReset () {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch() this.handleSearch()
}, },
jumpDetail (id) { jumpDetail (e) {
this.linkDetailObj = {
show: true,
id: e.id
}
}, },
showEditFun (e) { showEditFun (e) {
this.editObj = { this.editObj = {
...@@ -233,11 +213,9 @@ export default { ...@@ -233,11 +213,9 @@ export default {
} }
}, },
handleExport (row) { handleExport (row) {
// var params = this.getParams() this.$apis.redenvelope.exportActivityRedEnvelope(this.getParams()).then(res => {
// var apiName = this.$isGroupUp ? 'couponGroupExportApi' : 'couponStoreExportApi' exportFn(res)
// this.$apis.couponManage[apiName](params).then(res => { })
// exportFn(res)
// })
}, },
} }
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
bigTitle="链接详情" bigTitle="链接详情"
:hasFooter="false" :hasFooter="false"
:before-close="handleClose" :before-close="handleClose"
:visible.sync="show" :visible.sync="linkDetailObj.show"
> >
<GLCombiForm <GLCombiForm
ref="showSearch" ref="showSearch"
...@@ -17,10 +17,11 @@ ...@@ -17,10 +17,11 @@
></GLCombiForm> ></GLCombiForm>
<GLTable <GLTable
ref="listRef" ref="listRef"
:getListApi="getListApi" :tableData="tableData"
:searchForm="searchForm"
:noDataImg="url" :noDataImg="url"
:tableParams="tableParams" :tableParams="tableParams"
@refreshTable="refreshTable"
:tableTotal="tableTotal"
:pageConf="pageConf" :pageConf="pageConf"
> >
</GLTable> </GLTable>
...@@ -33,16 +34,19 @@ import * as dayjs from 'dayjs' ...@@ -33,16 +34,19 @@ import * as dayjs from 'dayjs'
export default { export default {
name: '', name: '',
props: { props: {
show: Boolean, linkDetailObj: {
type: Object,
default: () => { }
}
}, },
data () { data () {
return { return {
url, url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
searchForm: { searchForm: {
merchantName: '', status: '',
merchantId: '', wechatName: '',
staffName: '' userPhone: ''
}, },
searchFormData: [ searchFormData: [
{ {
...@@ -51,86 +55,100 @@ export default { ...@@ -51,86 +55,100 @@ export default {
type: 'select', type: 'select',
optionList: [ optionList: [
{ text: '全部', id: '' }, { text: '全部', id: '' },
{ text: '活动待开始', id: 0 }, { text: '未使用', id: 0 },
{ text: '活动进行中', id: 1 }, { text: '已使用', id: 1 },
{ text: '红包已用完', id: 2 },
{ text: '活动已结束', id: 3 }
], ],
optionId: 'id', optionId: 'id',
optionLabel: 'text' optionLabel: 'text'
}, },
{ {
label: '手机号码', label: '手机号码',
name: 'merchantName', name: 'userPhone',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
{ {
label: '微信昵称', label: '微信昵称',
name: 'merchantId', name: 'wechatName',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
], ],
getListApi: this.$apis.outbound.getTaskList,
tableParams: { tableParams: {
listName: 'data', listName: 'data',
tableOption: false, tableOption: false,
tableColumns: [ tableColumns: [
{ {
label: '红包链接', label: '红包链接',
prop: 'merchantName', prop: 'link',
addHtml: 'merchantName', minWidth: 180
minWidth: 100
}, },
{ {
label: '导入时间', label: '导入时间',
prop: 'staffName', prop: 'exportTime',
minWidth: 100 minWidth: 180
}, },
{ {
label: '状态', label: '状态',
prop: 'questionCount', prop: 'statusStr',
minWidth: 100 minWidth: 100,
}, },
{ {
label: '微信昵称', label: '微信昵称',
prop: 'questionEffectiveCount', prop: 'wechatName',
minWidth: 100 minWidth: 100
}, },
{ {
label: '手机号', label: '手机号',
prop: 'questionEffectiveCount', prop: 'userPhone',
minWidth: 100 minWidth: 100
}, },
{ {
label: '绑定时间', label: '绑定时间',
prop: 'questionEffectiveCount', prop: 'bindingTime',
minWidth: 100 minWidth: 100
}, },
{ {
label: '来源', label: '来源',
prop: 'questionEffectiveCount', prop: 'bindingSource',
minWidth: 100 minWidth: 100
}, },
] ]
}, },
tableData: [],
tableTotal: 0
} }
}, },
mounted () { mounted () {
},
watch: {
'linkDetailObj' (n) {
if (n.id) this.refreshTable()
}
}, },
methods: { methods: {
handleClose () { async refreshTable (pageCon) {
this.$emit('update:show', false) pageCon && (this.pageConfig = pageCon)
this.searchForm.redEnvelopeId = this.linkDetailObj.id
const params = {
...this.searchForm,
pageSize: 10,
pageNum: 1,
...this.pageConfig
}
const { data, count } = await this.$apis.redenvelope.getActivityRedEnvelopeLinkDetailPage(params)
this.tableData = data || []
this.tableTotal = count || 0
}, },
handleConfirm () { handleClose () {
this.$emit('update:linkDetailObj', {})
}, },
handleSearch () { handleSearch () {
this.$refs.listRef.refreshTable() this.refreshTable()
}, },
handleReset () { handleReset () {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm
......
...@@ -10,26 +10,26 @@ ...@@ -10,26 +10,26 @@
:modal-append-to-body="true" :modal-append-to-body="true"
> >
<el-form <el-form
ref="configRef" ref="recordRef"
label-width="154px" label-width="154px"
:rules="configRules" :rules="configRules"
:model="configForm" :model="recordForm"
> >
<el-form-item <el-form-item
label="活动形式:" label="活动形式:"
prop="d" prop="importType"
class="m-t-20" class="m-t-20"
> >
<el-radio-group <el-radio-group
:size="size" :size="size"
v-model="configForm.d" v-model="recordForm.importType"
> >
<el-radio :label="1">中奖记录</el-radio> <el-radio :label="3">中奖记录</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="导入链接:" label="导入链接:"
prop="e" prop="exportUrl"
class="m-t-20" class="m-t-20"
> >
<div class="activity-link"> <div class="activity-link">
...@@ -69,40 +69,63 @@ export default { ...@@ -69,40 +69,63 @@ export default {
formItemWidth: 'width: 284px;', formItemWidth: 'width: 284px;',
size: 'small', size: 'small',
channelList: [], channelList: [],
configForm: { recordForm: {
d: 1 importType: 3,
exportUrl: ''
}, },
configRules: { configRules: {
d: [ importType: [
{ {
required: true, required: true,
validator: (rule, value, callback) => {
if (!value || (value && !value.trim())) {
return callback(new Error('请选择活动形式'))
} else {
return callback()
}
},
trigger: 'change' trigger: 'change'
} }
] ],
exportUrl: [
{
required: true,
message: '请导入链接',
}
],
}, },
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
handleClose () { handleClose () {
this.recordForm = this.$options.data.call(this).recordForm
this.$emit('update:show', false) this.$emit('update:show', false)
}, },
handleConfirm () { handleConfirm () {
this.$refs.recordRef.validate(async (valid) => {
if (valid) {
const { recordForm } = this,
res = await this.$apis.redenvelope.importRedEnvelopeRecord(recordForm)
if (res) {
this.$message({
message: '导入成功',
type: 'success'
})
this.handleClose()
this.$parent.handleSearch()
}
else throw '导入成功'
try {
} catch (error) {
this.$message.error(error)
}
}
})
}, },
async uploadFile (e) { async uploadFile (e) {
try { try {
const res = await commonFun.uploadFile(e, this) const res = await commonFun.uploadFile(e, this),
console.log(res) { importType } = this.recordForm
this.$refs.file.value = '' this.$refs.file.value = ''
const { failCount } = await this.$apis.redenvelope.checkImport({ importType, exportUrl: res })
if (failCount && failCount > 0) return this.$message.error('红包记录导入失败')
this.recordForm.exportUrl = res
} catch (error) { } catch (error) {
console.log(error) console.log(error)
if (error) this.$message.error(error) if (error) this.$message.error(error)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<el-button <el-button
type="default" type="default"
plain plain
@click="showEditFun" @click="showImportRecord = true"
>导入记录</el-button> >导入记录</el-button>
</div> </div>
</div> </div>
...@@ -29,12 +29,6 @@ ...@@ -29,12 +29,6 @@
:tableParams="tableParams" :tableParams="tableParams"
:pageConf="pageConf" :pageConf="pageConf"
> >
<div
slot-scope="scope"
slot="zt"
>
{{ scope }} 状态
</div>
<span <span
slot="auth-button" slot="auth-button"
slot-scope="scope" slot-scope="scope"
...@@ -47,7 +41,7 @@ ...@@ -47,7 +41,7 @@
</span> </span>
</GLTable> </GLTable>
</div> </div>
<import-record :show.sync="showImportRecord"></import-record> <import-record :show.sync="showImportRecord"></import-record>
</div> </div>
</template> </template>
...@@ -62,7 +56,7 @@ export default { ...@@ -62,7 +56,7 @@ export default {
data () { data () {
return { return {
url, url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }, pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: { searchForm: {
merchantName: '', merchantName: '',
merchantId: '', merchantId: '',
...@@ -71,7 +65,7 @@ export default { ...@@ -71,7 +65,7 @@ export default {
searchFormData: [ searchFormData: [
{ {
label: '活动名称', label: '活动名称',
name: 'merchantName', name: 'activityName',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
...@@ -83,74 +77,74 @@ export default { ...@@ -83,74 +77,74 @@ export default {
}, },
{ {
label: '微信昵称', label: '微信昵称',
name: 'merchantId', name: 'wechatName',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
{ {
label: '手机号码', label: '手机号码',
name: 'merchantId', name: 'userPhone',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
], ],
getListApi: this.$apis.outbound.getTaskList, getListApi: this.$apis.redenvelope.getRedEnvelopeRecordList,
tableParams: { tableParams: {
listName: 'data', listName: 'list',
tableOption: false, tableOption: false,
tableColumns: [ tableColumns: [
{ {
label: '手机号码', label: '手机号码',
prop: 'merchantName', prop: 'userPhone',
addHtml: 'merchantName',
minWidth: 100 minWidth: 100
}, },
{ {
label: '微信昵称', label: '微信昵称',
prop: 'staffName', prop: 'thirdWechatName',
minWidth: 100 minWidth: 100
}, },
{ {
label: '活动名称', label: '活动名称',
prop: 'questionCount', prop: 'activityName',
minWidth: 100 minWidth: 100
}, },
{ {
label: '所属渠道', label: '所属渠道',
prop: 'questionEffectiveCount', minWidth: 100,
minWidth: 100 formatter: cell => `${cell.merchantId}/${cell.merchantName}`
}, },
{ {
label: '活动时间', label: '活动时间',
prop: 'questionEffectiveCount', minWidth: 150,
minWidth: 150 formatter: cell => `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}`
}, },
{ {
label: '活动形式', label: '活动形式',
prop: 'questionEffectiveCount', prop: 'activityType',
minWidth: 100 minWidth: 100,
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
}, },
{ {
label: '红包链接', label: '红包链接',
prop: 'questionEffectiveCount', prop: 'link',
minWidth: 100 minWidth: 100
}, },
{ {
label: '奖品类型', label: '奖品类型',
prop: 'zt', prop: 'thirdPrizeName',
minWidth: 100 minWidth: 100
}, },
{ {
label: '中奖金额', label: '中奖金额',
prop: 'zt', prop: 'thirdPrizeMoney',
minWidth: 100 minWidth: 100
}, },
] ]
}, },
showImportRecord: true showImportRecord: false
} }
}, },
mounted () { mounted () {
...@@ -163,20 +157,6 @@ export default { ...@@ -163,20 +157,6 @@ export default {
this.searchForm = this.$options.data.call(this).searchForm this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch() this.handleSearch()
}, },
jumpDetail (id) {
},
showEditFun (e) {
console.log(e)
this.showEdit = true
},
handleExport (row) {
// var params = this.getParams()
// var apiName = this.$isGroupUp ? 'couponGroupExportApi' : 'couponStoreExportApi'
// this.$apis.couponManage[apiName](params).then(res => {
// exportFn(res)
// })
},
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!