Commit 10224e79 by chenxin

fix: 卡券

parent 09cc5240
......@@ -34,11 +34,6 @@ export default [
path: 'send-list',
component: () => import(/* webpackChunkName: "card-package" */'@/views/card-package/send-list.vue'),
},
// 卡券包领取详情
{
path: 'send-info',
component: () => import(/* webpackChunkName: "card-package" */'@/views/card-package/send-info.vue'),
},
],
},
];
\ No newline at end of file
......@@ -17,6 +17,9 @@ export default [
{
path: 'member-get',
component: () => import(/* webpackChunkName: "gic-card" */'@/views/gic-card/member-get.vue'),
meta: {
path: '/gic-card/list'
}
},
// 库存记录
{
......
......@@ -64,10 +64,10 @@ export default {
const validateSendType = (rule, value, callback) => {
const { dateTime, packageStatus } = this;
if ((dateTime && !dateTime[0]) || !dateTime) {
callback(new Error('请选择有效时间'));
callback(new Error('请选择有效期限'));
}
if (packageStatus == 1 && dateTime[0] < getTimesByReq('', 1)) {
callback(new Error('有效时间不能小于当前时间'));
callback(new Error('有效期限不能小于当前时间'));
}
if (new Date(dateTime[1]).getTime() - new Date(dateTime[0]).getTime() > 1000 * 60 * 60 * 24 * 365) {
callback(new Error('时间跨度不能大于一年'));
......
<template>
<div class="p20" v-loading="loading">
<div class="pb20 clearfix flex-center">
<el-date-picker class="w350 mr10" v-model="dateTime" type="daterange" range-separator="~" start-placeholder="领取开始日期" end-placeholder="领取结束日期" @change="refresh"></el-date-picker>
<el-input class="vertical-middle w300 mr10" v-model="listParams.packageName" clearable placeholder="请输入卡券包名称" @change="refresh"><i slot="prefix" class="el-input__icon el-icon-search"></i></el-input>
<el-input class="vertical-middle w300" v-model="listParams.search" clearable placeholder="请输入会员姓名/手机号" @change="refresh"><i slot="prefix" class="el-input__icon el-icon-search"></i></el-input>
</div>
<el-table tooltip-effect="dark" :data="tableList" style="width:100%">
<el-table-column label="领取时间" fixed="left" min-width="120px">
<template slot-scope="scope">
<div v-html="listTime(scope.row.receiveTime)"></div>
</template>
</el-table-column>
<el-table-column label="用户信息" min-width="120px">
<template slot-scope="scope">
<member-info :member-name="scope.row.memberName" :member-image="scope.row.memberImage" :member-phone="scope.row.memberPhone"></member-info>
</template>
</el-table-column>
<el-table-column prop="packageName" label="卡券包名称" min-width="130px">
<template slot-scope="scope">
<span :title="scope.row.couponPackageId" p-key="couponPackageId">{{ scope.row.packageName }}</span>
</template>
</el-table-column>
<el-table-column label="领取详情" min-width="120px">
<template slot-scope="scope">
<el-tooltip :open-delay="openDelay" effect="dark" placement="bottom">
<div slot="content">
<span v-html="scope.row.detail"></span>
</div>
<span class="el-button el-button--text" @mouseenter="showDetail(scope.row)">领取详情</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="appName" label="应用" min-width="120px"></el-table-column>
<el-table-column prop="appActivityName" label="活动" min-width="120px"></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>
</div>
</template>
<script>
import { page, formate } from '@/mixins/table.js';
import { listTime } from '@/utils/index.js';
import api from '@/api/card-package.js';
const { couponLogPage, packageCouponReceiveLog } = api;
export default {
name: 'MergeRecordList',
mixins: [ page, formate ],
data() {
return {
loading: false,
dateTime: [],
listParams: {
beginTime: '',
endTime: '',
packageName: '',
search: '',
currentPage: 1,
pageSize: 20
},
tableList: [],
total: 0,
detail: '',
mask: {
show: false
}
};
},
created() {
this.$emit('updateBread', [ { breadName: '福利中心' }, { breadName: 'GIC卡券包', breadPath: '/card-package/list' }, { breadName: '卡券包领取记录', breadPath: '/card-package/record-list' } ]);
},
mounted() {
this.getTableList();
},
methods: {
listTime,
showDetail({ packageLogId }) {
const idx = this.tableList.findIndex(v => v.packageLogId == packageLogId);
const item = this.tableList[idx];
if(item.detail) {
return;
}
packageCouponReceiveLog({ packageLogId }).then(res => {
item.detail = res.result.map(v => {
return `<p style="line-height:18px;max-width:400px">${v.cardName}${v.receiveFlag ? '领取成功' : `领取失败(${ v.errMsg })`}</p>`;
}).join('');
this.tableList.splice(idx, 1, item);
});
},
getTableList() {
if(this.loading) {
return;
}
this.loading = true;
this.formatterTimeFunc('beginTime', 'endTime', 'yyyy-MM-dd', 'dateTime');
let params = { ...this.listParams, memberCardId: this.currentAreaId };
couponLogPage(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;
});
}
},
};
</script>
<style lang="scss" scope>
.merge-mask {
position: fixed;
z-index: 10;
background: #303133;
color: white;
border-radius: 4px;
padding: 10px;
.arrow {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
}
</style>
\ No newline at end of file
......@@ -153,6 +153,10 @@ export default {
params.applyList = JSON.stringify(params.applyList);
params.useConditionLimit = JSON.stringify(params.useConditionLimit);
this.loading = true;
console.log(params);
if (params !== true) {
return;
}
this.$emit('updateLoading', true);
updateCard(params).then(res => {
this.$emit('updateLoading', false);
......
......@@ -112,8 +112,7 @@
<li v-if="scope.row._status == 2">
<dm-perm-button @click="handler(10, scope.row)" type="text">禁用</dm-perm-button>
</li>
<!-- v-if="[1,2].includes(scope.row._status)" -->
<li>
<li v-if="[1,2].includes(scope.row._status)">
<dm-perm-button @click="handler(9, scope.row)" type="text">库存记录</dm-perm-button>
</li>
<li v-if="[2, 3, 4].includes(scope.row._status)" :class="{ disabled: $itemPerm($itemCode.gicCardGroupBtn) || scope.row.deleteFlag }">
......
<template>
<el-dialog title="卡券单独设置" :visible.sync="dialogVisible" width="1100px" @close="handleClose ">
<div style="max-height:650px;overflow-y:auto;">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px">
<el-form-item label="选择卡券" prop="couponId">
<dm-card-select :before-submit="beforeSubmit" v-if="dialogVisible" :read-only="disabled" v-bind="cardSelectParams" class="send" :member-card-id="currentAreaId" @selectData="selectData" fix-member-card :unuse-list="unuseList" />
</el-form-item>
<shelf-limit ref="shelfLimit2" />
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取消</el-button>
<el-button type="primary" @click="submit">保存</el-button>
</span>
</el-dialog>
</template>
<script>
import shelfLimit from './shelf-limit';
export default {
name: 'ShelfDialog',
components: {
shelfLimit
},
inject: [ 'parentDisabled' ],
props: {
dialogVisible: {
type: Boolean,
default: false
},
timeType2List: {
type: Array,
default: () => []
},
unuseList: {
type: Array,
default: () => []
}
},
data() {
return {
ruleForm: {
couponId: '',
couponName: ''
},
idx: '', // 不为'' 就是编辑
rules: {
couponId: [ { required: true, message: '请选择卡券', trigger: 'change' } ],
},
};
},
methods: {
add() {
this.$nextTick(() => {
this.$refs.shelfLimit2.add();
});
},
edit(data, idx) {
this.idx = idx;
this.ruleForm.couponId = data.couponId;
this.$nextTick(() => {
this.$refs.shelfLimit2.edit(data);
});
},
submit() {
this.$refs.ruleForm.validate((valid) => {
if (!valid) {
this.$tips({ message: '表单有错误,请检查后提交', type: 'error' });
return;
} else {
let data = this.$refs.shelfLimit2.dealData();
if(!data) {
return;
}
this.$emit('saveItem', this.idx, { ...data, ...this.ruleForm });
this.handleClose();
}
});
},
handleClose() {
// 重置数据
this.idx = '';
this.$refs.shelfLimit2.clean();
this.$refs.ruleForm.resetFields();
this.$emit('update:dialogVisible', false);
},
// 卡券选择器
beforeSubmit(id) {
if(this.timeType2List.map(v => v.couponId).includes(id)) {
this.$tips({ message: '该卡券已存在', type: 'error' });
return false;
}
return true;
},
selectData(data, idx) {
this.ruleForm.couponId = data.couponId || '';
this.ruleForm.couponName = data.cardName || '';
this.$refs.ruleForm.validateField('couponId');
},
},
computed: {
disabled() {
return this.parentDisabled();
},
cardSelectParams() {
return this.idx !== '' ? { couponId: this.ruleForm.couponId } : {};
}
},
};
</script>
<style lang="scss" scoped>
.block {
display: flex;
align-items: flex-end;
}
</style>
\ No newline at end of file
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