|
@@ -1,48 +1,55 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
- <el-form-item label="开通卡类型设置" >
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="cardOilsType">
|
|
|
- <el-checkbox-group v-model="form.cardOilsType">
|
|
|
- <el-checkbox
|
|
|
- v-for = "item in oilOptions"
|
|
|
- :key="item.dictLabel"
|
|
|
- :label="item.dictValue"
|
|
|
- :value="item.dictValue"
|
|
|
- >
|
|
|
- {{item.dictLabel}}
|
|
|
- </el-checkbox>
|
|
|
- </el-checkbox-group>
|
|
|
- </el-form-item>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="130px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="6" style="">
|
|
|
+ <el-form-item label="是否启用充值规则">
|
|
|
+ <el-checkbox-group v-model="cardOilsTypeList">
|
|
|
+ <el-checkbox v-for = "item in checkList" :key="item.id" :label="item.id" :value="item.value">{{item.value}}</el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="">
|
|
|
+ <el-button type="primary" style="" @click="handleAdd">新增充值规则</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
<div>
|
|
|
- <el-button type="primary" @click="handleAdd">设置充值规则</el-button>
|
|
|
- <el-table v-loading="false" :data="detailList" >
|
|
|
+ <el-table v-loading="false" :data="form.detailList" >
|
|
|
<el-table-column label="id" align="center" prop="id" v-if="false" />
|
|
|
<el-table-column label="所对应电子会员卡ID" align="center" prop="parentId" v-if="false" />
|
|
|
<el-table-column label="油品" align="center" prop="oilName" :formatter="oilNameFormatter"/>
|
|
|
- <el-table-column label="优惠条件金额" align="center" prop="discountAmtTerm" />
|
|
|
+ <el-table-column label="优惠条件金额" align="center" prop="discountAmtTerm" >
|
|
|
+ <template slot-scope="scope1">
|
|
|
+ {{scope1.row.discountAmtStart}}≤充值金额(元)<{{scope1.row.discountAmtEnd}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="赠送方式" align="center" prop="settingRuleType" :formatter="settingRuleTypeFotmat"/>
|
|
|
- <el-table-column label="赠送金额值或比例" align="center" prop="presentAmt" />
|
|
|
+ <el-table-column label="赠送金额值或比例" align="center" prop="presentAmt">
|
|
|
+ <template slot-scope="scope2">
|
|
|
+ {{scope2.row.presentAmt}}
|
|
|
+ <span v-show="scope2.row.settingRuleType=='1'">元</span>
|
|
|
+ <span v-show="scope2.row.settingRuleType=='2'">%</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
+ @click="handleUpdate(scope.$index,scope.row)"
|
|
|
>修改</el-button>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
+ @click="handleDelete(scope.$index,scope.row)"
|
|
|
>删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
- <el-form-item label="重置活动设置">
|
|
|
+ <el-form-item label="充值活动设置">
|
|
|
</el-form-item>
|
|
|
<el-form-item >
|
|
|
<el-radio-group v-model="form.discountTimeSetting">
|
|
@@ -55,11 +62,10 @@
|
|
|
</el-form-item>
|
|
|
<el-row>
|
|
|
<el-col :span="8" style="">
|
|
|
- <el-form-item label="日期选择" prop="datePicker">
|
|
|
- <el-select v-model="form.datePicker"
|
|
|
- clearable size="small" @change="datePickerChang" >
|
|
|
+ <el-form-item label="周期选择" >
|
|
|
+ <el-select v-model="form.discountTimeType" clearable size="mini" @change="datePickerChang" >
|
|
|
<el-option
|
|
|
- v-for="item in datePickerOptions"
|
|
|
+ v-for="item in discountTimeTypeOptions"
|
|
|
:key="item.dictValue"
|
|
|
:label="item.dictLabel"
|
|
|
:value="item.dictValue"
|
|
@@ -101,49 +107,64 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="赠送比例" prop="presentScale">
|
|
|
- <el-input v-model="form.presentScale" placeholder="请输入赠送比例" />
|
|
|
+ <el-input v-model="form.presentScale" placeholder="请输入赠送比例" style="width:70px;"/>%
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-form-item label="支付设置" ></el-form-item>
|
|
|
- <el-row>
|
|
|
- <el-form-item label="是否可以使用优惠券">
|
|
|
- </el-form-item>
|
|
|
- </el-row>
|
|
|
- <el-row>
|
|
|
- <el-form-item prop="isDiscountCoupon">
|
|
|
- <el-radio-group v-model="form.isDiscountCoupon">
|
|
|
- <el-radio
|
|
|
- v-for="dict in isDiscountCouponOptions"
|
|
|
- :key="dict.dictValue"
|
|
|
- :label="dict.dictValue"
|
|
|
- >{{dict.dictLabel}}</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
+ <el-form-item label="叠加优惠设置" ></el-form-item>
|
|
|
+ <el-row style="margin-left:80px;">
|
|
|
+ <el-col :span="8" >
|
|
|
+ <el-form-item prop="isDiscountCoupon" label="是否叠加优惠券">
|
|
|
+ <el-radio-group v-model="form.isDiscountCoupon">
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in isDiscountCouponOptions"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictValue"
|
|
|
+ >{{dict.dictLabel}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" >
|
|
|
+ <el-form-item prop="isMarket" label="是否叠加营销方案">
|
|
|
+ <el-radio-group v-model="form.isMarket">
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in isDiscountCouponOptions"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictValue"
|
|
|
+ >{{dict.dictLabel}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" >
|
|
|
+ <el-form-item prop="isGradeSetting" label="是否叠加等级优惠">
|
|
|
+ <el-radio-group v-model="form.isGradeSetting">
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in isDiscountCouponOptions"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictValue"
|
|
|
+ >{{dict.dictLabel}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-form-item label="积分可享受倍数" prop="enjoyIntegralMultiple">
|
|
|
- <el-input v-model="form.enjoyIntegralMultiple" placeholder="请输入积分可享受倍数" />
|
|
|
+ <el-col :span="8" style="margin-left:80px;">
|
|
|
+ <el-form-item prop="isDiscountCoupon" label="电子卡支付产生积分可享受倍数" label-width="225px">
|
|
|
+ <el-input v-model="form.enjoyIntegralMultiple" placeholder="请输入积分可享受倍数" style="width:100px;"/>倍
|
|
|
</el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
- <el-form-item label="油站ID" prop="stationId" v-show="false">
|
|
|
- <el-input v-model="form.stationId" placeholder="请输入油站ID" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="油站名称" prop="stationName" v-show="false">
|
|
|
- <el-input v-model="form.stationName" placeholder="请输入油站名称" />
|
|
|
- </el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
|
|
|
<!-- 添加或修改客户电子会员卡充值优惠设置明细对话框 -->
|
|
|
<el-dialog :title="title" :visible.sync="open" append-to-body>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="110px">
|
|
|
- <el-form-item label="选择油品" prop="oilName">
|
|
|
+ <el-form ref="infoform" :model="infoform" :rules="rules" label-width="110px">
|
|
|
+ <el-form-item label="选择油品" >
|
|
|
<el-select
|
|
|
- v-model="form.oilName"
|
|
|
+ v-model="infoform.oilName"
|
|
|
placeholder="请选择油品"
|
|
|
clearable
|
|
|
size="small"
|
|
@@ -157,40 +178,54 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="充值条件金额" prop="discountAmtTerm">
|
|
|
- <span>初始值</span>
|
|
|
- <el-input-number v-model="form.discountAmtStart" placeholder="请输入充值条件开始金额" style="width:100px;" />
|
|
|
- <span>终止值</span>
|
|
|
- <el-input-number v-model="form.discountAmtEnd" placeholder="请输入充值条件结束金额" style="width:100px;"/>
|
|
|
+ <el-input-number v-model="infoform.discountAmtStart" placeholder="请输入充值条件开始金额" style="width:200px;" />
|
|
|
+ <span>≤充值金额(元)<</span>
|
|
|
+ <el-input-number v-model="infoform.discountAmtEnd" placeholder="请输入充值条件结束金额" style="width:200px;"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="赠送方式"></el-form-item>
|
|
|
<el-row>
|
|
|
- <el-col>
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item >
|
|
|
- <el-select v-model="form.settingRuleType" placeholder="请选择设置充值优惠类型:1,按赠送金额;2,按赠送比例">
|
|
|
- <el-option label="请选择字典生成" value="" />
|
|
|
+ <el-select v-model="infoform.settingRuleType" placeholder="请选择赠送方式" @change="settingRuleTypeChange">
|
|
|
+ <el-option
|
|
|
+ v-for="item in settingRuleTypeOptions"
|
|
|
+ :key="item.dictLabel"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
-
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col>
|
|
|
+ <el-col :span="12" >
|
|
|
<el-form-item>
|
|
|
- <el-input v-model="form.presentAmt" placeholder="请输入赠送金额值或者赠送c充值金额的比例" />
|
|
|
+ <el-input v-model="infoform.presentAmt" style="width:100px;"/>
|
|
|
+ <span v-show="jine">元</span>
|
|
|
+ <span v-show="bili">%</span>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
-
|
|
|
+ <el-row>
|
|
|
+ <span style="color:red;margin-left:90px;">例:按赠送金额:充100赠送10元;按赠送比例:充100赠送10%</span>
|
|
|
+ </el-row>
|
|
|
+ <!-- <el-form-item label="状态">
|
|
|
+ <el-radio-group v-model="infoform.status">
|
|
|
+ <el-radio v-for="dict in statusOptions"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictValue"
|
|
|
+ >{{dict.dictLabel}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item> -->
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">设置</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="save">设置</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getSetting, delSetting, addSetting, updateSetting } from "@/api/customer/cardSetting";
|
|
|
-
|
|
|
+import { addSetting, updateSetting,selectCustomerCardSetting} from "@/api/customer/cardSetting";
|
|
|
+import { getDept } from "@/api/system/dept";
|
|
|
export default {
|
|
|
name: "Setting",
|
|
|
data() {
|
|
@@ -209,13 +244,21 @@ export default {
|
|
|
total: 0,
|
|
|
// 客户电子会员卡充值优惠设置表格数据
|
|
|
settingList: [],
|
|
|
- detailList:[],
|
|
|
oilOptions:[],
|
|
|
+ statusOptions:[],
|
|
|
isDiscountCouponOptions:[],
|
|
|
discountTimeSettingOptions:[],
|
|
|
collectClickCalendar: [], // 收集固定日期选择的日子
|
|
|
collectClickWorkDay:[],
|
|
|
- datePickerOptions :[],
|
|
|
+ discountTimeTypeOptions :[],
|
|
|
+ stationOptions:[],
|
|
|
+ settingRuleTypeOptions:[],
|
|
|
+ checkList:[
|
|
|
+ {id:"1",value:"汽油"},
|
|
|
+ {id:"2",value:"柴油"}
|
|
|
+ ],
|
|
|
+ cardOilsTypeList:[],
|
|
|
+ pickerTime:"",
|
|
|
moonEverDay: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10',
|
|
|
'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
|
|
|
'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
|
|
@@ -223,10 +266,28 @@ export default {
|
|
|
workDaytrue:false,
|
|
|
moonDaytrue:false,
|
|
|
datetrue:false,
|
|
|
+ jine:false,
|
|
|
+ bili:false,
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
// 表单参数
|
|
|
- form: {},
|
|
|
+ form: {
|
|
|
+ detailList:[]
|
|
|
+ },
|
|
|
+ //判断保存次数
|
|
|
+ num:0,
|
|
|
+ query:{
|
|
|
+ deptId: null
|
|
|
+ },
|
|
|
+ deptId:null,
|
|
|
+ queryParams:{
|
|
|
+ stationId: null
|
|
|
+ },
|
|
|
+ deptInfo:{},
|
|
|
+ checked: {},
|
|
|
+ index:null,
|
|
|
+ open:false,
|
|
|
+ infoform:{},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
}
|
|
@@ -236,8 +297,12 @@ export default {
|
|
|
this.getDicts("integral_manage").then(response => {
|
|
|
this.discountTimeSettingOptions = response.data;
|
|
|
});
|
|
|
+
|
|
|
+ this.getDicts("status").then(response => {
|
|
|
+ this.statusOptions = response.data;
|
|
|
+ });
|
|
|
this.getDicts("date_picker").then(response => {
|
|
|
- this.datePickerOptions = response.data;
|
|
|
+ this.discountTimeTypeOptions = response.data;
|
|
|
});
|
|
|
this.getDicts("is_flag").then(response => {
|
|
|
this.isDiscountCouponOptions = response.data;
|
|
@@ -245,9 +310,54 @@ export default {
|
|
|
this.getDicts("oil").then(response => {
|
|
|
this.oilOptions = response.data;
|
|
|
});
|
|
|
+ this.getDicts("setting_rule_type").then(response => {
|
|
|
+ this.settingRuleTypeOptions = response.data;
|
|
|
+ });
|
|
|
+ this.deptId=this.$store.selectDeptId;
|
|
|
+ if(this.deptId==null || this.deptId==""){
|
|
|
+ this.deptId =this.$store.state.user.deptId;
|
|
|
+ }
|
|
|
+ getDept(this.deptId).then(response => {
|
|
|
+ this.deptInfo = response.data;
|
|
|
+ if(this.deptInfo.jiBie==2){
|
|
|
+ this.queryParams.stationId=this.deptInfo.deptId;
|
|
|
+ this.form.stationId = this.deptInfo.deptId;
|
|
|
+ this.form.stationName =this.deptInfo.deptName;
|
|
|
+ selectCustomerCardSetting(this.queryParams).then(response => {
|
|
|
+ if(response.hasOwnProperty('data')){
|
|
|
+ this.form = response.data;
|
|
|
+ if(this.form.cardOilsType!=null &&this.form.cardOilsType!="" ){
|
|
|
+ this.cardOilsTypeList=this.form.cardOilsType.split(",");
|
|
|
+ }
|
|
|
+ if(this.form.discountTimeType == "1"){
|
|
|
+ this.workDaytrue=true;
|
|
|
+ this.moonDaytrue=false;
|
|
|
+ this.datetrue=false;
|
|
|
+ this.collectClickWorkDay =this.form.discountTime.split(",").map(parseFloat);
|
|
|
+ }else if(this.form.discountTimeType == "2"){
|
|
|
+ this.workDaytrue=false;
|
|
|
+ this.moonDaytrue=true;
|
|
|
+ this.datetrue=false;
|
|
|
+ this.collectClickCalendar= this.form.discountTime.split(',').map(parseFloat);
|
|
|
+ }else if(this.form.discountTimeType == "3"){
|
|
|
+ this.workDaytrue=false;
|
|
|
+ this.moonDaytrue=false;
|
|
|
+ this.datetrue=true;
|
|
|
+ if(this.form.discountTime!=""){
|
|
|
+ this.pickerTime =this.form.discountTime.split(",");
|
|
|
+ }else{
|
|
|
+ this.pickerTime =null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.msgSuccess("请选择油站");
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
- oilNameFormatter(row, column){
|
|
|
+ oilNameFormatter(row, column){
|
|
|
if(row.oilName === '1'){
|
|
|
return '汽油'
|
|
|
}else if(row.oilName === '2'){
|
|
@@ -261,16 +371,32 @@ export default {
|
|
|
return '按赠送比例'
|
|
|
}
|
|
|
},
|
|
|
+ settingRuleTypeChange(){
|
|
|
+ if(this.infoform.settingRuleType == "1"){
|
|
|
+ this.jine=true;
|
|
|
+ this.bili=false;
|
|
|
+ }else if(this.infoform.settingRuleType == "2"){
|
|
|
+ this.jine=false;
|
|
|
+ this.bili=true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ statusFormatter(row, column){
|
|
|
+ if(row.status === '1'){
|
|
|
+ return '开启'
|
|
|
+ }else if(row.status === '2'){
|
|
|
+ return '关闭'
|
|
|
+ }
|
|
|
+ },
|
|
|
datePickerChang(){
|
|
|
- if(this.form.datePicker == "1"){
|
|
|
+ if(this.form.discountTimeType == "1"){
|
|
|
this.workDaytrue=true;
|
|
|
this.moonDaytrue=false;
|
|
|
this.datetrue=false;
|
|
|
- }else if(this.form.datePicker == "2"){
|
|
|
+ }else if(this.form.discountTimeType == "2"){
|
|
|
this.workDaytrue=false;
|
|
|
this.moonDaytrue=true;
|
|
|
this.datetrue=false;
|
|
|
- }else if(this.form.datePicker == "3"){
|
|
|
+ }else if(this.form.discountTimeType == "3"){
|
|
|
this.workDaytrue=false;
|
|
|
this.moonDaytrue=false;
|
|
|
this.datetrue=true;
|
|
@@ -292,83 +418,171 @@ export default {
|
|
|
enjoyIntegralMultiple: null,
|
|
|
stationId: null,
|
|
|
stationName: null,
|
|
|
- createTime: null
|
|
|
+ createTime: null,
|
|
|
+ detailList:[],
|
|
|
+ datePicker:null
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
+
|
|
|
},
|
|
|
- /** 搜索按钮操作 */
|
|
|
- handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
- this.getList();
|
|
|
+ resetInfo() {
|
|
|
+ this.infoform = {
|
|
|
+ id: null,
|
|
|
+ parentId:null,
|
|
|
+ oilName: null,
|
|
|
+ discountAmtStart: null,
|
|
|
+ discountAmtEnd: null,
|
|
|
+ settingRuleType: null,
|
|
|
+ presentAmt: null
|
|
|
+ };
|
|
|
+ this.resetForm("infoform");
|
|
|
+
|
|
|
},
|
|
|
-
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
- this.reset();
|
|
|
+ this.resetInfo();
|
|
|
+ this.index1=null;
|
|
|
this.open = true;
|
|
|
this.title = "添加客户电子会员卡充值优惠设置";
|
|
|
+ // this.infoform.status="1";
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- const id = row.id || this.ids
|
|
|
- getSetting(id).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- this.open = true;
|
|
|
- this.title = "修改客户电子会员卡充值优惠设置";
|
|
|
- });
|
|
|
+ handleUpdate(index,row) {
|
|
|
+ this.index1=index;
|
|
|
+ this.infoform = row;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改客户电子会员卡充值优惠设置";
|
|
|
+ this.settingRuleTypeChange();
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
+ let flag=true;
|
|
|
+ if(this.cardOilsTypeList !=null && this.cardOilsTypeList.length>0){
|
|
|
+ this.form.cardOilsType=this.cardOilsTypeList.toString();
|
|
|
+ }else{
|
|
|
+ this.form.cardOilsType="";
|
|
|
+ flag=false;
|
|
|
+ }
|
|
|
if (this.form.id != null) {
|
|
|
- let datepicker = this.form.datePicker;
|
|
|
+ let datepicker = this.form.discountTimeType;
|
|
|
if(datepicker=="1"){
|
|
|
- this.form.discountTime=this.collectClickWorkDay.toString();
|
|
|
+ if(this.collectClickWorkDay!=null&&this.collectClickWorkDay.length>0){
|
|
|
+ let discountTime=null;
|
|
|
+ for(let i =0;i<this.collectClickWorkDay.length;i++){
|
|
|
+ if(!isNaN(this.collectClickWorkDay[i]) && this.collectClickWorkDay[i]!="NaN"){
|
|
|
+ if( discountTime!=null){
|
|
|
+ discountTime =discountTime+","+this.collectClickWorkDay[i];
|
|
|
+ }else{
|
|
|
+ discountTime =this.collectClickWorkDay[i];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ discountTime =discountTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.discountTime=discountTime;
|
|
|
+ discountTime=null;
|
|
|
+ } else{
|
|
|
+ this.form.discountTime="";
|
|
|
+ }
|
|
|
}else if(datepicker=="2"){
|
|
|
- this.form.discountTime=this.collectClickCalendar.toString();
|
|
|
+ if(this.collectClickCalendar!=null&&this.collectClickCalendar.length>0){
|
|
|
+ let discountTime=null;
|
|
|
+ for(let i =0;i<this.collectClickCalendar.length;i++){
|
|
|
+ if(!isNaN(this.collectClickCalendar[i]) && this.collectClickCalendar[i]!="NaN"){
|
|
|
+ if( discountTime!=null){
|
|
|
+ discountTime =discountTime+","+this.collectClickCalendar[i];
|
|
|
+ }else{
|
|
|
+ discountTime =this.collectClickCalendar[i];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ discountTime =discountTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.discountTime=discountTime;
|
|
|
+ discountTime=null;
|
|
|
+ } else{
|
|
|
+ this.form.discountTime="";
|
|
|
+ }
|
|
|
}else{
|
|
|
- this.form.discountTime = this.pickerTime.toString();
|
|
|
- }
|
|
|
+ if(this.pickerTime!=null){
|
|
|
+ this.form.discountTime = this.pickerTime.toString();
|
|
|
+ }else{
|
|
|
+ this.form.discountTime = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
updateSetting(this.form).then(response => {
|
|
|
this.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
+ this.jine=false;
|
|
|
+ this.bili=false;
|
|
|
});
|
|
|
} else {
|
|
|
- let datepicker = this.form.datePicker;
|
|
|
- if(datepicker=="1"){
|
|
|
- this.form.discountTime=this.collectClickWorkDay.toString();
|
|
|
- }else if(datepicker=="2"){
|
|
|
- this.form.discountTime=this.collectClickCalendar.toString();
|
|
|
+ if(this.num==0){
|
|
|
+ if(datepicker=="1"){
|
|
|
+ if(this.collectClickWorkDay!=null&&this.collectClickWorkDay.length>0){
|
|
|
+ let discountTime=null;
|
|
|
+ for(let i =0;i<this.collectClickWorkDay.length;i++){
|
|
|
+ if(!isNaN(this.collectClickWorkDay[i]) && this.collectClickWorkDay[i]!="NaN"){
|
|
|
+ if( discountTime!=null){
|
|
|
+ discountTime =discountTime+","+this.collectClickWorkDay[i];
|
|
|
+ }else{
|
|
|
+ discountTime =this.collectClickWorkDay[i];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ discountTime =discountTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.discountTime=discountTime;
|
|
|
+ discountTime=null;
|
|
|
+ } else{
|
|
|
+ this.form.discountTime="";
|
|
|
+ }
|
|
|
+ }else if(datepicker=="2"){
|
|
|
+ // this.form.discountTime=this.collectClickCalendar.toString();
|
|
|
+ if(this.collectClickCalendar!=null&&this.collectClickCalendar.length>0){
|
|
|
+ let discountTime=null;
|
|
|
+ for(let i =0;i<this.collectClickCalendar.length;i++){
|
|
|
+ if(!isNaN(this.collectClickCalendar[i]) && this.collectClickCalendar[i]!="NaN"){
|
|
|
+ if( discountTime!=null){
|
|
|
+ discountTime =discountTime+","+this.collectClickCalendar[i];
|
|
|
+ }else{
|
|
|
+ discountTime =this.collectClickCalendar[i];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ discountTime =discountTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.form.discountTime=discountTime;
|
|
|
+ discountTime=null;
|
|
|
+ } else{
|
|
|
+ this.form.discountTime="";
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(this.pickerTime!=null){
|
|
|
+ this.form.discountTime = this.pickerTime.toString();
|
|
|
+ }else{
|
|
|
+ this.form.discountTime = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ addSetting(this.form).then(response => {
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
+ this.num=this.num+1;
|
|
|
+ this.jine=false;
|
|
|
+ this.bili=false;
|
|
|
+ });
|
|
|
}else{
|
|
|
- this.form.discountTime = this.pickerTime.toString();
|
|
|
+ this.msgSuccess("已新增成功,如需修改请刷新页面");
|
|
|
}
|
|
|
- addSetting(this.form).then(response => {
|
|
|
- this.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
- handleDelete(row) {
|
|
|
- const ids = row.id || this.ids;
|
|
|
- this.$confirm('是否确认删除客户电子会员卡充值优惠设置编号为"' + ids + '"的数据项?', "警告", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- }).then(function() {
|
|
|
- return delSetting(ids);
|
|
|
- }).then(() => {
|
|
|
- this.getList();
|
|
|
- this.msgSuccess("删除成功");
|
|
|
- })
|
|
|
+ handleDelete(index) {
|
|
|
+ this.form.detailList.splice(index, 1)
|
|
|
},
|
|
|
- deleteItemFromArr(item) {
|
|
|
+ deleteItemFromArr(item) {
|
|
|
// eslint-disable-next-line
|
|
|
Array.prototype.indexOf = function(val) {
|
|
|
for (var i = 0; i < this.length; i++) {
|
|
@@ -389,7 +603,6 @@ export default {
|
|
|
this.collectClickCalendar.remove(item)
|
|
|
},
|
|
|
clickCalendar(item, index) {
|
|
|
- console.log('item, index:', item, index)
|
|
|
if (this.collectClickCalendar.indexOf(index) === -1) {
|
|
|
this.collectClickCalendar.push(index)
|
|
|
} else if (this.collectClickCalendar.indexOf(index) > -1) {
|
|
@@ -413,7 +626,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
// 删除数组元素
|
|
|
- this.collectClickWorkDay.remove(item)
|
|
|
+ this.collectClickWorkDay.remove(item);
|
|
|
},
|
|
|
clickWorkDayCalendar(item, index) {
|
|
|
if (this.collectClickWorkDay.indexOf(index) === -1) {
|
|
@@ -421,6 +634,32 @@ export default {
|
|
|
} else if (this.collectClickWorkDay.indexOf(index) > -1) {
|
|
|
this.deleteWorkDayFromArr(index)
|
|
|
}
|
|
|
+ },
|
|
|
+ cancelOpen(){
|
|
|
+ this.infoform = {
|
|
|
+ oilName: null,
|
|
|
+ discountAmtStart: null,
|
|
|
+ discountAmtEnd: null,
|
|
|
+ settingRuleType: null,
|
|
|
+ presentAmt: null
|
|
|
+ };
|
|
|
+ this.index1=null;
|
|
|
+ this.resetForm("infoform");
|
|
|
+ this.open = false;
|
|
|
+ this.jine=false;
|
|
|
+ this.bili=false;
|
|
|
+ },
|
|
|
+ save(){
|
|
|
+ const that = this;
|
|
|
+ this.$refs["infoform"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if(that.index1!=null){
|
|
|
+ that.handleDelete(that.index1);
|
|
|
+ }
|
|
|
+ that.form.detailList.push(that.infoform);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.cancelOpen();
|
|
|
}
|
|
|
}
|
|
|
};
|