Commit bfa4ca9f by chenxin

fix: kaquan

parent 78a6d726
......@@ -48,7 +48,7 @@
<script src="//web-1251519181.file.myqcloud.com/components/preview-img.1.0.3.js"></script><!-- 图片预览 -->
<script src="//web-1251519181.file.myqcloud.com/components/delete.1.1.4.js"></script><!-- 删除轻弹窗 -->
<script src="//web-1251519181.file.myqcloud.com/components/input-number.1.0.10.js"></script><!-- 输入框 -->
<script src="//web-1251519181.file.myqcloud.com/components/welfare-selector.0.0.4.js"></script><!-- 福利选择器 -->
<script src="//web-1251519181.file.myqcloud.com/components/welfare-selector.0.0.6.js"></script><!-- 福利选择器 -->
<script src="//web-1251519181.file.myqcloud.com/components/acc-group-select.1.0.5.js"></script><!-- 账号分组组件 -->
<script src="//web-1251519181.file.myqcloud.com/components/editor.1.1.13.js"></script><!-- 富文本编辑器 -->
</body>
......
......@@ -3,7 +3,7 @@
* GIC卡券
*/
import getFetch from './get-fetch.js';
import config, { welfarePrefix } from '@/config';
import config, { welfarePrefix, origin } from '@/config';
// 卡券相关接口
......@@ -69,7 +69,7 @@ export default { ...card, ...destory };
export const downloadCouponCSV = config.api + welfarePrefix + '/destroy-plugin/download-destroy-code-template'; // 下载导入GIC券号csv示例文件
export const importCode = config.api + welfarePrefix + '/destroy-plugin/import-destroy-code'; // 导入券码
export const importCode = origin + welfarePrefix + '/coupon/import-custom-code'; // 导入券码
export const importDestoryCode = welfarePrefix + '/destroy-plugin/import-destroy-code'; // 上传销毁code列表
export const downloadDestroyCodeTemplate = config.api + welfarePrefix + '/coupon/download-code-template'; // 下载销毁模板示例
......@@ -24,11 +24,10 @@
</div>
<!-- bread插槽 -->
<div slot="bread">
<!-- <app-info force-init ref="appInfo" /> -->
<app-info :code="moduleCode" />
</div>
</dm-layout>
<!-- <el-dialog :visible="noAreaWarnVisible" append-to-body width="500px" :close-on-press-escape="false" :close-on-click-modal="true" :show-close="false" lock-scroll>
<el-dialog :visible="noAreaWarnVisible && project.includes('card')" append-to-body width="500px" :close-on-press-escape="false" :close-on-click-modal="true" :show-close="false" lock-scroll>
<div class="text-center">
<p class="gray02 fz16" style="display:flex;justify-content: center;align-items: center;"><i class="el-icon-warning fz30 mr5 warning-color"></i>暂无资源权限</p>
<p class="fz13 gray03 mt20">没有资源权限,如:可操作的会员卡、服务号等,请联系管理员进行配置</p>
......@@ -38,7 +37,7 @@
<el-button @click="toAppCenter"> 返回应用中心</el-button>
</div>
</span>
</el-dialog> -->
</el-dialog>
<switch-page />
</div>
</template>
......
......@@ -30,24 +30,17 @@
<dm-acc-group-select :etype.sync="ruleForm.operAuthType" :group-ids.sync="ruleForm.operAuth" />
</el-form-item>
<el-form-item>
<el-button type="primary" v-if="isAdd" @click="addForm">确认新建</el-button>
<el-button type="primary" v-if="isAdd" @click="addForm">保存并添加卡券</el-button>
<el-button type="primary" :disabled="ruleForm.packageStock == info.packageStock" v-else @click="editForm">保存</el-button>
</el-form-item>
<el-form-item v-if="!isAdd" class="is-required">
<el-tooltip content="若添加的卡券为固定有效期,仅允许添加和有效期限时间重合的卡券" placement="bottom" slot="label" open-delay="200">
<span class="tooltip-icon">添加卡券</span>
</el-tooltip>
<!-- <div v-loading="cardLoading">
<div class="mb10">
卡券id:<el-input v-model="couponForm.couponId" style="width:200px" class="mr10" />
库存值:<el-input v-model="couponForm.stock" style="width:100px" />
<el-button type="text" @click="addCard" class="ml5">保存</el-button>
</div>
</div> -->
<el-button class="dashed" @click="showSelector = true">添加卡券</el-button>
<div class="imitation-table" v-if="couponList.length" style="width:100%;" v-loading="cardLoading">
<el-button class="dashed" :disabled="couponList.length > 10" @click="showSelector = true">添加卡券 {{ couponList.length }}/{{ 10 }}</el-button>
<div class="imitation-table mt20" v-if="couponList.length" style="width:100%;" v-loading="cardLoading">
<el-row class="thead">
<el-col :span="5">卡券信息</el-col>
<el-col :span="5">卡券名称</el-col>
<el-col :span="5">使用有效期</el-col>
<el-col :span="4">卡券包内剩余库存</el-col>
<el-col :span="4">福利可占库存</el-col>
......@@ -70,9 +63,7 @@
<span v-else class="state-point state-point-success">{{ item.welfareStatus == 2 ? '已删除' : '已过期' }}</span>
</el-col>
<el-col :span="3">
<dm-delete @confirm="delCard(item)" tips="删除后已占用库存将被释放,确认删除?">
<el-button type="text">删除</el-button>
</dm-delete>
<el-button @click="delCard(item)" type="text">删除</el-button>
</el-col>
</el-row>
<div v-if="item.remainedStock < ruleForm.packageStock" class="gray03"><i class="el-icon-warning mr5 danger-color"></i>卡券包库存大于福利库存,请调整福利占用库存</div>
......@@ -98,6 +89,7 @@
</template>
<script>
import { showConfirm } from '@/utils/common';
import { getTimesByReq } from '@/utils/common.js';
import { cardType } from '@/config/mapping/gic-card';
import { formatDateTimeByType } from '@/utils/index.js';
......@@ -209,16 +201,18 @@ export default {
},
// 删除卡券
delCard({ couponId }) {
const params = {
couponPackageId: this.couponPackageId,
couponId
};
this.cardLoading = false;
delPackageItem(params).then(res => {
this.cardLoading = false;
this.refreshCouponList();
}).catch(() => {
showConfirm('<div>确认删除该卡券吗?</div><div>删除后已占用库存将被释放</div>', () => {
const params = {
couponPackageId: this.couponPackageId,
couponId
};
this.cardLoading = false;
delPackageItem(params).then(res => {
this.cardLoading = false;
this.refreshCouponList();
}).catch(() => {
this.cardLoading = false;
});
});
},
refreshCouponList() {
......
......@@ -84,8 +84,7 @@
</el-table-column>
<el-table-column label="卡券包状态" min-width="120">
<template slot="header">
<el-tooltip placement="top" open-delay="200">
<div slot="content">使用中:在福利组件中展示;<br/>已过期:在福利组件中不展示;</div>
<el-tooltip placement="top" open-delay="200"><div slot="content">未生效:卡券包中无卡券,福利组件不展示;<br/>已生效:在福利组件中展示;<br/>已过期:在福利组件中不展示</div>
<span class="tooltip-icon">卡券包状态</span>
</el-tooltip>
</template>
......
......@@ -304,7 +304,7 @@ export default {
rules1: {
cardName: { required: true, message: '请输入卡券名称', trigger: 'blur' },
remarkName: { required: true, message: '请输入备注名称', trigger: 'blur' },
subTitle: { required: true, message: '请输入卡券副标题', trigger: 'blur' },
// subTitle: { required: true, message: '请输入卡券副标题', trigger: 'blur' },
denomination: { required: true, validator: validDenomination, trigger: 'blur' },
goodsDiscountCheckLower: { required: true, validator: validDiscount, type: 'min', trigger: 'blur' },
goodsDiscountCheck: { required: true, validator: validDiscount, type: 'max', trigger: 'blur' },
......
......@@ -29,9 +29,10 @@
<el-form-item prop="remarkName" label="备注名">
<dm-input class="w260" v-model="ruleForm1.remarkName" :byte-type="1" :maxlength="10" />
</el-form-item>
<el-form-item prop="subTitle" label="副标题">
<!-- 20210303 ui不要副标题 -->
<!-- <el-form-item prop="subTitle" label="副标题">
<dm-input class="w260" v-model="ruleForm1.subTitle" :byte-type="1" :maxlength="18"></dm-input>
</el-form-item>
</el-form-item> -->
<el-form-item class="is-required" prop="color" label="卡券颜色">
<div class="color-picker-custom">
<span class="color vertical-top">{{ ruleForm1.color }}</span>
......
......@@ -15,7 +15,7 @@
<el-form-item label="卡券类型">{{ info.cardType != undefined ? cardType[info.cardType].label : '--' }}</el-form-item>
<el-form-item label="卡券名称">{{ info.cardName }}</el-form-item>
<el-form-item label="备注名">{{ info.remarkName }}</el-form-item>
<el-form-item label="副标题">{{ info.subTitle }}</el-form-item>
<!-- <el-form-item label="副标题">{{ info.subTitle }}</el-form-item> -->
<el-form-item prop="color" label="卡券颜色">
<div class="color-picker-custom">
<span class="color vertical-top">{{ ruleForm.color }}</span>
......
......@@ -61,7 +61,7 @@
<div class="card">
<img :src="scope.row.imgUrl" draggable="false" />
<p class="name ellipsis-100" :title="scope.row.cardName">{{ scope.row.cardName }}</p>
<p :title="scope.row.subTitle" class="fz12 gray-lighter ellipsis-100" style="line-height:17px;">
<p :title="scope.row.remarkName" class="fz12 gray-lighter ellipsis-100" style="line-height:17px;">
<el-popover placement="top-start" width="300" trigger="hover" open-delay="200" :offset="-8">
<div class="gray01 fz14">
<p style="margin-bottom:5px;">福利ID:{{ scope.row.couponId }}</p>
......@@ -69,7 +69,7 @@
</div>
<i class="el-icon-question cursor fz12 gray-lighter" slot="reference"></i>
</el-popover>
{{ scope.row.subTitle }}
{{ scope.row.remarkName }}
</p>
</div>
</template>
......
<template>
<el-dialog title="批量导入券码" :visible.sync="visible" width="600px" @close="close" :close-on-click-modal="false" :show-close="!loading">
<div v-loading="loading">
<div>
<span class="mr15"><i class="danger-color mr5">*</i>选择文件:</span>
<el-upload :data="{ couponId }" :headers="{ isControl: true }" :with-credentials="true" :action="importCode" :show-file-list="false" :file-list="fileList" accept=".csv" class="inline-block" :on-progress="onProgress" :on-success="onSuccess" :on-error="onError" :before-upload="beforeUpload">
<el-button :disabled="loading" class="dashed upload" icon="iconfont-market4 icon-shangchuan mr5">{{ loading ? '上传中' : '点击上传'}}</el-button>
</el-upload>
<el-form label-width="120px">
<el-form-item label="选择文件" class="is-required">
<span class="file-style inline-block" style="position:relative">
<input style="position:absolute;top:3px;opacity:0;" type="file" name="file" accept=".csv" ref="file" @change="change">
<el-button class="dashed" @click="triggerClick"><i class="iconfont-components4 icon-cp-shangc upload-icon mr5"></i>上传</el-button>
</span>
<el-button type="text" class="ml10" @click="downloadCouponCSV">点击下载CSV模板</el-button>
<el-popover placement="bottom" width="350" trigger="hover">
<ul>
<li>1. 单次上传最多可支持 5000 条</li>
<li>2. 券码格式可由 6~20 位的数字或字母组成</li>
<li>3. 若券码为纯数字组成,为避免发生意外错误,请将其格式设置为 ‘文本’ 格式</li>
<li>4. 仅支持.csv 文件的导入 (建议直接下载模板,在模板的基础上进行数据的填充)</li>
</ul>
<el-button class="ml10" type="text" slot="reference">导入规则</el-button>
</el-popover>
<!-- <el-button type="text" class="ml10 hover-btn deep" @click="viewErrorList">导入失败记录</el-button> -->
<ul class="file-list">
<li v-for="(f, idx) in fileList" :key="idx">
......@@ -15,15 +24,11 @@
<i class="el-icon-success success-color fr"></i>
</li>
</ul>
</div>
<p class="rule">导入规则</p>
<ul>
<li>1. 单次上传最多可支持 5000 条</li>
<li>2. 券码格式可由 6~20 位的数字或字母组成</li>
<li>3. 若券码为纯数字组成,为避免发生意外错误,请将其格式设置为 ‘文本’ 格式</li>
<li>4. 仅支持.csv 文件的导入 (建议直接下载模板,在模板的基础上进行数据的填充)</li>
</ul>
</div>
</el-form-item>
<el-form-item label="调整备注" class="is-required" v-if="!isAdd">
<el-input type="textarea" v-model="remark" class="w260" :col="4" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :disabled="loading" @click="close">确认</el-button>
......@@ -32,7 +37,7 @@
</template>
<script>
import { SUCCESS_CODE } from '@/config';
// import { SUCCESS_CODE } from '@/config';
import { downloadCouponCSV, importCode } from '@/api/gic-card';
export default {
name: 'ImportCode',
......@@ -48,6 +53,11 @@ export default {
openType: {
type: String, // 打开方式
default: 'self', // self在本窗口打开 blank在新窗口打开
},
isAdd: {
// 新增点击上传直接上传 编辑展示备注,点击保存上传
type: Boolean,
default: true
}
},
data() {
......@@ -55,46 +65,35 @@ export default {
importCode,
loading: false,
fileList: [], // 已上传列表
file: {} // 储存当前上传文件
file: undefined, // 储存当前上传文件
remark: ''
};
},
methods: {
// 查看导入失败记录
viewErrorList() {
const { couponId } = this;
if(this.openType === 'self') {
this.$router.push(`/gic-card/code-error/list?id=${couponId}`);
} else {
// 新窗口
let routeData = this.$router.resolve({ path: '/gic-card/code-error/list', query: { id: couponId } });
window.open(routeData.href, '_blank');
}
},
beforeUpload(file) {
this.file = {
name: file.name,
size: file.size
};
return file;
},
onSuccess(res) {
if(res.code === SUCCESS_CODE) {
this.loading = false;
this.fileList.push({ ...this.file });
this.$emit('success', this.fileList);
this.file = {};
} else {
this.onError(res);
}
},
onError(error) {
this.file = {};
this.$tips({ message: error.message || '上传出错', type: 'error' });
this.loading = false;
change(e){
this.file = e.target.value;
},
onProgress() {
this.loading = true;
triggerClick() {
this.$refs.file.click();
},
// change(e){
// console.log(e.target.value);
// this.file = e.target.files[0];
// },
// upload(){
// this.change();
// },
// 查看导入失败记录
// viewErrorList() {
// const { couponId } = this;
// if(this.openType === 'self') {
// this.$router.push(`/gic-card/code-error/list?id=${couponId}`);
// } else {
// // 新窗口
// let routeData = this.$router.resolve({ path: '/gic-card/code-error/list', query: { id: couponId } });
// window.open(routeData.href, '_blank');
// }
// },
downloadCouponCSV() {
window.open(downloadCouponCSV);
},
......@@ -107,29 +106,41 @@ export default {
</script>
<style lang="scss" scoped>
.upload {
display: inline-block;
width: 175px;
line-height: 15px !important;
.file-style:hover .upload-trigger {
border-color: $blue;
}
.upload-ele .el-button {
border: none;
color: #c0c4cc;
/* margin-left: 16px; */
}
.upload-ele .el-button--small {
padding: 0;
}
.file-list {
margin-left: 95px;
li {
height:37px;
line-height:37px;
background:rgba(242,243,247,1);
border-radius:2px;
margin-bottom: 5px;
padding-left: 13px;
padding-right: 27px;
margin-top: 10px;
i {
margin-top: 12px;
.uploadText p{
line-height: 26px;
}
.pickup-upload{
display: inline-block;
vertical-align: top;
// margin-left: 10px;
.upload-trigger{
border-style: dashed;
margin-right: 10px;
.upload-icon {
font-size: 14px;
}
p {
display: inline-block;
width: 80%;
margin-left: 5px;
}
.pickup-list {
margin-top: 18px;
.pickup-list-name {
font-size: 14px;
font-weight: 400;
color: $gray01;
line-height: 20px;
.file-icon {
font-size: 14px;
}
}
}
}
......
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