Commit eafe3c48 by chenxin

fix: 卡券包

parent 7653e1ce
......@@ -68,8 +68,4 @@ realGift = getFetch(realGift, welfarePrefix);
export default { ...realGift };
// export const downloadCouponCSV = config.api + marketPrefix + '/download-code-csv-template'; // 下载导入GIC券号csv示例文件 TODO:
// export const importCode = config.api + marketPrefix + '/import-gic-custom-code'; // 导入券码 TODO:
// export const importDestoryCode = marketPrefix + '/destroy-plugin/import-destroy-code'; // 上传销毁code列表 TODO:
// export const downloadDestroyCodeTemplate = config.api + marketPrefix + '/destroy-plugin/download-destroy-code-template'; // 下载销毁模板示例 TODO:
export const getGiftLoginUser = config.api + commonPrefix + '/user/get-login-user'; // 获取商户名称
......@@ -42,27 +42,36 @@
<el-button type="text" @click="addCard" class="ml5">保存</el-button>
</div>
</div>
<el-table v-if=" couponList.length" :data="couponList" v-loading="cardLoading">
<el-table-column prop="date" label="卡券信息" min-width="200">
<!-- 卡券类型(0:抵金券,1:折扣券,2:兑换券, 3: 其他券) -->
<template slot-scope="scope">
<el-tag class="mr5">{{ cardType[scope.row.cardType].label }}</el-tag>{{ scope.row.cardName }}
</template>
</el-table-column>
<el-table-column prop="date" label="有效期" min-width="200">
<span slot-scope="scope" v-html="effectiveDateFormate(scope.row)"></span>
</el-table-column>
<el-table-column prop="occupyStock" label="卡券包内剩余库存" min-width="200"> </el-table-column>
<el-table-column prop="remainedStock" label="福利可占库存" min-width="180"> </el-table-column>
<el-table-column prop="date" label="福利状态" min-width="180"> </el-table-column>
<el-table-column label="操作" width="120">
<template slot-scope="scope">
<dm-delete @confirm="delCard(scope.row)" tips="删除后已占用库存将被释放,确认删除?">
<el-button type="text">删除</el-button>
</dm-delete>
</template>
</el-table-column>
</el-table>
<div class="imitation-table" 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="4">卡券包内剩余库存</el-col>
<el-col :span="4">福利可占库存</el-col>
<el-col :span="3">福利状态</el-col>
<el-col :span="3">操作</el-col>
</el-row>
<div class="tbody">
<div class="td" v-for="(item, idx) in couponList" :key="idx">
<el-row>
<el-col :span="5">
<el-tag class="mr5">{{ cardType[item.cardType].label }}</el-tag>
<router-link target="_blank" :to="{path:'/gic-card/info',query:{ id: item.couponId }}">{{ item.cardName }}</router-link>
</el-col>
<el-col :span="5"><span v-html="effectiveDateFormate(item)"></span></el-col>
<el-col :span="4">{{ item.remainedStock }}</el-col>
<el-col :span="4">{{ item.occupyStock }}</el-col>
<el-col :span="3">没给</el-col>
<el-col :span="3">
<dm-delete @confirm="delCard(item)" tips="删除后已占用库存将被释放,确认删除?">
<el-button type="text">删除</el-button>
</dm-delete>
</el-col>
</el-row>
<div v-if="item.remainedStock < ruleForm.packageStock" class="gray03"><i class="el-icon-warning mr5 danger-color"></i>卡券包库存大于福利库存,请调整福利占用库存</div>
</div>
</div>
</div>
</el-form-item>
</el-form>
<div class="hidden">
......@@ -199,8 +208,8 @@ export default {
Object.keys(this.ruleForm).map(v => {
this.ruleForm[v] = info[v];
});
// this.stockType = info.stockUseType == 2 ? :
// params.stockUseType = this.stockType.length == 2 ? 2 : this.stockType[0];
// 库存使用类型(0:占用,1:动态 , 2占用+动态)
this.stockType = info.stockUseType == 2 ? [ 0, 1 ] : [ info.stockUseType ] ;
this.dateTime = [ info.beginDate, info.endDate ];
this.couponList = res.result.couponList || [];
}).finally(() => {
......@@ -238,6 +247,16 @@ export default {
},
// 编辑卡券包
editForm() {
let flag = false;
this.couponList.forEach(v => {
if(v.remainedStock < this.ruleForm.packageStock && v.remainedStock) {
flag = true;
}
});
if(flag) {
this.$tips({ message: '卡券包库存大于福利库存,请调整福利占用库存', type: 'error' });
return;
}
const params = {
couponPackageId: this.couponPackageId,
count: Math.abs(this.info.packageStock - this.ruleForm.packageStock),
......
......@@ -228,27 +228,13 @@ export default {
this.listParams.sortOrder = this.sortType1;
this.refresh();
},
effectiveDateFormate(item = {}) {
const { cardEffectiveMode, startDate, expireDate, effectTimeMode, expireTimeCount, effectTimeCount } = item;
effectiveDateFormate({ cardEffectiveMode, startDate, expireDate, effectTimeMode, expireTimeCount, effectTimeCount }) {
if (cardEffectiveMode === 0) {
return `<p>${formatDateTimeByType(startDate, 'yyyy-MM-dd')} ~ </p><p>${ formatDateTimeByType(expireDate, 'yyyy-MM-dd') }</p>`;
}
if (cardEffectiveMode === 1) {
// 领取后第{{ info.effectTimeCount }}{{ info.effectTimeMode ? '月' : '天' }} - {{ info.expireTimeCount + info.effectTimeCount - 1 }}{{ info.effectTimeMode ? '月' : '天' }}
const unit = effectTimeMode ? '月' : '天';
let pre = '';
switch (effectTimeCount) {
case 1:
pre = '当';
break;
case 2:
pre = '次';
break;
default:
pre = effectTimeCount;
break;
}
return `<p>领取后${pre}${unit}生效,</p><p>有效天数${expireTimeCount}${unit}</p>`;
return `<p>领取后${effectTimeCount == 1 ? '当' : effectTimeCount == 2 ? '次' : effectTimeCount}${unit}生效,</p><p>有效天数${expireTimeCount}${unit}</p>`;
}
return '--';
},
......
......@@ -63,7 +63,7 @@
<li>核销渠道:{{ formatChannel(scope.row) }}</li>
<li>核销门店/店铺:{{ scope.row.verifyStoreCode || '--' }}/{{ scope.row.verifyStoreName || '--' }}</li>
</template>
<li v-if="scope.row.statusFlag == 7">销毁时间:{{ scope.row.verifyTime }}</li>
<li v-if="scope.row.statusFlag == 7">销毁时间:{{ scope.row.destroyTime }}</li>
</ul>
<i class="el-icon-more cursor" slot="reference"></i>
</el-popover>
......
......@@ -36,11 +36,6 @@ module.exports = {
// .options({ bypassOnDebug: true })
// .end();
// ============压缩图片 end============
// config.module
// .rule('images')
// .use('url-loader')
// .loader('url-loader')
// .tap(options => Object.assign(options, { limit: 2000 }))
},
configureWebpack: config => {
config.externals = {
......
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