Commit 2ca8dab3 by 李伟康

提交

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