Bladeren bron

完善优惠方案

Joe 4 jaren geleden
bovenliggende
commit
c4f156a7d7
2 gewijzigde bestanden met toevoegingen van 33 en 118 verwijderingen
  1. 6 38
      src/views/integral/ruledetail/index.vue
  2. 27 80
      src/views/market/discount.vue

+ 6 - 38
src/views/integral/ruledetail/index.vue

@@ -224,14 +224,14 @@
       </el-form-item>
     </el-form>
     <div slot="footer" class="dialog-footer"> 
-      <el-button type="primary" @click="submitForm" :disabled="flage" >确 定</el-button>
+      <el-button type="primary" @click="submitForm" :disabled="false" >确 定</el-button>
     </div>
   </div>
 </template>
 
 <script>
 import { getToken } from "@/utils/auth";
-import {  addRule, updateRule,oilNameInfo,gradeList,getRule,listRuleOne} from "@/api/integral/rule";
+import {  addRule, updateRule,oilNameInfo,gradeList,listRuleOne} from "@/api/integral/rule";
 import { getDept } from "@/api/system/dept";
 import {getStationPay,updatePay} from "@/api/station/pay";
 export default {
@@ -251,27 +251,18 @@ name: "ruleDetail",
       oilNameOptions:[],
       ruleTypeOptions:[],
       termDateManageOptions:[],
-      expirationOptions:[],
-      integralDeductionOilOptions:[],
       integralActivityOptions:[],
       integralTermSettingOptions:[],
       datePickerOptions:[],
       gradeOptions:[],
-      imgInfoList: [], //包含图片的id,name,size的集合
-      imgNameList: [], //后端返回的上传图片的name集合,传到后端
-      imgSize: [], //后端返回的上传图片的imgSize集合,传到后端
-      deleteImgFileList: [], //存已被删除了的图片的id
       dialogImageUrl: '',
       integralFlagOptions:[],
       ruleForm:{
         imgFileList:[]
       },
-      flage:false,
       num :0,
       pickerTime:"",
       dialogVisible: false,
-      // 是否显示弹出层
-      open: false,
       workDaytrue:false,
       moonDaytrue:false,
       datetrue:false,
@@ -446,18 +437,6 @@ name: "ruleDetail",
         oilName: null
       }
     },
-    onInstitutionChang(){
-      let obj = {};
-      obj = this.stationOptions.find((item)=>{//这里的userList就是上面遍历的数据源
-        return item.deptId === this.form.stationId;//筛选出匹配数据
-      })
-      this.queryreset();
-      this.form.stationName=obj.deptName;
-      this.queryParams.stationId=obj.deptId;
-      oilNameInfo(this.queryParams).then(response => {
-        this.oilNameOptions = response.rows;
-      });
-    },
     oilNameChang(index){
       let obj = {};
       obj = this.oilNameOptions.find((item)=>{//这里的userList就是上面遍历的数据源
@@ -474,11 +453,7 @@ name: "ruleDetail",
         this.gradeOptions = temp;
       });
     },
-    handlePictureCardPreview(file) {
-      console.log("file",file);
-      this.dialogImageUrl = file.url;
-      this.dialogVisible = true;
-    },
+   
     handleRemove(file, fileList) {
       if(fileList!=null && fileList.length>0){
         this.form.imgFileList=[];
@@ -492,15 +467,11 @@ name: "ruleDetail",
       }
     },
     beforeAvatarUpload(file) {
-      const isType = file.type === 'image/jpeg' || 'image/png';
       const isLt5M = file.size / 1024 / 1024 < 1;
-      if (!isType) {
-        this.$message.error('上传头像图片只能是 JPG 或 PNG格式!');
-      }
       if (!isLt5M) {
         this.$message.error('上传头像图片大小不能超过 1MB!');
       }
-      return isType && isLt5M;
+      return  isLt5M;
     },
    //上传成功
     handlepaymentSuccess(response,file, fileList){
@@ -646,6 +617,7 @@ name: "ruleDetail",
               }
               let itemsDetail =this.form.itemsDetail;
               let flag= true;
