Commit fa362c9a by chenxin

fix: gic卡券销毁

parent 616536ef
......@@ -28,19 +28,13 @@ let card = {
disableCard: '/coupon/disable-coupon', // 禁用卡券
couponLogPage: '/coupon/coupon-log-page', // 卡券领取列表
giveLogList: '/coupon/coupon-give-log-page', // 卡券转赠记录
groupSendAdd: {
// 新建投放 TODO:
url: '/coupon/coupon-puton',
method: 'post',
useFormData: true,
},
codeErrorList: '/gic-coupon-code-error-page', // 查询导入券券码错误列表 TODO:
checkDemoCode: {
// 根据demo code TODO:
url: '/coupon/check-demo-code',
alertError: false
},
cardDestoryList: '/destroy-plugin/page-destroy-plan', // 卡券销毁分页列表 TODO:
cardDestoryList: '/destroy-plugin/destroy-plan-page', // 卡券销毁分页列表
getDestroyDetail: '/destroy-plugin/get-destroy-detail', // 卡券销毁详情
saveCoupDestoryPlan: {
// 保存卡券销毁 TODO:
url: '/destroy-plugin/save-destroy-plan',
......
......@@ -78,7 +78,12 @@ export default [
type: 'edit',
path: '/gic-card/list'
}
}
},
// 卡券销毁
{
path: 'destory-list',
component: () => import(/* webpackChunkName: "gic-card" */'@/views/gic-card/destory-list.vue'),
},
],
},
];
\ No newline at end of file
......@@ -268,8 +268,8 @@ export default {
case 6:
this.$router.push('/gic-card/copy?copyId=' + couponId);
break;
case 8: // 领取详情
this.$router.push('/gic-card/log/member-get?id=' + couponId);
case 8: // 领取记录
this.$router.push('/gic-card/member-get?id=' + couponId);
break;
case 9: // 库存记录
this.$router.push('/gic-card/stock-list?id=' + couponId);
......
<template>
<div class="p20" v-loading="loading">
<div class="pb20 clearfix flex-center">
<el-date-picker class="w400 mr10" v-model="dateTime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="refresh"></el-date-picker>
<!-- <el-select class="w160 mr10" v-model="listParams.destoryMode" clearable placeholder="所有销毁方式" @change="refresh">
<el-option v-for="(item, index) in destoryType" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select> -->
<el-input v-model="listParams.search" class="w300 mrAuto" placeholder="请输入卡券名称" clearable @change="refresh"><i slot="prefix" class="el-input__icon el-icon-search"></i></el-input>
<dm-perm-button icon="iconfont-market4 icon-icon_yunxiazai mr5" :disabled="$itemPerm($itemCode.gicCardDestory)" type="danger" @click="showDialog('add', {})">卡券销毁</dm-perm-button>
</div>
<el-table tooltip-effect="dark" :data="tableList" style="width:100%">
<el-table-column v-for="(v, i) in tableHeader" :fixed="v.fixed" :show-overflow-tooltip="v.tooltip" :width="v.width" :min-width="v.minWidth" :align="v.align" :key="i" :prop="v.prop" :label="v.label" :formatter="v.formatter" :sortable="v.sortable">
<template slot-scope="scope">
<span v-if="v.formatter" v-html="v.formatter(scope.row)"></span>
<span v-else>{{ scope.row[v.prop] || '--' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="left" width="120px" fixed="right">
<template slot-scope="scope">
<dm-perm-button type="text" @click="showExport(scope.row)" :disabled="$itemPerm($itemCode.gicCardDestoryExport)">导出结果</dm-perm-button>
</template>
</el-table-column>
</el-table>
<div class="clearfix">
<dm-pagination class="fr mb0" v-if="tableList.length" background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listParams.currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="listParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"></dm-pagination>
</div>
<destory-dialog :show.sync="dialog.show" v-bind="dialog" @refresh="getTableList" />
<dm-export-data ref="exportData" :visible.sync="exportVisible" :sens-value="true" :fields="fields" :label="label" :value="value" :sens-key="sensKey" :loading="loading" :is-created="isCreated" @export="onExport" @closed="isCreated = false" :default-select-keys="defaultSelectKeys"></dm-export-data>
</div>
</template>
<script>
import { page, formate } from '@/mixins/table.js';
import { listTime } from '@/utils/index.js';
import fetch from '@/api/gic-card.js';
import { dealExportParams } from '@/utils/common.js';
import destoryDialog from './module/destory-dialog';
const { cardDestoryList, exportDestroyLogExcel } = fetch;
export default {
name: 'SendList',
components: {
destoryDialog
},
mixins: [ page, formate ],
props: {
dialogVisible: {
type: Boolean,
default: false
}
},
data() {
return {
loading: false,
dateTime: [],
listParams: {
beginTime: '',
endTime: '',
search: '',
destoryMode: '',
currentPage: 1,
pageSize: 20
},
// destoryType: [{ value: 0, label: '全部销毁' }, { value: 1, label: '部分销毁' }], // eslint-disable-line
total: 0,
dialog: {
show: false,
destoryItem: '',
type: 'add'
},
tableList: [],
tableHeader: [
{
label: '卡券名称',
minWidth: '120',
align: 'left',
fixed: 'left',
formatter: function(row) {
return `<span p-key="couponId" title="${row.couponId}">${ row.cardName }</span>`;
}
},
{
label: '销毁时间',
minWidth: '120',
align: 'left',
formatter: function(row) {
return listTime(row.createTime);
}
},
{
label: '销毁方式',
minWidth: '120',
align: 'left',
formatter: function(row) {
// 卡券销毁方式(0:全部销毁,1:部分销毁)
return row.destroyMode ? '部分销毁' : '全部销毁';
}
},
{
label: '计划销毁数量',
minWidth: '120',
align: 'left',
formatter: function(row) {
return (row.sucessCount + row.failCount) || '--';
}
},
{
label: '销毁结果',
minWidth: '120',
align: 'left',
formatter: function(row) {
return `<p>成功:<span style="color:#33af4a;">${ row.sucessCount }</span></p>
<p>失败:<span style="color:#F5222D;">${ row.failCount }</span></p>`;
}
}
],
// 导出组件
exportDestroyPlanId: '',
exportVisible: false,
isCreated: false,
// eslint-disable-next-line
fields: [{label:'券码',value:'cardCode',sensKey:false},{label:'销毁结果', value: 'destroyRemark', sensKey: false},{label:'错误信息',value:'errMsg',sensKey:false}],
sensKey: 'sensKey',
defaultSelectKeys: [ 'cardCode', 'destroyRemark', 'errMsg' ],
// sensValue: '',
label: 'label',
value: 'value'
};
},
created() {
this.$emit('updateBread', [ { breadName: '福利中心' }, { breadName: 'GIC卡券' }, { breadName: 'GIC卡券销毁列表' } ]);
},
mounted() {
this.getTableList();
},
methods: {
showDialog(type, destoryItem) {
this.dialog.type = type;
this.dialog.show = true;
if (type !== 'add') {
this.dialog.destoryItem = destoryItem;
}
},
getTableList() {
if(this.loading) {
return;
}
this.loading = true;
this.formatterTimeFunc('beginTime', 'endTime', 'yyyy-MM-dd', 'dateTime');
let params = { ...this.listParams, ...{ memberCardId: this.currentAreaId } };
cardDestoryList(params).then(res => {
this.loading = false;
const data = res.result;
this.tableList = data.result || [];
this.total = data.totalCount;
// 删除至最后一页没数据的情况,页码-1
if (this.tableList.length === 0 && this.listParams.currentPage !== 1) {
this.listParams.currentPage -= 1;
this.getTableList();
}
}).finally(() => {
this.loading = false;
});
},
// ********数据导出*************
showExport({ destroyPlanId }) {
// if(!this.tableList.length) {
// this.$tips({ message: '没有要导出的数据', type: 'warning' });
// return;
// }
this.exportDestroyPlanId = destroyPlanId;
this.exportVisible = true;
},
onExport(config) {
let params = dealExportParams({ config, listParams: { destroyPlanId: this.exportDestroyPlanId }, fieldList: this.fields, path: this.$route.path, pathName: 'GIC卡券-卡券销毁记录', query: { areaId: this.currentAreaId } });
console.log(params);
// 将config转换为请求参数
// const params = config;
// 导出数据完成后,必须调导出组件的applyReport方法
// applyReport方法的第一个参数表示是否生成导出数据,第二个参数为导出数据的id
exportDestroyLogExcel(params).then(res => {
this.$refs.exportData.applyReport(true, res.result);
}).catch(err => {
this.$refs.exportData.applyReport();
});
}
},
};
</script>
......@@ -121,13 +121,13 @@ export default {
data() {
return {
loading: false,
dateTime: [ Date.now(), Date.now() ], // 默认7
dateTime: [ Date.now(), Date.now() ], // 默认
dateTimeCopy: [ Date.now(), Date.now() ],
dateTime2: [ , ],
listParams: {
// appActivityId: this.$route.query.appActivityId || '',
// appCode: this.$route.query.appCode || '',
couponId: '', // 卡券id
couponId: this.$route.query.id, // 卡券id
search: '',
searchType: 1,
cardType: '',
......@@ -157,15 +157,11 @@ export default {
};
},
created() {
this.$emit('updateBread', [ { breadName: '福利中心' }, { breadName: 'GIC卡券' }, { breadName: '卡券日志' }, { breadName: '领取记录' } ]);
this.$emit('updateBread', [ { breadName: '福利中心' }, { breadName: 'GIC卡券' }, { breadName: '卡券领取记录' } ]);
},
mounted() {
if(this.currentAreaId) {
if (this.$route.query.id) {
this.listParams.couponId = this.$route.query.id;
} else {
this.getTableList();
}
this.getTableList();
}
},
methods: {
......@@ -213,7 +209,9 @@ export default {
this.currentObj = row;
},
getTableList() {
return;
if(!this.$route.query.id) { // 必须要有卡券id
return;
}
if(this.loading) {
return;
}
......
......@@ -128,7 +128,6 @@ export default {
return cardType[row.cardType].label;
},
getTableList() {
return;
if(this.loading) {
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment