Commit f6afa124 by caoyanzhi

Merge branch 'feature/5月迭代'

parents 4a813808 75c7b07a
......@@ -15,6 +15,16 @@ export default {
}
},
{
path: 'connect-list',
name: '卡券关联列表',
component: () => import(/* webpackChunName: "card" */ '../../views/card/card-connect-list.vue')
},
{
path: 'async-logs',
name: '卡券同步错误日志',
component: () => import(/* webpackChunkName: "card" */ '../../views/card/card-async-logs.vue')
},
{
path: 'record',
name: '卡券记录',
component: () => import(/* webpackChunkName: "card" */ '../../views/card/record.vue'),
......
......@@ -3,6 +3,21 @@ const PREFIX = 'api-marketing/';
import config from '@/config';
export const url = config.api + PREFIX;
// 卡券营销-关联卡券列表
export const getCouponList = params => requests('/api-admin/list-wm-coupon', params, false, false, 'post');
// 卡券营销-卡券同步错误日志
export const getCouponLogs = params => requests('/api-admin/list-coupon-log', params, false, false, 'post');
// // 卡券营销-卡券同步错误日志-不处理
export const delCouponLog = params => requests('/api-admin/delete-coupon-error-log', params, false, false, 'post');
// 卡券营销-卡券同步错误日志-重新推送
export const sendCouponReset = params => requests('/api-admin/send-coupon-reset', params, false, false, 'post');
// 卡券营销-卡券同步错误日志-重新核销
export const consumeCoupon = params => requests('/api-admin/consume-coupon', params, false, false, 'post');
//卡券营销--卡券库--卡券分页列表
export const cardPageList = params => requests(PREFIX + 'card-page', params);
......
<template>
<div class="dm-wrap">
<el-input type="text" placeholder="请输入卡券代码/微盟wid" prefix-icon="el-icon-search" style="width: 300px" clearable v-model.trim="search" @change="onSearch"></el-input>
<!-- <el-button style="float: right;margin-left: 10px" type="primary" @click="onMultipleReasyn">批量重新同步</el-button> -->
<el-button style="float: right;color:#2F54EB;border-color:#2F54EB" @click="onMultipleCancel">批量不处理</el-button>
<el-table :data="logs" style="margin-top: 20px" ref="multipleTable" @selection-change="onSelectChange">
<el-table-column type="selection" width="40px"></el-table-column>
<el-table-column label="同步时间">
<div slot-scope="{ row }" style="line-height: normal">
<p>{{ formatDateTimeByType(row.updateTime, 'yyyy-MM-dd-HH-mm-ss', true).y }}</p>
<p>{{ formatDateTimeByType(row.updateTime, 'yyyy-MM-dd-HH-mm-ss', true).h }}</p>
</div>
</el-table-column>
<el-table-column label="错误提示" prop="wmResponse"></el-table-column>
<el-table-column label="同步类型" prop="sendType">
<template slot-scope="{ row }">{{ row.sendType == 1 ? '推送卡券' : row.sendType == 2 ? '核销卡券' : '--' }}</template>
</el-table-column>
<el-table-column label="卡券代码" prop="couponCode"></el-table-column>
<el-table-column label="WID/会员卡号" prop="wid"></el-table-column>
<el-table-column label="操作">
<template slot-scope="{ row }">
<el-button type="text" @click="onReasyn(row)">重新同步</el-button>
<el-button type="text" @click="onCancel(row)">不处理</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination v-if="pager.total > 0" style="margin-top: 20px;text-align: right" layout="total,sizes,prev,pager,next" background :total="pager.total" :page-sizes="pager.pageSizes" :page-size="pager.pageSize" :current-page="pager.currentPage" @current-change="onCurrentChange" @size-change="onSizeChange"></el-pagination>
</div>
</template>
<script>
import { getCouponLogs, delCouponLog, sendCouponReset, consumeCoupon } from '@/service/api/cardApi.js';
import { formatDateTimeByType } from '@/utils/index.js';
export default {
name: 'card-async-logs',
data() {
return {
logs: [],
search: '',
pager: {
total: 0,
pageSizes: [20, 40, 60, 80],
pageSize: 20,
currentPage: 1
},
multipleSelect: {
multipleType: '', // 无全选:0,选择本页:1,选择全部:2
selected: []
}
};
},
created() {
this.getLogs();
},
methods: {
formatDateTimeByType,
getLogs() {
const { currentPage, pageSize } = this.pager;
const params = {
searchStr: this.search,
pageNum: currentPage,
rowCount: pageSize
};
getCouponLogs(params).then(res => {
const { errorCode, message, result } = res || {};
if (errorCode != 0) {
this.$message.error(message);
return;
}
this.pager.total = result.totalCount;
this.logs = result.result || [];
if (this.multipleSelect.multipleType == 2) {
this.$refs.multipleTable.toggleAllSelection();
this.$nextTick(() => {
this.multipleSelect.multipleType = 2;
});
}
});
},
onSearch() {
// 查询
this.pager.currentPage = 1;
this.getLogs();
},
onCurrentChange(currentPage) {
// 改变页码
this.pager.currentPage = currentPage;
this.getLogs();
},
onSizeChange(pageSize) {
// 改变数量
this.pager.pageSize = pageSize;
this.onSearch();
},
onSelectChange(selected) {
// table全选、取消全选
const multipleType = this.multipleSelect.multipleType;
this.multipleSelect.selected = selected;
if (!(selected.length == this.logs.length && multipleType == 2)) {
this.multipleSelect.multipleType = selected.length == this.logs.length ? 1 : 0;
}
},
onCommand(type) {
// 选择本页、选择全部
const multipleType = this.multipleSelect.multipleType;
if (multipleType == 0 || multipleType == type) {
this.$refs.multipleTable.toggleAllSelection();
}
this.multipleSelect.multipleType = this.multipleSelect.multipleType == type ? 0 : type;
},
onMultipleCancel() {
// 批量不处理
const selected = this.multipleSelect.selected || [];
if (selected.length == 0) {
this.$message.error('请先选择数据');
return;
}
this.delCouponLog(selected.map(el => el.couponErLogId));
},
onCancel(logData) {
// 单条不处理
this.delCouponLog([logData.couponErLogId]);
},
delCouponLog(ids) {
// 不处理接口
delCouponLog({ couponErLogIds: ids.join(',') }).then(res => {
const { errorCode, message } = res || {};
if (errorCode != 0) {
this.$message.error(message);
return;
}
this.$message.success('已经取消处理');
this.multipleSelect.multipleType = 0;
this.getLogs();
});
},
onReasyn(logData) {
// 单条重新同步
this.reAsyn(logData);
},
reAsyn(logData) {
// 重新同步接口,分为重新推送卡券和重新核销卡券两种情况
const { pid, couponTemplateId, memberId, couponCode } = logData;
// "sendType":1, //1 为推送卡券,2 核销卡券
if (logData.sendType == 1) {
// cardTemplateStr 是 字符串数组 发送优惠券列表信息 其中的string元素为 微盟pid_cardTemplateId拼接成
// memberId 是 string 会员ID
// couponCode 否 string 非必填 ,不填时,微盟卡券自动生成券号
sendCouponReset({ memberId, couponCode, cardTemplateStr: `${pid}_${couponTemplateId}` }).then(res => callback.call(this, res));
} else if (logData.sendType == 2) {
// memberId 是 string 会员ID
// couponCode 是 string 微盟卡券券号
consumeCoupon({ memberId, couponCode }).then(res => callback.call(this, res));
}
function callback(respData) {
const { errorCode } = respData;
if (errorCode != 0) {
// 诸侯、测试说这里提示文案写死
this.$message.error('卡券重新同步失败,失败原因已更新');
return;
}
this.$message.success('重新同步成功,请稍后刷新页面查看同步结果');
this.multipleSelect.multipleType = 0;
this.getLogs();
}
}
}
};
</script>
<style lang="scss" scoped>
.dm-wrap {
/deep/ .el-table-column--selection .cell {
padding-left: 10px;
}
}
</style>
<template>
<div class="dm-wrap">
<el-date-picker v-model="search.date" type="daterange" range-separator="~" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" clearable style="width: 256px" @change="onSearch"> </el-date-picker>
<el-input clearable type="text" style="margin-left: 10px;width: 260px" placeholder="请输入卡券名称" prefix-icon="el-icon-search" v-model.trim="search.input" @change="onSearch"></el-input>
<div class="check-active-card">
<el-checkbox v-model="search.isActive" label="仅展示有效卡券" @change="onSearch"></el-checkbox>
</div>
<el-button v-if="$getButtonLimit($buttonCode.marketingConnectLogs)" :limit-code="$buttonCode.marketingConnectLogs" style="float: right;color:#2F54EB;border-color:#2F54EB" @click="$router.push('/card/async-logs')">错误日志</el-button>
<el-table :data="tableData" style="margin-top: 20px">
<el-table-column label="绑定时间" sortable sort-by="createDate">
<template slot-scope="{ row }">{{ formatDateTimeByType(row.createDate) }}</template>
</el-table-column>
<el-table-column label="卡券名称 (达摩侧) " prop="cardName"></el-table-column>
<!-- 带上微盟卡券id -->
<el-table-column label="卡券名称 (微盟侧)">
<div slot-scope="{ row }" v-if="Array.isArray(JSON.parse(row.weimobDemoCode))" style="line-height: normal">
<p>{{ JSON.parse(row.weimobDemoCode)[0].name }}</p>
<p style="font-size:12px">{{ JSON.parse(row.weimobDemoCode)[0].card }}</p>
</div>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="{ row }">
<el-button type="text" @click="toCouponDetail(row)">卡券详情</el-button>
<el-button type="text" @click="toGetList(row)">领取记录</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination v-if="pager.total > 0" style="margin-top: 20px;text-align: right" layout="total,sizes,prev,pager,next" background :total="pager.total" :page-sizes="pager.pageSizes" :page-size="pager.pageSize" :current-page="pager.currentPage" @current-change="onCurrentChange" @size-change="onSizeChange"></el-pagination>
</div>
</template>
<script>
import { getCouponList } from '@/service/api/cardApi.js';
import { formatDateTimeByType } from '@/utils/index.js';
export default {
name: 'card-connect-list',
data() {
return {
tableData: [],
search: {
date: [],
input: '',
isActive: true
},
pager: {
total: 0,
pageSizes: [20, 40, 60, 80],
pageSize: 20,
currentPage: 1
}
};
},
created() {
this.getData();
},
methods: {
formatDateTimeByType,
getData() {
const { currentPage, pageSize } = this.pager;
const { input, date, isActive } = this.search;
const params = {
search: input,
beginTime: Array.isArray(date) ? date[0] : '',
endTime: Array.isArray(date) ? date[1] : '',
showFlag: Number(isActive), //int 仅展示有效卡券 (1: 选中, 0/null: 未选择)
currentPage,
pageSize
};
getCouponList(params).then(res => {
const { errorCode, message, result } = res || {};
if (errorCode != 0) {
this.$message.error(message);
return;
}
this.tableData = result.result || [];
this.pager.total = result.totalCount || 0;
});
},
onSearch() {
this.pager.currentPage = 1;
this.getData();
},
onCurrentChange(currentPage) {
this.pager.currentPage = currentPage;
this.getData();
},
onSizeChange(pageSize) {
this.pager.pageSize = pageSize;
this.onSearch();
},
toCouponDetail(couponData) {
this.$router.push(`/card/info/${couponData.coupCardId}`);
},
toGetList(couponData) {
this.$router.push(`/card/record/get?coupCardId=${couponData.coupCardId}`);
}
}
};
</script>
<style lang="scss" scoped>
.check-active-card {
display: inline-flex;
justify-content: center;
align-items: center;
margin-left: 10px;
width: 146px;
height: 30px;
border-radius: 2px;
border: 1px solid #dcdfe6;
&:hover {
border-color: #c0c4cc;
}
}
</style>
......@@ -19,6 +19,7 @@
<div class="game-ptyx-header pb10 clearfix">
<span class="pr10" style="line-height:32px;margin-left:10px">卡券共{{ total }}</span>
<el-button class="fr" v-if="$getButtonLimit($buttonCode.marketingAddCard)" :limit-code="$buttonCode.marketingAddCard" type="primary" @click="addCard">新增卡券</el-button>
<el-button class="fr" v-if="$getButtonLimit($buttonCode.marketingCardConnect)" :limit-code="$buttonCode.marketingCardConnect" @click="$router.push('/card/connect-list')" style="margin-right: 20px">卡券关联列表</el-button>
</div>
<ul class="clearfix" element-loading-text="拼命加载中">
<card-item @adjust-stock="preAdjustStock" :item="v" v-for="(v, i) in tableList" :key="i" @delete-card="delData"></card-item>
......
......@@ -404,6 +404,8 @@ export default {
},
// 校验屏蔽词
validateContent() {
this.loading = true;
this.validateStatus = null;
checkSmsContext({ context: this.form.content, type: this.form.type })
.then(res => {
this.validateStatus = 1;
......@@ -411,6 +413,11 @@ export default {
.catch(err => {
this.validateStatus = 0;
this.validaErrorMsg = err.data.message;
})
.finally(() => {
setTimeout(() => {
this.loading = false;
}, 500);
});
},
// 重置校验屏蔽词的状态
......
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