Joe před 4 roky
rodič
revize
08ca46e980

+ 3 - 62
src/views/integral/rule/index.vue

@@ -1,22 +1,11 @@
 <template>
   <div class="app-container">
-     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-       <!-- <el-form-item label="油品名称" prop="oilName">
-         <el-select  v-model="queryParams.oilName" placeholder="油品名称" clearable size="small"  @keyup.enter.native="handleQuery">
-            <el-option
-              v-for="dict in oilNameOptions"
-              :key="dict.oilName"
-              :label="dict.oilName"
-              :value="dict.oilName"
-            />
-          </el-select>
-      </el-form-item>   -->
+     <el-form :model="queryParams" ref="queryForm" :inline="true"  label-width="68px">
       <el-form-item style="float:right">
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">刷新</el-button>
-        <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> -->
       </el-form-item>
     </el-form>
-    <el-table v-loading="loading" :data="ruleList">
+    <el-table :data="ruleList">
       <el-table-column label="油站id" align="center" prop="stationId" v-if="false"/>
       <el-table-column label="规则" align="center" >
           <template slot-scope="scope">
@@ -70,35 +59,20 @@
 
 <script>
 import {listRuleInfo} from "@/api/integral/rule";
-import {stationinfo} from "@/api/station/gun";
-import { listPrice } from "@/api/station/price";
 export default {
   name: "Rule",
   data() {
     return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 显示搜索条件
-      showSearch: true,
       // 弹出层标题
       title: "",
       total:0,
       // 是否显示弹出层
       open: false,
-      oilNameOptions:[],
       ruleList:[],
       // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        stationId: null,
-        stationName: null,
-        ruleType: null,
-        oilName: null
       },
       queryInfo:{},
       // 表单参数
@@ -114,22 +88,6 @@ export default {
   },
   created() {
     this.getList();
-    // this.getDicts("oil_name").then(response => {
-    //   this.oilNameOptions = response.data;
-    // });
-    this.queryInfo.stationId=this.$store.selectDeptId;
-    if(this.queryInfo.stationId==null || this.queryParams.stationId==""){
-      this.queryInfo.stationId =this.$store.state.user.deptId;
-    }
-    listPrice(this.queryInfo).then(response => {
-      this.oilNameOptions = response.rows;
-    });
-    stationinfo().then(response => {
-      this.stationOptions = response.rows;
-    });
-    this.getDicts("rule_type").then(response => {
-      this.ruleTypeOptions = response.data;
-    });
     this.getDicts("term_date").then(response => {
       this.termDateManageOptions = response.data;
     });
@@ -147,16 +105,10 @@ export default {
   methods: {
     /** 查询列表 */
     getList() {
-      this.loading = true;
-      this.queryParams.stationId= this.$store.selectDeptId;
-      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
-        this.queryParams.stationId =this.$store.state.user.deptId;
-      }
       //积分规则信息
       listRuleInfo(this.queryParams).then(response => {
         this.ruleList = response.rows;
         this.total = response.total;
-        this.loading = false;
       });
     },
     termDateManageFormat(row, column){
@@ -169,7 +121,7 @@ export default {
     integralActivityFormat(row, column){
       if(row.integralActivity === '1'){
         return '开启'
-      }else if(row.integralActivity === '2'){
+      }else if(row.integralActivity === '0'){
         return '关闭'
       }
     },
@@ -187,17 +139,6 @@ export default {
       this.queryParams.pageNum = 1;
       this.getList();
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加";
-    },  
   }
 };
 </script>

+ 0 - 308
src/views/integral/rule/index1.vue

@@ -1,308 +0,0 @@
-<template>
-  <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="油品名称" prop="oilName">
-        <el-input
-          v-model="queryParams.oilName"
-          placeholder="请输入油品名称"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-        <el-button icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
-      </el-form-item>
-    </el-form>
-
-    <el-table v-loading="loading" :data="ruleList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="主键id" align="center" prop="id" v-if="false"/>
-      <el-table-column label="油站id" align="center" prop="stationId" v-if="false"/>
-      <el-table-column label="油站名称" align="center" prop="stationName" />
-      <el-table-column label="有效期设置" align="center" prop="termDateManage" :formatter="termDateManageFormat"/>
-      <el-table-column label="有效期时间" align="center" prop="emptyDate" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.emptyDate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="到期提醒设置" align="center" prop="expirationReminder"  v-if="false" :formatter="expirationReminderFormat" />
-      <el-table-column label="提醒时间设置" align="center" prop="remindDate" width="180" v-if="false">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.remindDate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="积分活动设置" align="center" prop="integralActivity" :formatter="activityFormat" />
-      <el-table-column label="日期选择" align="center" prop="datePicker" :formatter="datePickerFormat"/>
-      <el-table-column label="积分比例" align="center" prop="integralProportion" >
-        <template slot-scope="scope1">
-          <span>{{ scope1.row.integralProportion}}倍</span>
-        </template>
-      </el-table-column>
-      <!-- <el-table-column label="积分抵扣油品规则" align="center" prop="integralDeductionOil" :formatter="integralDeductionOilFormat" /> -->
-      <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)"
-            v-hasPermi="['integral:rule:edit']"
-          >积分规则明细</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['integral:rule:remove']"
-          >删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
-  </div>
-</template>
-
-<script>
-import { listRule, delRule, addRule, updateRule, exportRule } from "@/api/integral/rule";
-import {stationinfo} from "@/api/station/gun";
-import { getDept } from "@/api/system/dept";
-export default {
-  name: "Rule",
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 【请填写功能名称】表格数据
-      ruleList: [],
-      // 弹出层标题
-      title: "",
-      stationOptions:[],
-      // 是否显示弹出层
-      open: false,
-      lists:[1],
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        stationId: null,
-        stationName: null,
-        oilName: null
-      },
-      deptId:null,
-      deptInfo:{},
-      // 表单参数
-      form: {
-        itemsDetail: [{}]
-      },
-      // 表单校验
-      rules: {
-      }
-    };
-  },
-  created() {
-    this.getList();
-    stationinfo().then(response => {
-      this.stationOptions = response.rows;
-    });
-    this.getDicts("rule_type").then(response => {
-      this.ruleTypeOptions = response.data;
-    });
-  },
-  methods: {
-    datePickerFormat(row, column){
-      if(row.datePicker === '1'){
-        return '每周指定日'
-      }else if(row.datePicker === '2'){
-        return '每月指定日'
-      }else if(row.datePicker === '3'){
-        return '固定活动日'
-      }
-    },
-    activityFormat(row, column){
-      if(row.integralActivity === '1'){
-        return '会员活动'
-      }
-    },
-    expirationReminderFormat(row, column){
-      if(row.expirationReminder === '1'){
-        return '不提醒'
-      }else if(row.expirationReminder === '2'){
-        return '提醒'
-      }
-    },
-    termDateManageFormat(row, column){
-      if(row.termDateManage === '1'){
-        return '永久有效'
-      }else if(row.termDateManage === '2'){
-        return '指定结束日期'
-      }
-    },
-    /** 查询规则设置列表 */
-    getList() {
-      this.loading = true;
-      this.queryParams.stationId= this.$store.selectDeptId;
-      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
-        this.queryParams.stationId =this.$store.state.user.deptId;
-      }
-      listRule(this.queryParams).then(response => {
-        this.ruleList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        stationId: null,
-        stationName: null,
-        ruleType: null,
-        termDateManage: null,
-        emptyDate: null,
-        expirationReminder: null,
-        remindDate: null,
-        integralActivity: null,
-        datePicker: null,
-        integralProportion: null,
-        integralDeductionOil: null
-      };
-      this.resetForm("form");
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      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.$router.push({path:'/integral/ruledetail',query:{stationId:"",parentId:""}});
-          }else{
-              this.msgSuccess("请选择油站");
-          }
-      });
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.$router.push({path:'/integral/ruledetail',query:{stationId:row.stationId,parentId:row.id}});
-    },
-    queryreset() {
-      this.params={
-        stationId: null,
-        stationName: null,
-        oilName: null
-      }
-    },
-    onInstitutionChang(e){
-      let obj = {};
-      obj = this.stationOptions.find((item)=>{//这里的userList就是上面遍历的数据源
-        return item.deptId === e;//筛选出匹配数据
-      })
-      this.queryreset();
-      this.form.stationName=obj.deptName;
-      this.params.stationId=obj.deptId;
-      oilNameList(this.params).then(response => {
-        this.oilNameOptions = response.rows;
-      });
-    },
-    oilNameChang(e){
-      let obj = {};
-      obj = this.oilNameOptions.find((item)=>{//这里的userList就是上面遍历的数据源
-        return item.oilName === e;//筛选出匹配数据
-      })
-      this.queryreset();
-      //获取油站名称
-      this.params.stationId = this.form.stationId;
-      this.params.oilName=obj.oilName;
-      gradeList(this.params).then(response => {
-        this.gradeOptions = response.rows;
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            if(this.form.datePicker != null){
-              this.form.datePicker =this.form.datePicker.toString();
-            }
-            updateRule(this.form).then(response => {
-              this.msgSuccess("修改成功");
-            });
-          } else {
-            if(this.form.datePicker != null){
-              this.form.datePicker =this.form.datePicker.toString();
-            }
-            addRule(this.form).then(response => {
-              this.msgSuccess("新增成功");
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$confirm('是否确认删除积分规则编号为"' + ids + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delRule(ids);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm('是否确认导出所有数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return exportRule(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-        })
-    }
-  }
-};
-</script>

+ 0 - 222
src/views/integral/rule/ruledetail.vue

@@ -1,222 +0,0 @@
-<template>
-  <div class="app-container">
-    <el-form ref="form" :model="form" :rules="rules" label-width="120px">
-      <el-form-item label="油站名称" prop="stationId" >
-        <el-select
-          v-model="form.stationId"
-          placeholder="请选择油站"
-          clearable
-          size="small"
-          @change="onInstitutionChang"
-        >
-          <el-option
-            v-for="item in stationOptions"
-            :key="item.deptId"
-            :label="item.deptName"
-            :value="item.deptId"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item v-show="false" label="油站名称" prop="stationName">
-        <el-input v-model="form.stationName"  placeholder="请输入油站名称" />
-      </el-form-item>
-      <el-form-item label="规则类型" prop="ruleType">
-        <el-radio-group v-model="form.ruleType">
-          <el-radio
-            v-for="dict in ruleTypeOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
-        </el-radio-group>
-      </el-form-item>
-      <div  v-for="(item, index) in lists" :key="index">
-        <el-row style="margin-left: 120px;">
-          <!-- <el-input v-if="item.type=='text'" type='text'  v-model="myForm[item.prop]"></el-input>-->
-          <span>满</span>
-            <el-input v-model="item.ruleTerms" size="min" style="width: 80px;"></el-input>
-          <span>元 起累计 </span>
-          <el-input v-model="item.oilName" size="min" style="width: 80px;"></el-input>
-          <el-input v-model="item.gread" size="min" style="width: 80px;"></el-input>
-          <span>每消费</span>
-          <el-input v-model="item.saleAmt"  size="min" style="width: 80px;"></el-input>
-          <span>元</span>
-          <el-input v-model="item.integral" size="min" style="width: 80px;"></el-input>
-          <span>积分</span>
-        </el-row>
-      </div>
-      <el-form-item label="有效期设置" prop="termDateManage">
-        <el-radio-group v-model="form.termDateManage">
-          <el-radio
-            v-for="dict in termDateManageOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
-        </el-radio-group>
-        <el-date-picker clearable size="small" style="width: 200px;margin-left: 10px;"
-                        v-model="form.emptyDate"
-                        type="date"
-                        value-format="yyyy-MM-dd"
-                        placeholder="选择清空积分时间">
-        </el-date-picker>
-      </el-form-item>
-
-      <el-form-item label=  "到期提醒设置" prop="expirationReminder">
-        <el-radio-group v-model="form.expirationReminder">
-          <el-radio
-            v-for="dict in expirationOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
-        </el-radio-group>
-        <el-date-picker clearable size="small" style="margin-left: 10px;width: 200px"
-                        v-model="form.remindDate"
-                        type="date"
-                        value-format="yyyy-MM-dd"
-                        placeholder="选择提醒时间设置">
-        </el-date-picker>
-      </el-form-item>
-      <el-form-item label="积分活动设置" ></el-form-item>
-      <el-form-item >
-        <el-radio-group v-model="form.integralActivity">
-          <el-radio
-            v-for="dict in integralActivityOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
-        </el-radio-group>
-      </el-form-item>
-      <el-row>
-        <el-col :span="8" style="margin-left: 80px;">
-          <el-form-item  label="日期选择" prop="datePicker">
-            <el-date-picker clearable size="small" style="margin-left: 10px;width: 200px"
-                            v-model="form.datePicker"
-                            type="dates"
-                            value-format="yyyy-MM-dd"
-                            placeholder="选择提醒时间设置">
-            </el-date-picker>
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item  label="积分比例" prop="integralProportion">
-            <el-input-number v-model="form.integralProportion" :min="1" placeholder="请输入加倍比例" />
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-form-item label="抵扣油品规则" prop="integralDeductionOil">
-        <el-radio-group v-model="form.integralDeductionOil">
-          <el-radio
-            v-for="dict in integralDeductionOilOptions"
-            :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>
-    </div>
-  </div>
-</template>
-
-<script>
-import {stationinfo} from "@/api/station/gun";
-import {  addRule, updateRule } from "@/api/integral/rule";
-export default {
-name: "ruledetail",
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 弹出层标题
-      title: "",
-      stationOptions:[],
-      ruleTypeOptions:[],
-      termDateManageOptions:[],
-      expirationOptions:[],
-      integralDeductionOilOptions:[],
-      integralActivityOptions:[],
-      // 是否显示弹出层
-      open: false,
-      lists:[1],
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        stationId: null,
-        stationName: null,
-        oilName: null
-      },
-      // 表单参数
-      form: {
-      },
-      // 表单校验
-      rules: {
-      }
-    };
-  },
-  created() {
-    stationinfo().then(response => {
-      this.stationOptions = response.rows;
-    });
-    this.getDicts("rule_type").then(response => {
-      this.ruleTypeOptions = response.data;
-    });
-    this.getDicts("term_date").then(response => {
-      this.termDateManageOptions = response.data;
-    });
-    this.getDicts("expiration").then(response => {
-      this.expirationOptions = response.data;
-    });
-    this.getDicts("integral_deduction_oil").then(response => {
-      this.integralDeductionOilOptions = response.data;
-    });
-    this.getDicts("integral_manage").then(response => {
-      this.integralActivityOptions = response.data;
-    });
-  },
-  methods: {
-    onInstitutionChang(e){
-      let obj = {};
-      obj = this.stationOptions.find((item)=>{//这里的userList就是上面遍历的数据源
-        return item.deptId === e;//筛选出匹配数据
-      })
-      this.form.stationName=obj.deptName;
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-
-          if (this.form.id != null) {
-            if(this.form.datePicker != null){
-              this.form.datePicker =this.form.datePicker.toString();
-            }
-            updateRule(this.form).then(response => {
-              this.msgSuccess("修改成功");
-            });
-          } else {
-            if(this.form.datePicker != null){
-              this.form.datePicker =this.form.datePicker.toString();
-            }
-            addRule(this.form).then(response => {
-              this.msgSuccess("新增成功");
-
-            });
-          }
-        }
-      });
-    }
-  },
-
-
-}
-</script>
-
-