+              //验证积分规则,相同油品,等级为所有人,该油品不能再设置其他等级。相同油品等级不为所有人,可以设置不同等级的规则,不可以设置油品相同等级相同的规则
               if(itemsDetail!=null&&itemsDetail.length>0){
                 for (var i = 0; i < itemsDetail.length; i++) {
                     for (var j = i + 1; j < itemsDetail.length; j++) {
@@ -676,10 +648,7 @@ name: "ruleDetail",
         });
       }  
     },
-    // 取消按钮
-    cancel() {
-      this.queryreset();
-    },
+  
     deleteItemFromArr(item) {
       // eslint-disable-next-line
       Array.prototype.indexOf = function(val) {
@@ -701,7 +670,6 @@ name: "ruleDetail",
       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) {

+ 27 - 80
src/views/market/discount.vue

@@ -32,7 +32,7 @@
     <el-dialog
       :title="title"
       :visible.sync="openDialog"
-      width="550px"
+      width="600px"
       append-to-body
     >
       <el-form
@@ -76,7 +76,7 @@
               :min="0"
             />
             <span>{{ updateForm.discountTerm == 0 ? "元" : "L" }}</span>
-            每升优惠
+            每升优惠
             <el-input-number
               v-model="updateForm.gasoilDiscountAmt"
               size="mini"
@@ -102,18 +102,6 @@
             注:"否" 客户只享受 {{ discountName }} 优惠
           </div>
         </el-form-item>
-        <el-form-item
-          v-show="false"
-          label="优惠方案类型"
-          prop="discountPlanType"
-        >
-          <el-select
-            v-model="updateForm.discountPlanType"
-            placeholder="请选择优惠方案类型"
-          >
-            <el-option label="请选择字典生成" value="" />
-          </el-select>
-        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="handleSubmit">确 定</el-button>
@@ -126,7 +114,7 @@
       ref="queryForm"
       :inline="true"
       label-width="68px"
-      v-show="discountSetting!=0"
+      v-show="discountSetting != 0"
     >
       <div>
         <span style="color: #ff9955; font-size: 25px">|</span
@@ -160,34 +148,24 @@
         </el-button>
       </div>
     </el-form>
-    <el-table :data="discountList"  v-show="discountSetting!=0">
+    <el-table :data="discountList" v-show="discountSetting != 0">
       <af-table-column label="id" align="center" prop="id" v-if="false" />
       <af-table-column label="方案名称" align="center" prop="grade" />
       <af-table-column label="油品名称" align="center" prop="oilName" />
       <af-table-column
         label="优惠条件"
         align="center"
-        v-show="discountSetting == 3"
-      >
-        <template slot-scope="scope">
-          满 {{ scope.row.discountAmt }}元,每升优惠
-          {{ scope.row.gasoilDiscountAmt }} 元
-        </template>
-      </af-table-column>
-      <af-table-column
-        label="优惠条件"
-        align="center"
-        v-show="discountSetting == 3"
+        v-if="discountSetting==3"
       >
         <template slot-scope="scope">
-          满 {{ scope.row.discountAmt }},每升优惠
+          满 {{ scope.row.discountAmt }} {{scope.row.discountTerm == 0 ? "元": "L"}},每升优惠
           {{ scope.row.gasoilDiscountAmt }} 元
         </template>
       </af-table-column>
       <af-table-column
         label="优惠条件"
         align="center"
-        v-show="discountSetting == 1"
+        v-if="discountSetting==1"
       >
         <template slot-scope="scope">
           每满 {{ scope.row.discountAmt }} 元,减
@@ -197,7 +175,7 @@
       <af-table-column
         label="优惠条件"
         align="center"
-        v-show="discountSetting == 2"
+        v-if="discountSetting == 2"
       >
         <template slot-scope="scope">
           满 {{ scope.row.discountAmt }} 元,减
@@ -240,13 +218,13 @@
         class-name="small-padding fixed-width"
       >
         <template slot-scope="scope">
-          <el-button
+          <!-- <el-button
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             >修改</el-button
-          >
+          > -->
           <el-button
             size="mini"
             type="text"
@@ -295,24 +273,10 @@ export default {
 
     return {
       discountList: [],
-      // 总条数
       total: 0,
-      couponPlusOptions: [],
-      vipDiscountyPlusOptions: [],
-      discountSettingOptions: [],
-      stationOptions: [],
       oilNameOptions: [],
-      oilNameOptionsDT: [],
-      oilNameOptionsZJ: [],
-      discountTermOptions: [],
-      // 弹出层标题
       title: "",
-      fangan: "",
-      // 是否显示弹出层
-      open: false,
       openDialog: false,
-      yuan: true,
-      laters: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -330,10 +294,8 @@ export default {
         date: null,
         deductionGrowthValue: null,
       },
-      // 表单参数
-      form: {},
+
       ruleForm: {
-        imgFileList: [],
       },
       // 表单校验
       rules: {
@@ -364,7 +326,7 @@ export default {
       dtrules: {},
       discountSetting: 0,
       updateForm: {},
-      currentDiscountName:'',
+      currentDiscountName: "",
     };
   },
   computed: {
@@ -379,33 +341,22 @@ export default {
     },
   },
   created() {
-    this.getDicts("coupon_plus").then((response) => {
-      this.couponPlusOptions = response.data;
-    });
-    this.getDicts("discount_term").then((response) => {
-      this.discountTermOptions = response.data;
-    });
-    this.getDicts("vip_discounty_plus").then((response) => {
-      this.vipDiscountyPlusOptions = response.data;
-    });
-    //查看当前优惠设置
-    listPrice().then((response) => {
-      this.oilNameOptions = response.rows;
-    });
-    this.getPay().then(()=>{
-      this.getList()
-    })
-    getStationPay().then((response) => {
-      this.ruleForm = response.data;
-      this.discountSetting = response.data.discountSetting;
-      this.getList();
-    });
-
-    this.getDicts("discount_setting").then((response) => {
-      this.discountSettingOptions = response.data;
-    });
+    this.init();
   },
   methods: {
+    init() {
+      listPrice().then((response) => {
+        this.oilNameOptions = response.rows;
+      });
+      this.getPay().then(() => {
+        this.getList();
+      });
+      getStationPay().then((response) => {
+        this.ruleForm = response.data;
+        this.discountSetting = response.data.discountSetting;
+        this.getList();
+      });
+    },
     getPay() {
       return getStationPay().then((response) => {
         this.ruleForm = response.data;
@@ -420,13 +371,11 @@ export default {
             let e = this.ruleForm.discountSetting;
             if (e == "0") {
               updatePay(this.ruleForm).then((response) => {
-                this.fangan = "不执行优惠";
                 this.msgSuccess("优惠方案设置成功");
               });
             } else if (e == "1") {
               if (this.discountList.length > 0) {
                 updatePay(this.ruleForm).then((response) => {
-                  this.fangan = "满减";
                   this.msgSuccess("优惠方案设置成功");
                 });
               } else {
@@ -435,7 +384,6 @@ export default {
             } else if (e == "2") {
               if (this.discountList.length > 0) {
                 updatePay(this.ruleForm).then((response) => {
-                  this.fangan = "立减";
                   this.msgSuccess("优惠方案设置成功");
                 });
               } else {
@@ -444,7 +392,6 @@ export default {
             } else if (e == "3") {
               if (this.discountList.length > 0) {
                 updatePay(this.ruleForm).then((response) => {
-                  this.fangan = "直降";
                   this.msgSuccess("优惠方案设置成功");
                 });
               } else {
@@ -452,7 +399,7 @@ export default {
               }
             }
           }
-          this.getPay()
+          this.getPay();
         }
       });
     },