|
@@ -24,7 +24,7 @@
|
|
|
:inline="true"
|
|
|
label-width="88px"
|
|
|
>
|
|
|
- <!--
|
|
|
+ <!--
|
|
|
<el-form-item label="设备类型" prop="deviceType">
|
|
|
<el-select
|
|
|
v-model="createForm.deviceType"
|
|
@@ -47,7 +47,7 @@
|
|
|
</el-form-item>
|
|
|
-->
|
|
|
<el-form-item>
|
|
|
- <!--
|
|
|
+ <!--
|
|
|
<el-button
|
|
|
type="cyan"
|
|
|
icon="el-icon-search"
|
|
@@ -73,6 +73,7 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<el-table :data="couponList">
|
|
|
+ <af-table-column label="优惠券标识" align="center" prop="couponSign" />
|
|
|
<af-table-column label="优惠券名称" align="center" prop="couponName" />
|
|
|
<af-table-column label="状态" align="center">
|
|
|
<template slot-scope="scope">
|
|
@@ -86,47 +87,97 @@
|
|
|
</af-table-column>
|
|
|
<af-table-column label="卡片类型" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- {{scope.row.couponType == 1 ? '现金劵' + '--面值:' + scope.row.couponAmt + '元' : ''}}
|
|
|
- {{scope.row.couponType == 2 ? '折扣券' + '--折扣:' + scope.row.couponAmt + '% ' : ''}}
|
|
|
- {{scope.row.couponType == 3 ? '兑换券' + '--商品:' + scope.row.couponDetails : ''}}
|
|
|
+ {{
|
|
|
+ scope.row.couponType == 1
|
|
|
+ ? "现金劵" + "--面值:" + scope.row.couponAmt + "元"
|
|
|
+ : ""
|
|
|
+ }}
|
|
|
+ {{
|
|
|
+ scope.row.couponType == 2
|
|
|
+ ? "折扣券" + "--折扣:" + scope.row.couponAmt + "% "
|
|
|
+ : ""
|
|
|
+ }}
|
|
|
+ {{
|
|
|
+ scope.row.couponType == 3
|
|
|
+ ? "兑换券" + "--商品:" + scope.row.couponDetails
|
|
|
+ : ""
|
|
|
+ }}
|
|
|
</template>
|
|
|
</af-table-column>
|
|
|
<af-table-column label="使用门槛" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- {{scope.row.couponType == 1 || scope.row.couponType == 2 ? (scope.row.couponThresholdAmt == 0 ? '无门槛':'满' + scope.row.couponThresholdAmt + '元可用') : ''}}
|
|
|
- {{scope.row.couponType == 3 ? '------------' : ''}}
|
|
|
+ {{
|
|
|
+ scope.row.couponType == 1 || scope.row.couponType == 2
|
|
|
+ ? scope.row.couponThresholdAmt == 0
|
|
|
+ ? "无门槛"
|
|
|
+ : "满" + scope.row.couponThresholdAmt + "元可用"
|
|
|
+ : ""
|
|
|
+ }}
|
|
|
+ {{ scope.row.couponType == 3 ? "------------" : "" }}
|
|
|
</template>
|
|
|
</af-table-column>
|
|
|
<af-table-column label="适用油品" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- {{scope.row.couponType == 1 || scope.row.couponType == 2 ? ((scope.row.oilNameList||[]).toString()) : ''}}
|
|
|
- {{scope.row.couponType == 3 ? '------------' : ''}}
|
|
|
+ {{
|
|
|
+ scope.row.couponType == 1 || scope.row.couponType == 2
|
|
|
+ ? (scope.row.oilNameList || []).toString()
|
|
|
+ : ""
|
|
|
+ }}
|
|
|
+ {{ scope.row.couponType == 3 ? "------------" : "" }}
|
|
|
</template>
|
|
|
</af-table-column>
|
|
|
|
|
|
<af-table-column label="使用状态" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- {{"共生成了" + scope.row.couponNum + "张,已领取" + scope.row.couponCumulativeNum + '张,已使用'+ scope.row.couponUseNum +'张' }}
|
|
|
+ {{
|
|
|
+ "共生成了" +
|
|
|
+ scope.row.couponNum +
|
|
|
+ "张,已领取" +
|
|
|
+ scope.row.couponCumulativeNum +
|
|
|
+ "张,已使用" +
|
|
|
+ scope.row.couponUseNum +
|
|
|
+ "张"
|
|
|
+ }}
|
|
|
</template>
|
|
|
</af-table-column>
|
|
|
|
|
|
<af-table-column label="有效期内使用限制" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ (scope.row.effectiveTimeType == 1 ? scope.row.effectiveTime[0] + '到' + scope.row.effectiveTime[1] : '用户领取'+ scope.row.effectiveDayNum +'天内有效' ) + '内有效'}}
|
|
|
- {{ translateTime(scope.row) }}
|
|
|
+ {{
|
|
|
+ (scope.row.effectiveTimeType == 1
|
|
|
+ ? scope.row.effectiveTime[0] + "到" + scope.row.effectiveTime[1]
|
|
|
+ : "用户领取" + scope.row.effectiveDayNum + "天内有效") +
|
|
|
+ "内有效"
|
|
|
+ }}
|
|
|
+ {{ translateTime(scope.row) }}
|
|
|
</template>
|
|
|
</af-table-column>
|
|
|
|
|
|
<af-table-column label="领取限制" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ "单用户最多持有" + scope.row.couponHoldNum + '张,累计可拥有'+ scope.row.couponReceiveNum +'张' }}
|
|
|
+ {{
|
|
|
+ "单用户最多持有" +
|
|
|
+ scope.row.couponHoldNum +
|
|
|
+ "张,累计可拥有" +
|
|
|
+ scope.row.couponReceiveNum +
|
|
|
+ "张"
|
|
|
+ }}
|
|
|
</template>
|
|
|
</af-table-column>
|
|
|
|
|
|
<af-table-column label="优惠叠加" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- {{scope.row.couponType == 1 || scope.row.couponType == 2 ? ['不',''][scope.row.isCardFlag] + '可用电子卡,' + ['不',''][scope.row.isGradeFlag] + '可用等级优惠,' + ['不',''][scope.row.isMarketFlag] + '可用优惠方案': ''}}
|
|
|
- {{scope.row.couponType == 3 ? '------------' : ''}}
|
|
|
+ {{
|
|
|
+ scope.row.couponType == 1 || scope.row.couponType == 2
|
|
|
+ ? ["不", ""][scope.row.isCardFlag] +
|
|
|
+ "可用电子卡," +
|
|
|
+ ["不", ""][scope.row.isGradeFlag] +
|
|
|
+ "可用等级优惠," +
|
|
|
+ ["不", ""][scope.row.isMarketFlag] +
|
|
|
+ "可用优惠方案"
|
|
|
+ : ""
|
|
|
+ }}
|
|
|
+ {{ scope.row.couponType == 3 ? "------------" : "" }}
|
|
|
</template>
|
|
|
</af-table-column>
|
|
|
|
|
@@ -157,7 +208,7 @@
|
|
|
:autoScroll="true"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div v-else style="text-align:center">
|
|
|
+ <div v-else style="text-align: center">
|
|
|
亲,您的油站暂未启动优惠券功能,呦~
|
|
|
</div>
|
|
|
|
|
@@ -176,7 +227,47 @@
|
|
|
:rules="rules"
|
|
|
label-width="180px"
|
|
|
>
|
|
|
- <el-form-item label="优惠劵名称(油站备注)" prop="couponName">
|
|
|
+ <el-form-item
|
|
|
+ label="优惠劵标识(给油站备注)"
|
|
|
+ prop="couponSign"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请填写优惠券标识',
|
|
|
+ trigger: 'blur',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <input
|
|
|
+ type="text"
|
|
|
+ class="form-control"
|
|
|
+ v-model="createForm.couponSign"
|
|
|
+ style="width: 180px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="优惠券类型"
|
|
|
+ prop="couponType"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请选择优惠券类型',
|
|
|
+ trigger: 'change',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-radio-group v-model="createForm.couponType">
|
|
|
+ <el-radio label="1">现金券</el-radio>
|
|
|
+ <el-radio label="2">折扣劵</el-radio>
|
|
|
+ <el-radio label="3">兑换劵</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="优惠劵名称(给用户展示)"
|
|
|
+ prop="couponName"
|
|
|
+ v-if="createForm.couponType == 3"
|
|
|
+ :rules="{
|
|
|
+ required: createForm.couponType == 3,
|
|
|
+ message: '请填写优惠券名称',
|
|
|
+ trigger: 'blur',
|
|
|
+ }"
|
|
|
+ >
|
|
|
<input
|
|
|
type="text"
|
|
|
class="form-control"
|
|
@@ -184,7 +275,15 @@
|
|
|
style="width: 180px"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="优惠劵内容(用户展示)" prop="couponDetails">
|
|
|
+ <el-form-item
|
|
|
+ label="优惠劵说明(给用户展示)"
|
|
|
+ prop="couponDetails"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请填写优惠券说明',
|
|
|
+ trigger: 'blur',
|
|
|
+ }"
|
|
|
+ >
|
|
|
<input
|
|
|
type="text"
|
|
|
class="form-control"
|
|
@@ -192,7 +291,16 @@
|
|
|
style="width: 180px"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="优惠劵使用条件" prop="couponThresholdAmt">
|
|
|
+ <el-form-item
|
|
|
+ label="优惠劵使用条件"
|
|
|
+ prop="couponThresholdAmt"
|
|
|
+ v-if="createForm.couponType == 1 || createForm.couponType == 2"
|
|
|
+ :rules="{
|
|
|
+ required: createForm.couponType == 1 || createForm.couponType == 2,
|
|
|
+ message: '请填写优惠券适用条件',
|
|
|
+ trigger: 'blur',
|
|
|
+ }"
|
|
|
+ >
|
|
|
<div>
|
|
|
满
|
|
|
<input
|
|
@@ -205,17 +313,15 @@
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="优惠券类型" prop="couponType">
|
|
|
- <el-radio-group v-model="createForm.couponType">
|
|
|
- <el-radio label="1">现金券</el-radio>
|
|
|
- <el-radio label="2">折扣劵</el-radio>
|
|
|
- <el-radio label="3">兑换劵</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
<el-form-item
|
|
|
label="优惠金额"
|
|
|
prop="couponAmt"
|
|
|
v-if="createForm.couponType == 1 || createForm.couponType == 2"
|
|
|
+ :rules="{
|
|
|
+ required: createForm.couponType == 1 || createForm.couponType == 2,
|
|
|
+ message: '请填写优惠券适用条件',
|
|
|
+ trigger: 'blur',
|
|
|
+ }"
|
|
|
>
|
|
|
<div v-if="createForm.couponType == 1">
|
|
|
固定面值—<input
|
|
@@ -288,7 +394,15 @@
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="生成优惠券的数量" prop="couponNum">
|
|
|
+ <el-form-item
|
|
|
+ label="生成优惠券的数量"
|
|
|
+ prop="couponNum"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请填写生成数量',
|
|
|
+ trigger: 'blur',
|
|
|
+ }"
|
|
|
+ >
|
|
|
共生成
|
|
|
<input
|
|
|
type="text"
|
|
@@ -298,7 +412,15 @@
|
|
|
/>
|
|
|
张
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="单人可持有数量" prop="couponHoldNum">
|
|
|
+ <el-form-item
|
|
|
+ label="单人可持有数量"
|
|
|
+ prop="couponHoldNum"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请填写单人可持有的数量',
|
|
|
+ trigger: 'blur',
|
|
|
+ }"
|
|
|
+ >
|
|
|
单个用户最多持有
|
|
|
<input
|
|
|
type="text"
|
|
@@ -308,7 +430,15 @@
|
|
|
/>
|
|
|
张优惠券
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="累计可拥有数量" prop="couponReceiveNum">
|
|
|
+ <el-form-item
|
|
|
+ label="累计可拥有数量"
|
|
|
+ prop="couponReceiveNum"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请填写单人累计可持有的数量',
|
|
|
+ trigger: 'blur',
|
|
|
+ }"
|
|
|
+ >
|
|
|
单个用户累计可以拥有
|
|
|
<input
|
|
|
type="text"
|
|
@@ -323,6 +453,11 @@
|
|
|
label="用券时可用电子卡"
|
|
|
prop="isCardFlag"
|
|
|
v-if="createForm.couponType == 1 || createForm.couponType == 2"
|
|
|
+ :rules="{
|
|
|
+ required: createForm.couponType == 1 || createForm.couponType == 2,
|
|
|
+ message: '请选择用劵时是否可用电子卡',
|
|
|
+ trigger: 'change',
|
|
|
+ }"
|
|
|
>
|
|
|
<el-radio-group v-model="createForm.isCardFlag">
|
|
|
<el-radio label="1">可以使用电子卡</el-radio>
|
|
@@ -333,6 +468,11 @@
|
|
|
label="用券时叠加等级优惠"
|
|
|
prop="isGradeFlag"
|
|
|
v-if="createForm.couponType == 1 || createForm.couponType == 2"
|
|
|
+ :rules="{
|
|
|
+ required: createForm.couponType == 1 || createForm.couponType == 2,
|
|
|
+ message: '请选择用劵时是否叠加等级优惠',
|
|
|
+ trigger: 'change',
|
|
|
+ }"
|
|
|
>
|
|
|
<el-radio-group v-model="createForm.isGradeFlag">
|
|
|
<el-radio label="1">叠加等级优惠</el-radio>
|
|
@@ -343,6 +483,11 @@
|
|
|
label="用劵时叠加优惠方案"
|
|
|
prop="isMarketFlag"
|
|
|
v-if="createForm.couponType == 1 || createForm.couponType == 2"
|
|
|
+ :rules="{
|
|
|
+ required: createForm.couponType == 1 || createForm.couponType == 2,
|
|
|
+ message: '请选择用劵时叠加优惠方案',
|
|
|
+ trigger: 'change',
|
|
|
+ }"
|
|
|
>
|
|
|
<el-radio-group v-model="createForm.isMarketFlag">
|
|
|
<el-radio label="1">叠加优惠方案</el-radio>
|
|
@@ -351,31 +496,33 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
label="有效期内可用时间控制"
|
|
|
- prop="isMarketFlag2"
|
|
|
- v-if="createForm.couponType == 1 || createForm.couponType == 2"
|
|
|
+ prop="availableControl"
|
|
|
>
|
|
|
- <el-radio-group v-model="createForm.availableControl" @change="availableControlChange">
|
|
|
- <el-radio label="0">有效期内一直都可用</el-radio>
|
|
|
- <el-radio label="1">有效期内每周指定日</el-radio>
|
|
|
- <el-radio label="2">有效期内每月指定日</el-radio>
|
|
|
- <el-radio label="3">有效期内固定指定日</el-radio>
|
|
|
+ <el-radio-group
|
|
|
+ v-model="createForm.availableControl"
|
|
|
+ @change="availableControlChange"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <el-radio label="0">有效期内一直都可用</el-radio>
|
|
|
+ <el-radio label="1">有效期内每周指定日</el-radio>
|
|
|
+ <el-radio label="2">有效期内每月指定日</el-radio>
|
|
|
+ <el-radio label="3">有效期内固定指定日</el-radio>
|
|
|
+ </div>
|
|
|
+ <div style="margin-top: 10px">
|
|
|
+ <select-day
|
|
|
+ :type="createForm.availableControl"
|
|
|
+ :day.sync="createForm.appointedDaysList"
|
|
|
+ :cycle.sync="createForm.cycleDaysList"
|
|
|
+ ></select-day>
|
|
|
+ </div>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
- label="可用时间选择"
|
|
|
- prop="isMarketFlag1"
|
|
|
- v-if="createForm.availableControl == 1 || createForm.availableControl == 2 || createForm.availableControl == 3"
|
|
|
- >
|
|
|
- <div>
|
|
|
- <select-day :type="createForm.availableControl" :day.sync="createForm.appointedDaysList" :cycle.sync="createForm.cycleDaysList"></select-day>
|
|
|
- </div>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item
|
|
|
label="优惠券的核销方"
|
|
|
- prop="couponType"
|
|
|
+ prop="verificationList"
|
|
|
v-if="createForm.couponType == 3"
|
|
|
>
|
|
|
- (自己的站点也是核销商)
|
|
|
+ (自己的站点是默认必选的核销商)
|
|
|
</el-form-item>
|
|
|
<div v-if="createForm.couponType == 3">
|
|
|
<el-col :span="11">
|
|
@@ -476,25 +623,80 @@
|
|
|
import { listPrice } from "@/api/station/price";
|
|
|
import SelectDay from "@/components/SelectDay";
|
|
|
|
|
|
-import { addInfo, verificationList, listInfo, updateInfo, changeCouponStatus } from "@/api/coupon";
|
|
|
+import {
|
|
|
+ addInfo,
|
|
|
+ verificationList,
|
|
|
+ listInfo,
|
|
|
+ updateInfo,
|
|
|
+ changeCouponStatus,
|
|
|
+} from "@/api/coupon";
|
|
|
import { updateDept } from "@/api/system/dept";
|
|
|
|
|
|
export default {
|
|
|
name: "Station_Equipment",
|
|
|
data() {
|
|
|
- let validateGunNo = (rule, value, callback) => {
|
|
|
+ let validateOilNameList = (rule, value, callback) => {
|
|
|
+ console.log(value);
|
|
|
+ if (value.length == 0) {
|
|
|
+ callback(new Error("请选择优惠券的使用油品"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
callback();
|
|
|
};
|
|
|
+ let validateEffectiveTimeType = (rule, value, callback) => {
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error("请填入有效时间"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (value == 1) {
|
|
|
+ if (this.createForm.effectiveTime.length == 0) {
|
|
|
+ callback(new Error("请选择有效时间"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (value == 2) {
|
|
|
+ if (!this.createForm.effectiveDayNum) {
|
|
|
+ callback(new Error("请填入有效天数"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ callback();
|
|
|
+ };
|
|
|
+ let validateAvailableControl = (rule, value, callback)=>{
|
|
|
+ if(this.createForm.availableControl == 1 || this.createForm.availableControl == 2){
|
|
|
+ if(this.createForm.cycleDaysList.length == 0){
|
|
|
+ callback(new Error("请选择时间"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(this.createForm.availableControl == 3){
|
|
|
+ if(this.createForm.cycleDaysList.length == 0){
|
|
|
+ callback(new Error("请选择日期"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ callback()
|
|
|
+ };
|
|
|
+ // let validateVerificationList = (rule, value, callback)=>{
|
|
|
+ // if(this.createForm.couponType == 3){
|
|
|
+ // if(this.createForm.validateVerificationList.length == 0){
|
|
|
+ // callback(new Error("请选择核销机构"));
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // callback()
|
|
|
+ // };
|
|
|
return {
|
|
|
couponEnabledFlag: "1",
|
|
|
pageStatus: 4,
|
|
|
// 油站设备管理表格数据
|
|
|
createForm: {
|
|
|
+ couponSign: "",
|
|
|
couponName: "",
|
|
|
couponDetails: "",
|
|
|
couponThresholdAmt: 0,
|
|
|
couponType: "1",
|
|
|
- couponAmt: '',
|
|
|
+ couponAmt: "",
|
|
|
oilNameList: [],
|
|
|
effectiveTimeType: "", //有效时间类型: 1,固定时间;2,领取后x天内有效
|
|
|
effectiveTime: [],
|
|
@@ -507,16 +709,15 @@ export default {
|
|
|
isCardFlag: "1",
|
|
|
isGradeFlag: "1",
|
|
|
isMarketFlag: "1",
|
|
|
- availableControl:"0",
|
|
|
- appointedDaysList:[],
|
|
|
- cycleDaysList:[],
|
|
|
+ availableControl: "0",
|
|
|
+ appointedDaysList: [],
|
|
|
+ cycleDaysList: [],
|
|
|
},
|
|
|
couponList: [],
|
|
|
oilNameList: [],
|
|
|
- allVerificationList: [
|
|
|
- ],
|
|
|
- day:[],
|
|
|
- cycle:[],
|
|
|
+ allVerificationList: [],
|
|
|
+ day: [],
|
|
|
+ cycle: [],
|
|
|
|
|
|
deviceTypeOptions: [],
|
|
|
stationOptions: [],
|
|
@@ -538,7 +739,24 @@ export default {
|
|
|
pageSize: 10, // 初始值只能比10大
|
|
|
},
|
|
|
// 表单校验
|
|
|
- rules: {},
|
|
|
+ rules: {
|
|
|
+ oilNameList: [
|
|
|
+ { required: true, message: "请选择适用油品", trigger: "change" },
|
|
|
+ { validator: validateOilNameList, trigger: "change" },
|
|
|
+ ],
|
|
|
+ effectiveTimeType: [
|
|
|
+ { required: true, message: "请输入有效期类型", trigger: "change" },
|
|
|
+ { validator: validateEffectiveTimeType, trigger: "change" },
|
|
|
+ ],
|
|
|
+ availableControl:[
|
|
|
+ { required: true, message: "请选择有效期内时间控制", trigger: "change" },
|
|
|
+ { validator: validateAvailableControl, trigger: "change" },
|
|
|
+ ],
|
|
|
+ // verificationList:[
|
|
|
+ // { required: true, message: "请选择核销机构", trigger: "change" },
|
|
|
+ // { validator: validateVerificationList, trigger: "change" },
|
|
|
+ // ],
|
|
|
+ },
|
|
|
timeSelect: [
|
|
|
,
|
|
|
["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
|
|
@@ -592,7 +810,7 @@ export default {
|
|
|
},
|
|
|
selectedCouponList() {
|
|
|
return this.allVerificationList.filter((ele) => {
|
|
|
- if(this.createForm.verificationList == null) {
|
|
|
+ if (this.createForm.verificationList == null) {
|
|
|
this.createForm.verificationList = [];
|
|
|
}
|
|
|
return this.createForm.verificationList.includes(ele.deptId);
|
|
@@ -600,24 +818,24 @@ export default {
|
|
|
},
|
|
|
unselectedCouponList() {
|
|
|
return this.allVerificationList.filter((ele) => {
|
|
|
- if(this.createForm.verificationList == null) {
|
|
|
+ if (this.createForm.verificationList == null) {
|
|
|
this.createForm.verificationList = [];
|
|
|
}
|
|
|
return !!!this.createForm.verificationList.includes(ele.deptId);
|
|
|
});
|
|
|
- },
|
|
|
+ },
|
|
|
},
|
|
|
components: {
|
|
|
- 'SelectDay': SelectDay
|
|
|
+ SelectDay: SelectDay,
|
|
|
},
|
|
|
methods: {
|
|
|
translateTime(row) {
|
|
|
let timeString = "";
|
|
|
const availableControleType = row.availableControl;
|
|
|
- if(availableControleType == 0){
|
|
|
- return ',有效期内一直都可以领取'
|
|
|
+ if (availableControleType == 0) {
|
|
|
+ return ",有效期内一直都可以领取";
|
|
|
}
|
|
|
- timeString = ',且用户只能在'
|
|
|
+ timeString = ",且用户只能在";
|
|
|
if (availableControleType == 1) {
|
|
|
timeString += "每周的";
|
|
|
}
|
|
@@ -638,37 +856,38 @@ export default {
|
|
|
timeString = timeString.replace(/(、)$/g, "") + "可以使用劵";
|
|
|
return timeString;
|
|
|
},
|
|
|
- getTodayDateString(){
|
|
|
- const date = new Date()
|
|
|
+ getTodayDateString() {
|
|
|
+ const date = new Date();
|
|
|
let y = date.getFullYear();
|
|
|
let m = date.getMonth().toString();
|
|
|
let s = date.getDate().toString();
|
|
|
- m = '' + (m.length == 1 ? '0':'') + m
|
|
|
- s = '' + (s.length == 1 ? '0':'') + s
|
|
|
- console.log('' + h + ':' + m +':' + s)
|
|
|
- return '' + y + ':' + m +':' + s
|
|
|
+ m = "" + (m.length == 1 ? "0" : "") + m;
|
|
|
+ s = "" + (s.length == 1 ? "0" : "") + s;
|
|
|
+ console.log("" + h + ":" + m + ":" + s);
|
|
|
+ return "" + y + ":" + m + ":" + s;
|
|
|
},
|
|
|
- availableControlChange(){
|
|
|
+ availableControlChange() {
|
|
|
this.createForm.appointedDaysList = [];
|
|
|
this.createForm.cycleDaysList = [];
|
|
|
- this.createForm = {...this.createForm}
|
|
|
+ this.createForm = { ...this.createForm };
|
|
|
},
|
|
|
- handleMoveLabel(direction, row){
|
|
|
- console.log(row)
|
|
|
- if(this.createForm.verificationList == null) {
|
|
|
+ handleMoveLabel(direction, row) {
|
|
|
+ console.log(row);
|
|
|
+ if (this.createForm.verificationList == null) {
|
|
|
this.createForm.verificationList = [];
|
|
|
}
|
|
|
|
|
|
- if(direction == "right"){
|
|
|
- this.createForm.verificationList.push(row.deptId)
|
|
|
- }else{
|
|
|
- this.createForm.verificationList = this.createForm.verificationList.filter((ele)=>{
|
|
|
- return ele != row.deptId
|
|
|
- })
|
|
|
+ if (direction == "right") {
|
|
|
+ this.createForm.verificationList.push(row.deptId);
|
|
|
+ } else {
|
|
|
+ this.createForm.verificationList =
|
|
|
+ this.createForm.verificationList.filter((ele) => {
|
|
|
+ return ele != row.deptId;
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
handleFlagChange() {
|
|
|
- const that = this
|
|
|
+ const that = this;
|
|
|
let text = this.couponEnabledFlag === "1" ? "启用" : "停用";
|
|
|
this.$confirm('确认要"' + text + '"优惠券功能吗?', "警告", {
|
|
|
confirmButtonText: "确定",
|
|
@@ -838,11 +1057,12 @@ export default {
|
|
|
handleAdd() {
|
|
|
this.title = "添加优惠券";
|
|
|
this.createForm = {
|
|
|
+ couponSign: "",
|
|
|
couponName: "",
|
|
|
couponDetails: "",
|
|
|
couponThresholdAmt: 0,
|
|
|
couponType: "1",
|
|
|
- couponAmt: '',
|
|
|
+ couponAmt: "",
|
|
|
oilNameList: [],
|
|
|
effectiveTimeType: "", //有效时间类型: 1,固定时间;2,领取后x天内有效
|
|
|
effectiveTime: [],
|
|
@@ -855,10 +1075,10 @@ export default {
|
|
|
isCardFlag: "1",
|
|
|
isGradeFlag: "1",
|
|
|
isMarketFlag: "1",
|
|
|
- availableControl:"0",
|
|
|
- appointedDaysList:[],
|
|
|
- cycleDaysList:[],
|
|
|
- }
|
|
|
+ availableControl: "0",
|
|
|
+ appointedDaysList: [],
|
|
|
+ cycleDaysList: [],
|
|
|
+ };
|
|
|
this.open = true;
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
@@ -873,32 +1093,35 @@ export default {
|
|
|
submitForm() {
|
|
|
this.$refs["dialogForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if(!!this.createForm.id){
|
|
|
- updateInfo(this.createForm).then((res) => {
|
|
|
- if(res.code == 200){
|
|
|
- this.msgSuccess("亲,修改成功了~")
|
|
|
- this.getCoupon()
|
|
|
- this.open = false
|
|
|
- }else{
|
|
|
- throw new Error("");
|
|
|
- }
|
|
|
- }).catch((err) => {
|
|
|
- this.msgError("修改失败了呀~")
|
|
|
- });
|
|
|
- }else{
|
|
|
- addInfo(this.createForm).then((res) => {
|
|
|
- if(res.code == 200){
|
|
|
- this.msgSuccess("亲,新增成功了~")
|
|
|
- this.getCoupon()
|
|
|
- this.open = false
|
|
|
- }else{
|
|
|
- throw new Error("");
|
|
|
- }
|
|
|
- }).catch((err)=>{
|
|
|
- this.msgError("创建优惠劵失败了~")
|
|
|
- });
|
|
|
+ if (!!this.createForm.id) {
|
|
|
+ updateInfo(this.createForm)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.msgSuccess("亲,修改成功了~");
|
|
|
+ this.getCoupon();
|
|
|
+ this.open = false;
|
|
|
+ } else {
|
|
|
+ throw new Error("");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.msgError("修改失败了呀~");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addInfo(this.createForm)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.msgSuccess("亲,新增成功了~");
|
|
|
+ this.getCoupon();
|
|
|
+ this.open = false;
|
|
|
+ } else {
|
|
|
+ throw new Error("");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.msgError("创建优惠劵失败了~");
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
});
|
|
|
},
|