+ 6 - 63
src/views/integral/wares/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form :model="queryParams" ref="queryForm" :inline="true"  label-width="68px">
       <el-form-item label="商品名称" prop="waresName">
         <el-input
           v-model="queryParams.waresName"
@@ -10,7 +10,6 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button type="info" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -19,7 +18,6 @@
     </el-form>
 
     <el-table v-loading="loading" :data="waresList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="商品id" align="center" prop="id"  v-if="false" />
       <el-table-column label="商品类别" align="center" prop="waresType"  v-if="false" />
       <el-table-column label="商品名称" align="center" prop="waresName" />
@@ -30,9 +28,6 @@
       <el-table-column label="油站名称" align="center" prop="stationName" />
       <el-table-column label="库存" align="center" prop="waresCount" />
       <el-table-column label="商品状态" align="center" prop="waresStatus" :formatter="waresStatusFotmat" />
-      <el-table-column label="创建人名称" align="center" prop="createName"  v-if="false" />
-      <el-table-column label="更新人名称" align="center" prop="updateName" v-if="false"  />
-      <el-table-column label="更新人时间" align="center" prop="updateTime" v-if="false"  />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <div  v-if="scope.row.waresStatus==2">
@@ -114,21 +109,10 @@ export default {
   name: "Wares",
   data() {
     return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
       // 总条数
       total: 0,
-      // 【请填写功能名称】表格数据
+      // 表格数据
       waresList: [],
-      stationOptions: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -137,15 +121,7 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        waresType: null,
-        waresName: null,
-        saleIntegral: null,
-        waresPic: null,
-        waresDetail: null,
-        waresStatus: null,
-        createName: null,
-        updateName: null,
-        stationId: null
+        waresName: null
       },
       deptInfo:{},
       deptId: null,
@@ -174,15 +150,9 @@ export default {
    
     /** 查询【请填写功能名称】列表 */
     getList() {
-      this.loading = true;
-      this.queryParams.stationId= this.$store.selectDeptId;
-     if(this.queryParams.stationId==null || this.queryParams.stationId==""){
-        this.queryParams.stationId =this.$store.state.user.deptId;
-      }
       listWares(this.queryParams).then(response => {
         this.waresList = response.rows;
         this.total = response.total;
-        this.loading = false;
       });
     },
     // 取消按钮
@@ -199,16 +169,12 @@ export default {
         saleIntegral: null,
         waresPic: null,
         waresDetail: null,
-        waresStatus: "0",
+        waresStatus: "1",
         createTime: null,
         createBy: null,
-        createName: null,
         updateTime: null,
         updateBy: null,
-        updateName: null,
-        waresCount: null,
-        stationId: null,
-        stationName: null
+        waresCount: null
       };
       this.resetForm("form");
     },
@@ -222,12 +188,6 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
@@ -240,8 +200,6 @@ export default {
           if(this.deptInfo.jiBie==2){
             this.open = true;
             this.title = "添加商品信息";
-            this.form.stationId=this.deptInfo.deptId;
-            this.form.stationName=this.deptInfo.deptName;
           }else{
               this.msgSuccess("请选择油站");
           }
@@ -250,8 +208,7 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const id = row.id || this.ids
-      console.log(row.waresStatus);
+      const id = row.id 
       getWares(id).then(response => {
         this.form = response.data;
         this.open = true;
@@ -293,20 +250,6 @@ export default {
         }
       });
     },
-    
-    /** 导出按钮操作 */
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm('是否确认导出所有商品数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return exportWares(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-        })
-    },
     // 文件上传成功处理++ =
     handleAvatarSuccess(res, file) {
       let imgurl=location.protocol+"//"+location.host+process.env.VUE_APP_BASE_API+res .fileName;

+ 613 - 452
src/views/point/Point_Rule.vue

@@ -1,18 +1,91 @@
 <template>
   <div class="app-container">
     <el-form ref="form" :model="form" :rules="rules" label-width="120px">
-      <el-form-item label="是否开启积分规则功能"  label-width="160px">
+      <el-form-item label="是否开启积分规则功能" label-width="160px">
         <el-radio-group v-model="ruleForm.integralFlag">
-          <el-radio
-            v-for="dict in integralFlagOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
+          <el-radio label="0">关闭</el-radio>
+          <el-radio label="1">开启</el-radio>
         </el-radio-group>
       </el-form-item>
-      <el-form-item  label="油品积分规则" ></el-form-item>
-      <div>
-        <el-row v-for="(item, index) in form.itemsDetail"  :key="index" style="margin-left: 80px;">
+      <el-form-item label="油品积分规则">
+        <div 
+          v-for="(item, index) in form.itemsDetail||[]" 
+          :key="index"
+          style="border:1px solid"
+        >
+          <div>
+            适用油品
+            <el-select
+              v-model="item.oilName"
+              placeholder="请选择油品"
+              clearable
+              size="small"
+              @change="oilNameChang(index)"
+            >
+              <el-option
+                v-for="item in oilNameOptions"
+                :key="item.oilName"
+                :label="item.oilName"
+                :value="item.oilName"
+              ></el-option>
+            </el-select>
+          </div>
+          <div>
+            规则类型
+            <el-select
+              v-model="item.ruleType"
+              placeholder="请选择规则"
+              clearable
+              size="small"
+            >
+              <el-option label="以订单实付累计" value="1"></el-option>
+              <el-option label="以订单应付累计" value="2"></el-option>
+              <el-option label="以加油升数累计" value="3"></el-option>
+            </el-select>
+          </div>
+          <div>
+            适用等级
+            <el-select
+              v-model="item.gread"
+              placeholder="请选择等级"
+              clearable
+              size="small"
+            >
+              <el-option
+                v-for="item in gradeOptions[index]"
+                :key="item.grade"
+                :label="item.grade"
+                :value="item.grade"
+              ></el-option>
+            </el-select>
+          </div>
+          <div>
+            满<el-input-number v-model="item.ruleTerms" :min="0" size="small" />元(L) 开始积分
+          </div>
+          <div>
+            每消费<el-input-number v-model="item.saleAmt" size="small" :min="0" />元获得<el-input-number v-model="item.integral" size="small" :min="0" />积分
+          </div>
+          <div>
+              <el-button type="danger" @click="del(index)" size="small"
+                >删除</el-button
+              >
+              <el-button
+                v-show="index == rowsnum"
+                type="success"
+                @click="addItem()"
+                size="small"
+                >新增</el-button
+              >
+          </div>
+        </div>
+      </el-form-item>
+
+      <!-- <div>
+        <el-row
+          v-for="(item, index) in form.itemsDetail"
+          :key="index"
+          style="margin-left: 80px"
+        >
           <el-form
             :inline="true"
             :model="form.itemsDetail[index]"
@@ -22,21 +95,13 @@
             size="small"
           >
             <el-form-item>
-              <span>规则类型</span>
-              <el-select v-model="item.ruleType" placeholder="请选择规则" clearable size="small">
-                <el-option
-                  v-for="item in ruleTypeOptions"
-                  :key="item.dictValue"
-                  :label="item.dictLabel"
-                  :value="item.dictValue"
-                ></el-option>
-              </el-select>
-              <span>满</span>
-              <el-input-number v-model="item.ruleTerms" :min="0" size="small" />
-              <span v-if="item.ruleType=='3'">L</span>
-              <span v-else>元</span>
-              <span>起累计 </span>
-              <el-select v-model="item.oilName" placeholder="请选择油品" clearable size="small" @change="oilNameChang(index)" >
+              <el-select
+                v-model="item.oilName"
+                placeholder="请选择油品"
+                clearable
+                size="small"
+                @change="oilNameChang(index)"
+              >
                 <el-option
                   v-for="item in oilNameOptions"
                   :key="item.oilName"
@@ -44,6 +109,23 @@
                   :value="item.oilName"
                 ></el-option>
               </el-select>
+              <span> 规则类型</span>
+              <el-select
+                v-model="item.ruleType"
+                placeholder="请选择规则"
+                clearable
+                size="small"
+              >
+                <el-option label="以订单实付累计" value="1"></el-option>
+                <el-option label="以订单应付累计" value="2"></el-option>
+                <el-option label="以加油升数累计" value="3"></el-option>
+              </el-select>
+              <span>满</span>
+              <el-input-number v-model="item.ruleTerms" :min="0" size="small" />
+              <span v-if="item.ruleType == '3'">L</span>
+              <span v-else>元</span>
+              <span>起累计 </span>
+
               <el-select
                 v-model="item.gread"
                 placeholder="请选择等级"
@@ -58,31 +140,34 @@
                 ></el-option>
               </el-select>
               <span>每消费</span>
-              <el-input-number v-model="item.saleAmt"  size="small" :min="0"/>
-              <span v-if="item.ruleType=='3'">L</span>
+              <el-input-number v-model="item.saleAmt" size="small" :min="0" />
+              <span v-if="item.ruleType == '3'">L</span>
               <span v-else>元</span>
-              <el-input-number v-model="item.integral" size="small" :min="0"/>
+              <el-input-number v-model="item.integral" size="small" :min="0" />
               <span>积分</span>
             </el-form-item>
             <el-form-item>
+              <el-button type="danger" @click="del(index)" size="small"
+                >删除</el-button
+              >
               <el-button
-                type="danger"
-                @click="del(index)"
-                size="small"
-              >删除</el-button>
-              <el-button
-                v-show="index==rowsnum"
+                v-show="index == rowsnum"
                 type="success"
                 @click="addItem()"
                 size="small"
-              >新增</el-button>
+                >新增</el-button
+              >
             </el-form-item>
           </el-form>
         </el-row>
-      </div>
-      <el-form-item  label="非油品积分规则" ></el-form-item>
-       <div>
-        <el-row v-for="(item, index) in form.notOilList"  :key="index" style="margin-left: 80px;">
+      </div> -->
+      <el-form-item label="非油品积分规则"></el-form-item>
+      <div>
+        <el-row
+          v-for="(item, index) in form.notOilList"
+          :key="index"
+          style="margin-left: 80px"
+        >
           <el-form
             :inline="true"
             :model="form.notOilList[index]"
@@ -95,109 +180,174 @@
               <span>满</span>
               <el-input-number v-model="item.ruleTerms" :min="0" size="small" />
               <span></span>
-              <span>元  起累计 </span>
+              <span>元 起累计 </span>
               <span>每消费</span>
-              <el-input-number v-model="item.saleAmt"  size="small" :min="0"/>
+              <el-input-number v-model="item.saleAmt" size="small" :min="0" />
               <span>元</span>
-              <el-input-number v-model="item.integral" size="small" :min="0"/>
+              <el-input-number v-model="item.integral" size="small" :min="0" />
               <span>积分</span>
             </el-form-item>
-            <el-button
-                type="danger"
-                @click="delNoil()"
-                size="small"
-              >清空非油品积分规则</el-button>
+            <el-button type="danger" @click="delNoil()" size="small"
+              >清空非油品积分规则</el-button
+            >
           </el-form>
         </el-row>
       </div>
-       <el-form-item label="积分有效期设置" prop="termDateManage">
+      <el-form-item label="积分有效期设置" prop="termDateManage">
         <el-radio-group v-model="form.integralTermSetting">
-          <el-radio
-            v-for="dict in integralTermSettingOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
+          <el-radio :label="1"> 永久有效 </el-radio>
+          <el-radio :label="2"> 指定清空积分时间 </el-radio>
         </el-radio-group>
-        <el-date-picker clearable size="small" style="width: 200px;margin-left: 10px;"
-                        v-model="form.integralEmptyTime"
-                        type="datetime">
+        <el-date-picker
+          clearable
+          size="small"
+          style="width: 200px; margin-left: 10px"
+          v-model="form.integralEmptyTime"
+          type="datetime"
+        >
         </el-date-picker>
       </el-form-item>
-    
+
       <el-form-item label="积分活动时限" prop="termDateManage">
         <el-radio-group v-model="form.termDateManage">
-          <el-radio
-            v-for="dict in termDateManageOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
+          <el-radio label="1">不指定结束时间</el-radio>
+          <el-radio label="2">指定结束时间</el-radio>
         </el-radio-group>
-        <el-date-picker clearable size="small" style="width: 200px;margin-left: 10px;"
-                        v-model="form.emptyDate"
-                        type="date"
-                        value-format="yyyy-MM-dd">
+        <el-date-picker
+          clearable
+          size="small"
+          style="width: 200px; margin-left: 10px"
+          v-model="form.emptyDate"
+          type="date"
+          value-format="yyyy-MM-dd"
+        >
         </el-date-picker>
       </el-form-item>
-    
-      <el-form-item label="积分活动设置" ></el-form-item>
       <el-form-item label="多倍积分活动">
         <el-radio-group v-model="form.integralActivity">
-          <el-radio
-            v-for="dict in integralActivityOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
+          <el-radio label="0">关闭</el-radio>
+          <el-radio label="1">开启</el-radio>
         </el-radio-group>
       </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-option
-                  v-for="item in datePickerOptions"
-                  :key="item.dictValue"
-                  :label="item.dictLabel"
-                  :value="item.dictValue"
-                ></el-option>
-              </el-select>
+          <el-form-item label="周期类型" prop="datePicker">
+            <el-select
+              v-model="form.datePicker"
+              clearable
+              size="small"
+              @change="datePickerChang"
+            >
+              <el-option label="每周指定日" value="1"></el-option>
+              <el-option label="每月指定日" value="2"></el-option>
+              <el-option label="固定活动日" value="3"></el-option>
+            </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8">  
+        <el-col :span="8">
           <el-form-item v-show="workDaytrue">
-            <div style="display: flex;flex-wrap: wrap;border-style: solid;border-color:#F5F7FA">
-              <div v-for="(item, index) in workDay" :key="index" style="margin:3px;">
-                <div class="hover-style" style="border-radius:5px;font-weight:bold;font-size:12px;cursor: pointer;" @click="clickWorkDayCalendar(item, index)">
+            <div
+              style="
+                display: flex;
+                flex-wrap: wrap;
+                border-style: solid;
+                border-color: #f5f7fa;
+              "
+            >
+              <div
+                v-for="(item, index) in workDay"
+                :key="index"
+                style="margin: 3px"
+              >
+                <div
+                  class="hover-style"
+                  style="
+                    border-radius: 5px;
+                    font-weight: bold;
+                    font-size: 12px;
+                    cursor: pointer;
+                  "
+                  @click="clickWorkDayCalendar(item, index)"
+                >
                   <div>{{ item }}</div>
-                  <div v-if="collectClickWorkDay.indexOf(index) > -1" style="width:4px;height:4px;border-radius:50%;background-color:red;position: relative;left:calc(50% - 2px);"></div>
-                  <div v-else style="width:4px;height:4px;"></div>
+                  <div
+                    v-if="collectClickWorkDay.indexOf(index) > -1"
+                    style="
+                      width: 4px;
+                      height: 4px;
+                      border-radius: 50%;
+                      background-color: red;
+                      position: relative;
+                      left: calc(50% - 2px);
+                    "
+                  ></div>
+                  <div v-else style="width: 4px; height: 4px"></div>
                 </div>
               </div>
-             </div>
+            </div>
           </el-form-item>
-          <el-form-item v-show="moonDaytrue" >
-             <div style="display: flex;flex-wrap: wrap;border-style: solid;border-color:#F5F7FA">
-              <div v-for="(item, index) in moonEverDay" :key="index" style="margin:3px;">
-                <div class="hover-style" style="border-radius:5px;font-weight:bold;font-size:12px;cursor: pointer;" @click="clickCalendar(item, index)">
+          <el-form-item v-show="moonDaytrue">
+            <div
+              style="
+                display: flex;
+                flex-wrap: wrap;
+                border-style: solid;
+                border-color: #f5f7fa;
+              "
+            >
+              <div
+                v-for="(item, index) in moonEverDay"
+                :key="index"
+                style="margin: 3px"
+              >
+                <div
+                  class="hover-style"
+                  style="
+                    border-radius: 5px;
+                    font-weight: bold;
+                    font-size: 12px;
+                    cursor: pointer;
+                  "
+                  @click="clickCalendar(item, index)"
+                >
                   <div>{{ item }}</div>
-                  <div v-if="collectClickCalendar.indexOf(index) > -1" style="width:4px;height:4px;border-radius:50%;background-color:red;position: relative;left:calc(50% - 2px);"></div>
-                  <div v-else style="width:4px;height:4px;"></div>
+                  <div
+                    v-if="collectClickCalendar.indexOf(index) > -1"
+                    style="
+                      width: 4px;
+                      height: 4px;
+                      border-radius: 50%;
+                      background-color: red;
+                      position: relative;
+                      left: calc(50% - 2px);
+                    "
+                  ></div>
+                  <div v-else style="width: 4px; height: 4px"></div>
                 </div>
               </div>
-             </div>
+            </div>
           </el-form-item>
-          <el-form-item  v-show="datetrue">
-            <el-date-picker clearable size="small" style="margin-left: 10px;width: 200px"
-                            v-model="pickerTime"
-                            type="dates"
-                            value-format="yyyy-MM-dd"
-                            placeholder="选择提醒时间设置">
+          <el-form-item v-show="datetrue">
+            <el-date-picker
+              clearable
+              size="small"
+              style="margin-left: 10px; width: 200px"
+              v-model="pickerTime"
+              type="dates"
+              value-format="yyyy-MM-dd"
+              placeholder="选择提醒时间设置"
+            >
             </el-date-picker>
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item  label="积分比例" prop="integralProportion">
-            <el-input-number v-model="form.integralProportion" style="width:130px;" :min="1" placeholder="请输入加倍比例" />
+          <el-form-item label="积分比例" prop="integralProportion">
+            <el-input-number
+              v-model="form.integralProportion"
+              style="width: 130px"
+              :min="1"
+              placeholder="请输入加倍比例"
+            />
             <span>倍</span>
           </el-form-item>
         </el-col>
@@ -209,520 +359,531 @@
           :headers="headers"
           multiple
           list-type="picture-card"
-          :limit='5'
+          :limit="5"
           :file-list="form.imgFileList"
           accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
           :before-upload="beforeAvatarUpload"
           :on-remove="handleRemove"
-          :on-success="handlepaymentSuccess">
+          :on-success="handlepaymentSuccess"
+        >
           <i class="el-icon-plus"></i>
-          <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,最多上传5张且单张图片不超过1M</div>
+          <div class="el-upload__tip" slot="tip">
+            只能上传jpg/png文件,最多上传5张且单张图片不超过1M
+          </div>
         </el-upload>
         <el-dialog :visible.sync="dialogVisible" append-to-body>
           <img width="100%" :src="dialogImageUrl" alt="" />
         </el-dialog>
       </el-form-item>
     </el-form>
-    <div slot="footer" class="dialog-footer"> 
-      <el-button type="primary" @click="submitForm" :disabled="false" >确 定</el-button>
+    <div slot="footer" class="dialog-footer">
+      <el-button type="primary" @click="submitForm" :disabled="false"
+        >确 定</el-button
+      >
     </div>
   </div>
 </template>
 
 <script>
 import { getToken } from "@/utils/auth";
-import {  addRule, updateRule,oilNameInfo,gradeList,listRuleOne} from "@/api/integral/rule";
-import { getDept } from "@/api/system/dept";
-import {getStationPay,updatePay} from "@/api/station/pay";
+import {
+  addRule,
+  updateRule,
+  oilNameInfo,
+  gradeList,
+  listRuleOne,
+} from "@/api/integral/rule";
+import { getStationPay, updatePay } from "@/api/station/pay";
 export default {
-name: "point_rule",
+  name: "Point_Rule",
   data() {
     return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 弹出层标题
-      title: "",
-      uploadUrl:"",
-      // stationOptions:[],
-      oilNameOptions:[],
-      ruleTypeOptions:[],
-      termDateManageOptions:[],
-      integralActivityOptions:[],
-      integralTermSettingOptions:[],
-      datePickerOptions:[],
-      gradeOptions:[],
-      dialogImageUrl: '',
-      integralFlagOptions:[],
-      ruleForm:{
-        imgFileList:[]
+      oilNameOptions: [],
+      gradeOptions: [],
+      dialogImageUrl: "",
+      ruleForm: {
+        imgFileList: [],
       },
-      num :0,
-      pickerTime:"",
+      num: 0,
+      pickerTime: "",
       dialogVisible: false,
-      workDaytrue:false,
-      moonDaytrue:false,
-      datetrue:false,
+      workDaytrue: false,
+      moonDaytrue: false,
+      datetrue: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
-        pageSize: 10,
-        stationId: null,
-        stationName: null,
-        ruleType: null,
-        oilName: null
+        pageSize: 100,
       },
-      rowsnum:0,
+      rowsnum: 0,
       // 表单参数
       form: {
         itemsDetail: [{}],
         notOilList: [{}],
-        imgFileList:[]
+        imgFileList: [],
       },
-      queryRule:{
-          stationId: null
-        },
-      deptInfo:{},
-      query:{
-        deptId: null
+      deptInfo: {},
+      query: {
+        deptId: null,
       },
       // 表单校验
-      rules: {
-      },
+      rules: {},
       headers: { Authorization: "Bearer " + getToken() },
       collectClickCalendar: [], // 收集固定日期选择的日子
-      collectClickWorkDay:[],
-      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'],
-      workDay:["周天","周一","周二","周三","周四","周五","周六"],
-      addressUrl: location.protocol+"//"+location.host+ process.env.VUE_APP_BASE_API+"/common/upload"
+      collectClickWorkDay: [],
+      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",
+      ],
+      workDay: ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
+      addressUrl:
+        location.protocol +
+        "//" +
+        location.host +
+        process.env.VUE_APP_BASE_API +
+        "/common/upload",
     };
   },
   created() {
-    this.getDicts("status").then(response => {
-      this.integralFlagOptions = response.data;
-    });
-    this.getDicts("rule_type").then(response => {
-      this.ruleTypeOptions = response.data;
-    });
-    this.getDicts("term_date").then(response => {
-      this.termDateManageOptions = response.data;
-    });
-    
-    this.getDicts("integral_manage").then(response => {
-      this.integralActivityOptions = response.data;
-    });
-    this.getDicts("integral_term_setting").then(response => {
-      this.integralTermSettingOptions = response.data;
-    });
-    this.getDicts("date_picker").then(response => {
-      this.datePickerOptions = 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.form.stationId=this.deptInfo.deptId;
-          this.form.stationName=this.deptInfo.deptName;
-          this.queryParams.stationId=this.deptInfo.deptId;
-          listRuleOne(this.queryParams).then(response => {
-            if(response.hasOwnProperty('data')){
-              this.form = response.data;
-              if(response.data.hasOwnProperty('notOilList')){
-                if(this.form.notOilList.length==0){
-                   this.form.notOilList=[{}];
-                }
-              }else{
-                  this.form.notOilList=[{}];
-              }
-              if(response.data.hasOwnProperty('itemsDetail')  ){
-                if(this.form.itemsDetail.length==0){
-                   this.form.itemsDetail=[{}];
-                }else{
-                  let itemDetail = this.form.itemsDetail;
-                  this.sjfa(itemDetail);
-                  this.rowsnum= this.form.itemsDetail.length-1;
-                }
-              }else{
-                this.form.itemsDetail=[{}];
-              }
-              let datepicker = this.form.datePicker;
-              if(datepicker=="1"){
-                this.workDaytrue=true;
-                if(this.form.datePickerTime!=null){
-                  this.collectClickWorkDay= this.form.datePickerTime.split(',').map(parseFloat);
-                }
-              }else if(datepicker=="2"){
-                this.moonDaytrue=true;
-                if(this.form.datePickerTime!=null){
-                  this.collectClickCalendar= this.form.datePickerTime.split(',').map(parseFloat);
-                }
-              }else{
-                this.datetrue=true;
-                if(this.form.datePickerTime!=null){
-                  this.pickerTime= this.form.datePickerTime.split(',');
-                }else{
-                  this.pickerTime=null;
-                }
-              }
-            }
-          });
-          oilNameInfo(this.queryParams).then(response => {
-            this.oilNameOptions = response.rows;
-          });
-        }else{
-            this.msgSuccess("请选择油站");
+    listRuleOne(this.queryParams).then((response) => {
+      console.log("response", response);
+      if (response.hasOwnProperty("data")) {
+        this.form = response.data;
+
+        if (response.data.hasOwnProperty("itemsDetail")) {
+          if (this.form.itemsDetail.length == 0) {
+            this.form.itemsDetail = [{}];
+          } else {
+            let itemDetail = this.form.itemsDetail;
+            this.sjfa(itemDetail);
+            this.rowsnum = this.form.itemsDetail.length - 1;
+          }
+        } else {
+          this.form.itemsDetail = [{}];
+        }
+        let datepicker = this.form.datePicker;
+        if (datepicker == "1") {
+          this.workDaytrue = true;
+          if (this.form.datePickerTime != null) {
+            this.collectClickWorkDay = this.form.datePickerTime
+              .split(",")
+              .map(parseFloat);
+          }
+        } else if (datepicker == "2") {
+          this.moonDaytrue = true;
+          if (this.form.datePickerTime != null) {
+            this.collectClickCalendar = this.form.datePickerTime
+              .split(",")
+              .map(parseFloat);
+          }
+        } else {
+          this.datetrue = true;
+          if (this.form.datePickerTime != null) {
+            this.pickerTime = this.form.datePickerTime.split(",");
+          } else {
+            this.pickerTime = null;
+          }
         }
+      }
+    });
+    oilNameInfo(this.queryParams).then((response) => {
+      this.oilNameOptions = response.rows;
     });
-//查看当前积分设置
-    this.queryRule.stationId= this.$store.selectDeptId;
-    if(this.queryRule.stationId==null || this.queryRule.stationId==""){
-      this.queryRule.stationId =this.$store.state.user.deptId;
-    }
-    getStationPay(this.queryRule).then(response => {
+
+    //查看当前积分设置
+
+    getStationPay().then((response) => {
       this.ruleForm = response.data;
-      if(this.ruleForm.integralFlag == ""){
-        this.ruleForm.integralFlag ="0";
+      if (this.ruleForm.integralFlag == "") {
+        this.ruleForm.integralFlag = "0";
       }
     });
   },
   methods: {
-    async sjfa(itemDetail ){
-      for(let j = 0; j < itemDetail.length; j++) {
-        this.queryParams.stationId = this.form.stationId;
-        this.queryParams.oilName = itemDetail[j].oilName;
-        if(itemDetail[j].gread ===""){
-            itemDetail[j].gread = "所有人";
-        }
-        const response = await gradeList(this.queryParams);
-        response.rows.push({grade:"所有人"});
+    async sjfa(itemDetail) {
+      for (let j = 0; j < itemDetail.length; j++) {
+        const response = await gradeList({oilName:itemDetail[j].oilName});
+        response.rows.push({id:0, grade: "所有人" });
         this.gradeOptions.push(response.rows);
       }
     },
     //添加行
     addItem() {
       this.form.itemsDetail.push({
-        ruleTerms: '',
-        oilName: '',
-        gread: '',
-        saleAmt: '' ,
-        integral: '',
-        ruleType: ''
+        ruleTerms: "",
+        oilName: "",
+        gread: "",
+        saleAmt: "",
+        integral: "",
+        ruleType: "",
       });
-      this.rowsnum=this.form.itemsDetail.length-1;
+      this.rowsnum = this.form.itemsDetail.length - 1;
     },
     // 删除行
     del(index) {
       this.form.itemsDetail.splice(index, 1);
-      this.rowsnum=this.form.itemsDetail.length-1;
-      if(this.form.itemsDetail.length<=0){
-         this.addItem();
+      this.rowsnum = this.form.itemsDetail.length - 1;
+      if (this.form.itemsDetail.length <= 0) {
+        this.addItem();
       }
     },
-    delNoil(){
-      this.form.notOilList =[{}];
-    },
-    queryreset() {
-      this.queryParams={
-        stationId: null,
-        stationName: null,
-        oilName: null
-      }
+    delNoil() {
+      this.form.notOilList = [{}];
     },
-    oilNameChang(index){
-      let obj = {};
-      obj = this.oilNameOptions.find((item)=>{//这里的userList就是上面遍历的数据源
-        return item.oilName === this.form.itemsDetail[index].oilName;//筛选出匹配数据
-      })
-      this.queryreset();
-      //获取油站名称
-      this.queryParams.stationId = this.form.stationId;
-      this.queryParams.oilName=obj.oilName;
-      gradeList(this.queryParams).then(response => {
-        const temp = [...this.gradeOptions]
-        response.rows.push({grade:"所有人"});
+    oilNameChang(index) {
+      gradeList({
+        oilName: this.form.itemsDetail[index].oilName
+      }).then((response) => {
+        console.log('response', response)
+        console.log("this.gradeOptions",this.gradeOptions);
+        const temp = [...this.gradeOptions];
+        response.rows.push({ grade: "所有人", id: 0});
         temp[index] = response.rows;
         this.gradeOptions = temp;
       });
     },
-   
+
     handleRemove(file, fileList) {
-      if(fileList!=null && fileList.length>0){
-        this.form.imgFileList=[];
+      if (fileList != null && fileList.length > 0) {
+        this.form.imgFileList = [];
         for (let i = 0; i < fileList.length; i++) {
           let fileName = fileList[i].name;
           let imgurl = fileList[i].url;
-          this.form.imgFileList.push({name:fileName,url:imgurl});
+          this.form.imgFileList.push({ name: fileName, url: imgurl });
         }
-      }else{
-         this.form.imgFileList = fileList;
+      } else {
+        this.form.imgFileList = fileList;
       }
     },
     beforeAvatarUpload(file) {
       const isLt5M = file.size / 1024 / 1024 < 1;
       if (!isLt5M) {
-        this.$message.error('上传头像图片大小不能超过 1MB!');
+        this.$message.error("上传头像图片大小不能超过 1MB!");
       }
-      return  isLt5M;
+      return isLt5M;
     },
-   //上传成功
-    handlepaymentSuccess(response,file, fileList){
-        let imgurl=location.protocol+"//"+location.host+process.env.VUE_APP_BASE_API+response.fileName;
-        this.form.imgFileList.push({name:file.name,url:imgurl});
+    //上传成功
+    handlepaymentSuccess(response, file, fileList) {
+      let imgurl =
+        location.protocol +
+        "//" +
+        location.host +
+        process.env.VUE_APP_BASE_API +
+        response.fileName;
+      this.form.imgFileList.push({ name: file.name, url: imgurl });
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.id != null) {
-            if(this.form.notOilList!=null&&this.form.notOilList.length==0 ){
-            }else{
-               if(this.form.notOilList[0].saleAmt==""||this.form.notOilList[0].saleAmt=="0" ||this.form.notOilList[0].saleAmt=="undefined"){
-                this.form.notOilList=[{}];
+            if (
+              this.form.notOilList != null &&
+              this.form.notOilList.length == 0
+            ) {
+            } else {
+              if (
+                this.form.notOilList[0].saleAmt == "" ||
+                this.form.notOilList[0].saleAmt == "0" ||
+                this.form.notOilList[0].saleAmt == "undefined"
+              ) {
+                this.form.notOilList = [{}];
               }
             }
             let datepicker = this.form.datePicker;
-            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];
+            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;
+                  } else {
+                    discountTime = discountTime;
                   }
                 }
-                this.form.datePickerTime=discountTime; 
-                discountTime=null;
-              }else{
-                  this.form.datePickerTime=""; 
-              }  
-            }else if(datepicker=="2"){
-              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];
+                this.form.datePickerTime = discountTime;
+                discountTime = null;
+              } else {
+                this.form.datePickerTime = "";
+              }
+            } else if (datepicker == "2") {
+              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;
+                  } else {
+                    discountTime = discountTime;
                   }
                 }
-                this.form.datePickerTime=discountTime; 
-                discountTime=null;
-              } else{
-                  this.form.datePickerTime=""; 
+                this.form.datePickerTime = discountTime;
+                discountTime = null;
+              } else {
+                this.form.datePickerTime = "";
               }
-            }else{
-              if(this.pickerTime!=null){
-                  this.form.datePickerTime = this.pickerTime.toString();
-              }else{
+            } else {
+              if (this.pickerTime != null) {
+                this.form.datePickerTime = this.pickerTime.toString();
+              } else {
                 this.form.datePickerTime = "";
               }
             }
-            let itemsDetail =this.form.itemsDetail;
-            let flag= true;
-            if(itemsDetail!=null&&itemsDetail.length>1){
+            let itemsDetail = this.form.itemsDetail;
+            let flag = true;
+            if (itemsDetail != null && itemsDetail.length > 1) {
               for (var i = 0; i < itemsDetail.length; i++) {
-                  for (var j = i + 1; j < itemsDetail.length; j++) {
-                    if (itemsDetail[i].oilName == itemsDetail[j].oilName) { 
-                      if(itemsDetail[i].gread==itemsDetail[j].gread){
-                        flag=false;
+                for (var j = i + 1; j < itemsDetail.length; j++) {
+                  if (itemsDetail[i].oilName == itemsDetail[j].oilName) {
+                    if (itemsDetail[i].gread == itemsDetail[j].gread) {
+                      flag = false;
+                      break;
+                    } else if (itemsDetail[i].gread != itemsDetail[j].gread) {
+                      if (itemsDetail[i].gread == "所有人") {
+                        flag = false;
+                        break;
+                      } else if (itemsDetail[j].gread == "所有人") {
+                        flag = false;
                         break;
-                      }else if(itemsDetail[i].gread!=itemsDetail[j].gread){
-                        if(itemsDetail[i].gread=="所有人"){
-                          flag=false;
-                          break;
-                        }else if(itemsDetail[j].gread=="所有人"){
-                          flag=false;
-                          break;
-                        }
                       }
                     }
                   }
-                  if (!flag){
-                    break;  
-                  } 
+                }
+                if (!flag) {
+                  break;
+                }
               }
             }
-            if(flag){
-              updateRule(this.form).then(response => {
+            if (flag) {
+              updateRule(this.form).then((response) => {
                 this.msgSuccess("修改成功");
               });
-            }else{
-               this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
+            } else {
+              this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
             }
           } else {
-            if(this.num===0){
-                let datepicker = this.form.datePicker;
-              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];
+            if (this.num === 0) {
+              let datepicker = this.form.datePicker;
+              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;
+                    } else {
+                      discountTime = discountTime;
                     }
                   }
-                  this.form.datePickerTime=discountTime; 
-                  discountTime=null;
-                }else{
-                    this.form.datePickerTime=""; 
-                }  
-              }else if(datepicker=="2"){
-                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];
+                  this.form.datePickerTime = discountTime;
+                  discountTime = null;
+                } else {
+                  this.form.datePickerTime = "";
+                }
+              } else if (datepicker == "2") {
+                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;
+                    } else {
+                      discountTime = discountTime;
                     }
                   }
-                  this.form.datePickerTime=discountTime; 
-                  discountTime=null;
-                } else{
-                    this.form.datePickerTime=""; 
+                  this.form.datePickerTime = discountTime;
+                  discountTime = null;
+                } else {
+                  this.form.datePickerTime = "";
                 }
-              }else{
-                if(this.pickerTime!=null){
-                    this.form.datePickerTime = this.pickerTime.toString();
-                }else{
+              } else {
+                if (this.pickerTime != null) {
+                  this.form.datePickerTime = this.pickerTime.toString();
+                } else {
                   this.form.datePickerTime = "";
                 }
               }
-              let itemsDetail =this.form.itemsDetail;
-              let flag= true;
+              let itemsDetail = this.form.itemsDetail;
+              let flag = true;
               //验证积分规则,相同油品,等级为所有人,该油品不能再设置其他等级。相同油品等级不为所有人,可以设置不同等级的规则,不可以设置油品相同等级相同的规则
-              if(itemsDetail!=null&&itemsDetail.length>0){
+              if (itemsDetail != null && itemsDetail.length > 0) {
                 for (var i = 0; i < itemsDetail.length; i++) {
-                    for (var j = i + 1; j < itemsDetail.length; j++) {
-                      if (itemsDetail[i].ruleType == itemsDetail[j].ruleType &&itemsDetail[i].oilName == itemsDetail[j].oilName&& itemsDetail[i].gread==itemsDetail[j].gread) { 
-                        flag=false;
-                        break;
-                      }
+                  for (var j = i + 1; j < itemsDetail.length; j++) {
+                    if (
+                      itemsDetail[i].ruleType == itemsDetail[j].ruleType &&
+                      itemsDetail[i].oilName == itemsDetail[j].oilName &&
+                      itemsDetail[i].gread == itemsDetail[j].gread
+                    ) {
+                      flag = false;
+                      break;
                     }
-                    if (flag) break;
+                  }
+                  if (flag) break;
                 }
               }
-              if(flag){
-                addRule(this.form).then(response => {
+              if (flag) {
+                addRule(this.form).then((response) => {
                   this.msgSuccess("新增成功");
                 });
-              }else{
+              } else {
                 this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
               }
-              this.num=this.num+1;
-            }else{
-                this.msgSuccess("已新增成功!如需修改请刷新页面");
+              this.num = this.num + 1;
+            } else {
+              this.msgSuccess("已新增成功!如需修改请刷新页面");
             }
           }
         }
       });
       if (this.ruleForm.payId != null) {
-        updatePay(this.ruleForm).then(response => {
-        });
-      }  
+        updatePay(this.ruleForm).then((response) => {});
+      }
     },
-  
+
     deleteItemFromArr(item) {
       // eslint-disable-next-line
-      Array.prototype.indexOf = function(val) {
+      Array.prototype.indexOf = function (val) {
         for (var i = 0; i < this.length; i++) {
           if (this[i] === val) {
-            return i
+            return i;
           }
         }
-        return -1
-      }
+        return -1;
+      };
       // 通过索引删除数组元素
-      Array.prototype.remove = function(val) {
-        var index = this.indexOf(val)
+      Array.prototype.remove = function (val) {
+        var index = this.indexOf(val);
         if (index > -1) {
-          this.splice(index, 1)
+          this.splice(index, 1);
         }
-      }
+      };
       // 删除数组元素
-      this.collectClickCalendar.remove(item)
+      this.collectClickCalendar.remove(item);
     },
     clickCalendar(item, index) {
       if (this.collectClickCalendar.indexOf(index) === -1) {
-        this.collectClickCalendar.push(index)
+        this.collectClickCalendar.push(index);
       } else if (this.collectClickCalendar.indexOf(index) > -1) {
-        this.deleteItemFromArr(index)
+        this.deleteItemFromArr(index);
       }
     },
     deleteWorkDayFromArr(item) {
-      Array.prototype.indexOf = function(val) {
+      Array.prototype.indexOf = function (val) {
         for (var i = 0; i < this.length; i++) {
           if (this[i] === val) {
-            return i
+            return i;
           }
         }
-        return -1
-      }
+        return -1;
+      };
       // 通过索引删除数组元素
-      Array.prototype.remove = function(val) {
-        var index = this.indexOf(val)
+      Array.prototype.remove = function (val) {
+        var index = this.indexOf(val);
         if (index > -1) {
-          this.splice(index, 1)
+          this.splice(index, 1);
         }
-      }
+      };
       // 删除数组元素
-      this.collectClickWorkDay.remove(item)
+      this.collectClickWorkDay.remove(item);
     },
     clickWorkDayCalendar(item, index) {
       if (this.collectClickWorkDay.indexOf(index) === -1) {
-        this.collectClickWorkDay.push(index)
+        this.collectClickWorkDay.push(index);
       } else if (this.collectClickWorkDay.indexOf(index) > -1) {
-        this.deleteWorkDayFromArr(index)
+        this.deleteWorkDayFromArr(index);
       }
     },
-    datePickerChang(){
-      if(this.form.datePicker == "1"){
-        this.workDaytrue=true;
-        this.moonDaytrue=false;
-        this.datetrue=false;
-      }else if(this.form.datePicker == "2"){
-        this.workDaytrue=false;
-        this.moonDaytrue=true;
-        this.datetrue=false;
-      }else if(this.form.datePicker == "3"){
-        this.workDaytrue=false;
-        this.moonDaytrue=false;
-        this.datetrue=true;
+    datePickerChang() {
+      if (this.form.datePicker == "1") {
+        this.workDaytrue = true;
+        this.moonDaytrue = false;
+        this.datetrue = false;
+      } else if (this.form.datePicker == "2") {
+        this.workDaytrue = false;
+        this.moonDaytrue = true;
+        this.datetrue = false;
+      } else if (this.form.datePicker == "3") {
+        this.workDaytrue = false;
+        this.moonDaytrue = false;
+        this.datetrue = true;
       }
-    }
+    },
   },
-}
+};
 </script>
 <style scoped>
 .hover-style:hover {
   color: white;
   background-color: blue;
 }
-
 </style>