瀏覽代碼

阶梯直降完成

Joe 4 年之前
父節點
當前提交
6bc554defb

+ 1 - 1
.env.development

@@ -2,7 +2,7 @@
 ENV = 'development'
 
 # 智慧易加管理系统/开发环境
-VUE_APP_BASE_API = 'http://demo.huijy.net/prod-api'
+VUE_APP_BASE_API = 'http://test.huijy.net/prod-api'
 
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 19 - 0
src/api/market/plan.js

@@ -51,3 +51,22 @@ export function exportPlan(query) {
     params: query
   })
 }
+
+// 新增阶梯直降
+export function addMarketPlanInfo(query) {
+  return request({
+    url: '/market/plan/addMarketPlanInfo',
+    method: 'post',
+    data: query
+  })
+}
+
+// 新增
+export function deleteMarketPlan(query) {
+  return request({
+    url: '/market/plan/deleteMarketPlan',
+    method: 'post',
+    data: query
+  })
+}
+

+ 2 - 2
src/utils/request.js

@@ -8,9 +8,9 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 // 创建axios实例
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
-  // baseURL: process.env.VUE_APP_BASE_API,
+  baseURL: process.env.VUE_APP_BASE_API,
   // baseURL:"http://test.huijy.net/prod-api",
-  baseURL:"http://demo.huijy.net/prod-api",
+  // baseURL:"http://demo.huijy.net/prod-api",
   // baseURL: '/prod-api',
   // baseURL: 'http://www.huiyj.com:9002/prod-api',
   // 超时

+ 1063 - 0
src/views/dev/Dev_Test copy 2.vue

@@ -0,0 +1,1063 @@
+<template>
+  <div v-if="pageStatus == 0">配置加载中...</div>
+  <div v-else-if="pageStatus == 1">此页面不对此账号开放</div>
+  <div v-else-if="pageStatus == 2">
+    没有此页内容的配置权限,请检查集团上的配置
+  </div>
+  <div v-else-if="pageStatus == 3">加载发生错误</div>
+  <div v-else-if="pageStatus == 4" class="app-container">
+  <div class="card mx-auto shadow" style="width: 310px;">
+  <div class="card-body">
+    <el-form
+      ref="ruleForm"
+      :model="ruleForm"
+      :rules="rules"
+      label-width="80px"
+    >
+      <el-form-item label="当前方案">
+        {{ currentDiscountName }}
+      </el-form-item>
+  
+      <el-form-item label="变改方案">
+        <el-select
+          v-model="ruleForm.discountSetting"
+          placeholder="请选择优惠方案"
+          clearable
+          size="small"
+          style="width:100px"
+          @change="discountSettingChang"
+        >
+          <el-option label="无" value="0"></el-option>
+          <el-option label="满减" value="1"></el-option>
+          <el-option label="立减" value="2"></el-option>
+          <el-option label="直降" value="3"></el-option>
+          <el-option label="阶梯直降" value="4"></el-option>
+        </el-select>
+        <button href="#" type="button" @click="save" class="btn btn-primary btn-sm ml-3 mb-1">变更</button>
+      </el-form-item>
+    </el-form>
+    
+  </div>
+</div>
+
+
+    <hr />
+    <el-dialog
+      :visible.sync="openDialog"
+      width="520px"
+      append-to-body
+      :title="
+        ['', '满减方案', '立减方案', '直降方案', '阶梯直降'][discountSetting]
+      "
+    >
+      <el-form
+        ref="updateForm"
+        :model="updateForm"
+        :rules="rules"
+        label-width="150px"
+      >
+        <el-form-item label="方案名称" prop="grade" class="input-group-sm">
+          <!-- <el-input v-model="updateForm.grade" placeholder="请输入方案名称" /> -->
+          <input
+            v-model="updateForm.grade"
+            placeholder="请输入方案名称"
+            class="form-control form-control-sm w-50"
+          />
+        </el-form-item>
+        <el-form-item label="油品名称" prop="oilName">
+          <select
+            v-model="updateForm.oilName"
+            class="form-control form-control-sm w-50"
+          >
+            <option
+              v-for="dict in filterOilNameOptions"
+              :key="dict.oilName"
+              :value="dict.oilName"
+            >
+              {{ dict.oilName }}
+            </option>
+          </select>
+        </el-form-item>
+
+        <!-- 阶梯直降没有此规则 -->
+        <el-form-item
+          label="优惠条件"
+          prop="gasoilDiscountAmt"
+          :rules="{
+            required: discountSetting != 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting != 4"
+        >
+          <el-radio-group
+            v-model="updateForm.discountTerm"
+            v-if="discountSetting == 3"
+          >
+            <el-radio :label="2">按加油金额</el-radio>
+            <el-radio :label="1">按加油升数</el-radio>
+          </el-radio-group>
+          <div
+            v-show="
+              updateForm.discountTerm == 2 ||
+              updateForm.discountTerm == 1 ||
+              discountSetting == 1 ||
+              discountSetting == 2
+            "
+          >
+            {{ ["", "每满", "满", "满"][discountSetting] }}
+            <!-- <el-input-number
+              v-model="updateForm.discountAmt"
+              size="mini"
+              :min="0"
+            /> -->
+            <input
+              v-model="updateForm.discountAmt"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
+            />
+
+            <span>{{
+              updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+            }}</span>
+            ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
+            <!-- <el-input-number
+              v-model="updateForm.gasoilDiscountAmt"
+              size="mini"
+              :min="0"
+            /> -->
+            <input
+              v-model="updateForm.gasoilDiscountAmt"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
+            />
+            元
+          </div>
+        </el-form-item>
+
+        <!-- 阶梯直降没有此规则 -->
+        <el-form-item
+          label="会员日"
+          prop="discountSettingFlag"
+          :rules="{
+            required: discountSetting != 4,
+            message: '请选择是否开启会员日',
+            trigger: 'change',
+          }"
+          v-if="discountSetting != 4"
+        >
+          <el-radio-group v-model="updateForm.discountSettingFlag">
+            <el-radio label="0">关闭</el-radio>
+            <el-radio label="1">开启</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <el-form-item
+          label="会员日周期类型"
+          prop="discountType"
+          v-show="updateForm.discountSettingFlag == 1"
+          :rules="{
+            required: updateForm.discountSettingFlag == 1,
+            message: '请选择会员日的周期类型',
+            trigger: 'change',
+          }"
+        >
+          <el-select
+            v-model="updateForm.discountType"
+            clearable
+            size="small"
+            @change="timeClear"
+          >
+            <el-option label="每周指定日" value="1"></el-option>
+            <el-option label="每月指定日" value="2"></el-option>
+            <el-option label="固定活动日" value="3"></el-option>
+          </el-select>
+          <div
+            v-show="updateForm.discountType != 3"
+            style="
+              display: flex;
+              flex-wrap: wrap;
+              border-style: solid;
+              border-color: #f5f7fa;
+            "
+          >
+            <div
+              v-for="(item, index) in timeSelect[updateForm.discountType]"
+              :key="index"
+              style="margin: 3px"
+            >
+              <div
+                class="hover-style"
+                style="
+                  border-radius: 5px;
+                  font-weight: bold;
+                  font-size: 12px;
+                  cursor: pointer;
+                "
+                @click="clickCalendar(index)"
+              >
+                <div>{{ item }}</div>
+                <div
+                  v-if="updateForm.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 v-show="updateForm.discountType == 3">
+            <el-date-picker
+              clearable
+              size="small"
+              style="margin-left: 10px; width: 200px"
+              v-model="updateForm.collectClickDay"
+              type="dates"
+              value-format="yyyy-MM-dd"
+              placeholder="选择提醒时间设置"
+            >
+            </el-date-picker>
+          </div>
+        </el-form-item>
+        <el-form-item
+          label="会员日优惠条件"
+          prop="discountActivityAmt"
+          v-show="updateForm.discountSettingFlag == 1"
+          :rules="{
+            required: updateForm.discountSettingFlag == 1,
+            message: '请填写会员日的优惠金额',
+            trigger: 'change',
+          }"
+        >
+          <div>
+            {{ ["", "每满", "满", "满"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.discountAmt"
+              size="mini"
+              :min="0"
+              disabled
+            />
+
+            <span>{{
+              updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+            }}</span>
+            ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.discountActivityAmt"
+              size="mini"
+              :min="0"
+            />元
+          </div>
+
+        </el-form-item>
+        <el-form-item label="叠加等级优惠" prop="vipDiscountyPlus">
+          <el-radio-group v-model="updateForm.vipDiscountyPlus">
+            <el-radio label="1">是</el-radio>
+            <el-radio label="0">否</el-radio>
+          </el-radio-group>
+          <div style="margin-left: 20px; color: red; font-size: 12px">
+            注:"否" 客户只享受 {{ discountName }} 优惠
+          </div>
+        </el-form-item>
+        <el-form-item label="可否叠加劵" prop="couponPlus">
+          <el-radio-group v-model="updateForm.couponPlus">
+            <el-radio label="1">是</el-radio>
+            <el-radio label="0">否</el-radio>
+          </el-radio-group>
+          <div style="margin-left: 20px; color: red; font-size: 12px">
+            注:"否" 客户只享受 {{ discountName }} 优惠
+          </div>
+        </el-form-item>
+
+        <!-- 只有阶梯直降有此规则 -->
+        <el-form-item
+          label="优惠条件"
+          prop="discountTerm"
+          :rules="{
+            required: discountSetting == 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting == 4"
+        >
+          <el-radio-group v-model="updateForm.discountTerm">
+            <el-radio :label="2">按加油金额</el-radio>
+            <el-radio :label="1">按加油升数</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <!-- 只有阶梯直降有此规则 -->
+        <el-form-item
+          label="阶梯设置"
+          prop="list"
+          :rules="{
+            required: discountSetting == 4,
+            message: '请设置优惠的阶梯定价',
+            trigger: 'change',
+          }"
+          v-if="discountSetting == 4"
+        >
+          <el-button
+            icon="el-icon-plus"
+            size="mini"
+            class="mb-3 mr-4"
+            @click="addLadder"
+            type="secondary"
+          >
+            添加规则
+          </el-button>
+        </el-form-item>
+
+        <div
+          class="mx-auto mb-4  bg-light pt-4 pb-2 px-1 rounded"
+          style="width: 450px"
+          v-if="discountSetting==4"
+        >
+          <div
+            class="input-group input-group-sm mb-4 mt-1"
+            v-for="(item, index) in updateForm.list"
+            :key="index"
+          >
+            <input
+              type="text"
+              class="form-control"
+              v-model="item.discountAmt"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text"> {{updateForm.discountTerm==1 ? '升&lt;= 加油升数 &lt;': "元&lt;= 加油金额 &lt;"}}  </span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              v-model="item.discountAmtEnd"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">{{updateForm.discountTerm==1 ? '升':'元'}},每升优惠</span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              v-model="item.gasoilDiscountAmt"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元</span>
+            </div>
+            <div class="input-group-append" id="button-addon4">
+              <button
+                class="btn btn-danger"
+                type="button"
+                @click="delLadder(index)"
+              >
+                删除
+              </button>
+            </div>
+          </div>
+        </div>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handleSubmit">确 定</el-button>
+        <el-button @click="cancelSubmit">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      :inline="true"
+      label-width="68px"
+      v-show="discountSetting != 0"
+      class="mx-auto"
+    >
+      <div>
+        <el-button
+          icon="el-icon-plus"
+          size="mini"
+          class="mb-3 mr-4"
+          @click="handleUpdateClick"
+          style="float: right"
+          type="warning"
+        >
+          {{
+            this.discountSetting == 1
+              ? "添加满减方案规则"
+              : this.discountSetting == 2
+              ? "添加立减方案规则"
+              : this.discountSetting == 3
+              ? "添加直降方案规则"
+              : this.discountSetting == 4
+              ? "添加阶梯直降规则"
+              : "无"
+          }}
+        </el-button>
+      </div>
+    </el-form>
+    <el-table
+      :data="discountList"
+      v-show="discountSetting != 0 && discountSetting != 4"
+      class="shadow"
+    >
+      <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-if="discountSetting == 3"
+      >
+        <template slot-scope="scope">
+          满 {{ scope.row.discountAmt }}
+          {{ scope.row.discountTerm == 2 ? "元" : "L" }},每升优惠
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="优惠条件"
+        align="center"
+        v-if="discountSetting == 1"
+      >
+        <template slot-scope="scope">
+          每满 {{ scope.row.discountAmt }} 元,减
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="优惠条件"
+        align="center"
+        v-if="discountSetting == 2"
+      >
+        <template slot-scope="scope">
+          满 {{ scope.row.discountAmt }} 元,减
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="会员日"
+        align="center"
+        v-if="discountSetting != 4"
+      >
+        <template slot-scope="scope">
+          <span v-if="scope.row.discountSettingFlag == 0"> 无活动 </span>
+          <span v-else-if="scope.row.discountSettingFlag == 1">
+            {{ discountSettingTranslate(scope.row) }}
+          </span>
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="叠加等级优惠"
+        align="center"
+        prop="vipDiscountyPlus"
+        :formatter="vipDiscountyPlusFotmat"
+      />
+      <af-table-column
+        label="叠加劵"
+        align="center"
+        prop="couponPlus"
+        :formatter="couponPlusFotmat"
+      />
+      <af-table-column
+        label="优惠方案类型"
+        v-if="false"
+        align="center"
+        prop="discountPlanType"
+      />
+      <af-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </af-table-column>
+    </el-table>
+    <el-table
+      :data="discountListTep"
+      v-show="discountSetting == 4"
+      type="expand"
+      class="shadow"
+    >
+      <af-table-column type="expand">
+        <template slot-scope="props"> 
+            <div
+              class="input-group input-group-sm mb-4 mt-1"
+              v-for="(item, index) in props.row.list"
+              :key="index"
+              style="width:600px;"
+            >
+              <div class="input-group-append">
+                <span class="input-group-text"> 规则 {{index + 1}}: </span>
+              </div>
+              <input
+                type="text"
+                class="form-control"
+                v-model="item.discountAmt"
+                disabled
+                
+              />
+              <div class="input-group-append">
+                <span class="input-group-text"> {{updateForm.discountTerm==1 ? '升&lt;= 加油升数 &lt;': "元&lt;= 加油金额 &lt;"}}  </span>
+              </div>
+              <input
+                type="text"
+                class="form-control"
+                v-model="item.discountAmtEnd"
+                disabled
+              />
+              <div class="input-group-append">
+                <span class="input-group-text">{{updateForm.discountTerm==1 ? '升,':'元,'}}</span>
+              </div>
+              <div class="input-group-append">
+                <span class="input-group-text">每升优惠</span>
+              </div>
+              <input
+                type="text"
+                class="form-control"
+                v-model="item.gasoilDiscountAmt"
+                disabled
+              />
+              <div class="input-group-append">
+                <span class="input-group-text">元</span>
+              </div>
+              <div class="input-group-append" id="button-addon4">
+              </div>
+            </div>
+        </template>
+      </af-table-column>
+      <af-table-column label="方案名称" align="center" prop="grade" />
+      <af-table-column label="油品名称" align="center" prop="oilName" />
+      <af-table-column
+        label="叠加等级优惠"
+        align="center"
+        prop="vipDiscountyPlus"
+        :formatter="vipDiscountyPlusFotmat"
+      />
+      <af-table-column
+        label="叠加劵"
+        align="center"
+        prop="couponPlus"
+        :formatter="couponPlusFotmat"
+      />
+      <af-table-column
+        label="优惠方案类型"
+        v-if="false"
+        align="center"
+        prop="discountPlanType"
+      />
+      <af-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+        width="200px"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleDelete(scope.row)"
+            >修改规则</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </af-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import {
+  listPlan,
+  getPlan,
+  delPlan,
+  addPlan,
+  updatePlan,
+  exportPlan,
+  addMarketPlanInfo
+} from "@/api/market/plan";
+import { getStationPay, updatePay } from "@/api/station/pay";
+import { getDept } from "@/api/system/dept";
+import { listPrice } from "@/api/station/price";
+export default {
+  name: "Market_Discount",
+  data() {
+    const validatorGasoilDiscountAmt = (rule, value, callback) => {
+      if (this.discountSetting == 3) {
+        if (
+          this.updateForm.discountTerm === undefined ||
+          this.updateForm.discountTerm === ""
+        ) {
+          callback(new Error("请选择优惠方式"));
+          return;
+        }
+      }
+      const start = +this.updateForm.discountAmt;
+      const end = +this.updateForm.gasoilDiscountAmt;
+      if (isNaN(start) || isNaN(end)) {
+        callback(new Error("检查优惠方式完整性"));
+        return;
+      }
+      callback();
+    };
+
+    return {
+      testd: 1,
+      pageStatus: 0,
+      discountList: [],
+      total: 0,
+      oilNameOptions: [],
+      title: "",
+      openDialog: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        grade: null,
+        discountWay: null,
+        gasoilDiscountLitre: null,
+        dieseloilDiscountLitre: null,
+        gradeType: null,
+        gasoilConsume: null,
+        gasoilGrowthValue: null,
+        dieseloilConsume: null,
+        dieseloilGrowthValue: null,
+        growthValue: null,
+        date: null,
+        deductionGrowthValue: null,
+      },
+      updateFormDynamic1: ["", "满", "每满", "满"],
+      updateFormDynamic2: ["", "减", "减", "每升优惠"],
+      ruleForm: {},
+      // 表单校验
+      rules: {
+        grade: [{ required: true, message: "请输入方案名称", trigger: "blur" }],
+        oilName: [
+          { required: true, message: "请选择油品名称", trigger: "change" },
+        ],
+        discountTerm: [
+          { required: true, message: "选择油品名称", trigger: "change" },
+        ],
+        gasoilDiscountAmt: [
+          { validator: validatorGasoilDiscountAmt, trigger: "change" },
+        ],
+        discountAmt: [
+          { required: true, message: "请填写优惠金额", trigger: "blur" },
+        ],
+        vipDiscountyPlus: [
+          {
+            required: true,
+            message: "选择等级优惠是否叠加",
+            trigger: "change",
+          },
+        ],
+        couponPlus: [
+          { required: true, message: "选择可否叠加券", trigger: "change" },
+        ],
+      },
+      dtrules: {},
+      discountSetting: 0,
+      updateForm: {
+        collectClickCalendar: [],
+        collectClickDay: "",
+      },
+      currentDiscountName: "",
+      timeSelect: [
+        ,
+        ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
+        [
+          "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",
+        ],
+      ],
+      discountListTep: [
+        {
+          list: [],
+        },
+        {},
+      ],
+    };
+  },
+  computed: {
+    discountName() {
+      return this.discountSetting == 1
+        ? "满减"
+        : this.discountSetting == 2
+        ? "立减"
+        : this.discountSetting == 3
+        ? "直降"
+        : this.discountSetting == 4
+        ? "阶梯直降"
+        : "无";
+    },
+    filterOilNameOptions() {
+      return this.oilNameOptions.filter((ele) => {
+        let flag = true;
+        this.discountList.forEach((item) => {
+          if (ele.oilName == item.oilName) {
+            flag = false;
+          }
+        });
+        return flag;
+      });
+    },
+  },
+  created() {
+    this.setPageStatus();
+    this.init();
+  },
+  methods: {
+    delLadder(index) {
+      this.updateForm.list.splice(index, 1);
+      if (this.updateForm.list < 1) {
+        this.updateForm.list.push({
+          discountAmtEnd: null,
+          discountAmt: null,
+          gasoilDiscountAmt: null,
+        });
+        this.updateForm = { ...this.updateForm };
+      }
+    },
+    addLadder(e) {
+      this.updateForm.list.push({
+        discountAmtEnd: null,
+        discountAmt: null,
+        gasoilDiscountAmt: null,
+      });
+      this.updateForm = { ...this.updateForm };
+    },
+    test(e) {
+      console.log("---");
+      console.log(e);
+      console.log(123);
+      console.log(this.testd);
+    },
+    init() {
+      listPrice().then((response) => {
+        this.oilNameOptions = response.rows;
+      });
+      this.getPay().then(() => {
+        this.getList();
+      });
+    },
+    setPageStatus() {
+      this.queryPageStatus([2]).then((res) => {
+        this.pageStatus = res;
+      });
+    },
+    timeClear() {
+      this.updateForm.collectClickCalendar = [];
+      this.updateForm.collectClickDay = [];
+    },
+    getPay() {
+      return getStationPay().then((response) => {
+        this.ruleForm = response.data;
+        this.discountSetting = response.data.discountSetting;
+        this.currentDiscountName = this.discountName;
+      });
+    },
+    save() {
+      this.$refs["ruleForm"].validate((valid) => {
+        if (valid) {
+          if (this.ruleForm.deptId != null) {
+            let upPromise = null;
+            let e = this.ruleForm.discountSetting;
+            if (e == "0") {
+              upPromise = updatePay(this.ruleForm).then((response) => {
+                this.msgSuccess("优惠方案设置成功");
+              });
+            } else if (e == "1") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("满减规则下无方案");
+                return;
+              }
+            } else if (e == "2") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("立减规则下无方案");
+                return;
+              }
+            } else if (e == "3") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("直降规则下无方案");
+                return;
+              }
+            } else if (e == "4") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("直降规则下无方案");
+                return;
+              }
+            }
+            upPromise
+              .catch((err) => {
+                this.msgError("设置时出错,请刷新后重试~");
+              })
+              .then((res) => {
+                this.getPay();
+              });
+          } else {
+            this.getPay();
+          }
+        }
+      });
+    },
+    discountSettingChang(e) {
+      console.log(e);
+      this.discountSetting = e;
+      this.getList();
+    },
+    getList() {
+      const query = {
+        pageNum: 1,
+        pageSize: 100,
+        discountPlanType: this.discountSetting,
+      };
+      listPlan(query).then((response) => {
+        if(this.discountSetting == 4){
+          this.discountListTep = response.rows;
+          return;
+        }
+        this.discountList = response.rows;
+        this.total = response.total;
+      });
+    },
+    vipDiscountyPlusFotmat(row, column) {
+      if (row.vipDiscountyPlus === "1") {
+        return "是";
+      } else if (row.vipDiscountyPlus === "0") {
+        return "否";
+      }
+    },
+    couponPlusFotmat(row, column) {
+      if (row.couponPlus === "1") {
+        return "是";
+      } else if (row.couponPlus === "0") {
+        return "否";
+      }
+    },
+    handleUpdateClick() {
+      this.openDialog = true;
+      this.updateForm = {
+        discountPlanType: this.discountSetting,
+      };
+      if (this.discountSetting == 4) {
+        this.updateForm.list = [
+          {
+            discountAmtEnd: null,
+            discountAmt: null,
+            gasoilDiscountAmt: null,
+          },
+        ];
+      }
+    },
+    handleSubmit() {
+      this.$refs["updateForm"].validate((valid) => {
+        if (valid) {
+          // 会员日特殊处理
+          if (this.updateForm.discountSettingFlag == "1" && this.discountSetting != "4") {
+            if (
+              this.updateForm.discountType == "1" ||
+              this.updateForm.discountType == "2"
+            ) {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickCalendar.toString();
+            } else {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickDay.toString();
+            }
+          }
+          // 阶梯直降
+          if(this.discountSetting == "4"){
+            addMarketPlanInfo(this.updateForm).then((res) => {
+              console.log("哈哈112",res);
+            }).then((res) => {
+              this.msgSuccess("新增成功");
+              this.openDialog = false;
+              this.getList();
+            })
+          }
+          if (this.updateForm.id != null) {
+            updatePlan(this.updateForm).then((response) => {
+              this.msgSuccess("修改成功");
+              this.openDialog = false;
+              this.getList();
+            });
+          } else {
+            addPlan(this.updateForm).then((response) => {
+              this.msgSuccess("新增成功");
+              this.openDialog = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    clickCalendar(index) {
+      if (this.updateForm.collectClickCalendar.indexOf(index) === -1) {
+        this.updateForm.collectClickCalendar.push(index);
+      } else if (this.updateForm.collectClickCalendar.indexOf(index) > -1) {
+        const temp = this.updateForm.collectClickCalendar.findIndex((ele) => {
+          return ele == index;
+        });
+        this.updateForm.collectClickCalendar.splice(temp, 1);
+      }
+      this.$refs.updateForm.validateField("discountType");
+      this.updateForm = { ...this.updateForm };
+    },
+    cancelSubmit() {
+      this.openDialog = false;
+    },
+
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      const id = row.id;
+      this.title = "修改满减优惠";
+      this.openDialog = true;
+      this.updateForm = row;
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id;
+      this.$confirm("是否确认删除满减优惠方案?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          return delPlan(ids);
+        })
+        .then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        });
+    },
+    // /** 导出按钮操作 */
+    // handleExport() {
+    //   const queryParams = this.queryParams;
+    //   this.$confirm("是否确认导出所有优惠设置数据项?", "警告", {
+    //     confirmButtonText: "确定",
+    //     cancelButtonText: "取消",
+    //     type: "warning",
+    //   })
+    //     .then(function () {
+    //       return exportPlan(queryParams);
+    //     })
+    //     .then((response) => {
+    //       this.download(response.msg);
+    //     });
+    // },
+    discountSettingTranslate(row) {
+      if (row.discountSettingFlag == 0) {
+        return "未设置";
+      }
+      // if (this.discountList.integralActivity == 0) {
+      //   return "";
+      // }
+
+      let timeString = "";
+      const discountType = row.discountType;
+
+      if (discountType == 1) {
+        timeString += "每周的";
+      }
+      if (discountType == 2) {
+        timeString += "每月的";
+      }
+      if (discountType == 3) {
+        timeString += "指定的日期 ";
+      }
+      if (discountType == 1 || discountType == 2) {
+        (row.discountDate || "")
+          .split(",")
+          .filter((ele) => {
+            return ele !== "";
+          })
+          .forEach((ele) => {
+            timeString += this.timeSelect[discountType][ele] + "、";
+          });
+      } else if (discountType == 3) {
+        timeString += row.discountDate.toString();
+      }
+
+      timeString = timeString.replace(/(、)$/g, "") + " 优惠:";
+      if (this.discountSetting == 3) {
+        timeString +=
+          "满" +
+          row.discountAmt +
+          (row.discountTerm == 2 ? "元" : "L") +
+          ",每升优惠" +
+          row.discountActivityAmt +
+          "元";
+      } else if (this.discountSetting == 1) {
+        timeString +=
+          "每满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
+      } else if (this.discountSetting == 2) {
+        timeString +=
+          "满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
+      }
+      return timeString;
+    },
+  },
+};
+</script>
+<style>
+</style>

+ 912 - 0
src/views/dev/Dev_Test copy.vue

@@ -0,0 +1,912 @@
+<template>
+  <div v-if="pageStatus == 0">配置加载中...</div>
+  <div v-else-if="pageStatus == 1">此页面不对此账号开放</div>
+  <div v-else-if="pageStatus == 2">
+    没有此页内容的配置权限,请检查集团上的配置
+  </div>
+  <div v-else-if="pageStatus == 3">加载发生错误</div>
+  <div v-else-if="pageStatus == 4" class="app-container">
+    <el-form
+      ref="ruleForm"
+      :model="ruleForm"
+      :rules="rules"
+      label-width="130px"
+    >
+      <el-form-item label="当前执行优惠方案">
+        {{ currentDiscountName }}
+      </el-form-item>
+      <el-form-item label="优惠方案">
+        <el-select
+          v-model="ruleForm.discountSetting"
+          placeholder="请选择优惠方案"
+          clearable
+          size="small"
+          @change="discountSettingChang"
+        >
+          <el-option label="无" value="0"></el-option>
+          <el-option label="满减" value="1"></el-option>
+          <el-option label="立减" value="2"></el-option>
+          <el-option label="直降" value="3"></el-option>
+          <el-option label="阶梯直降" value="4"></el-option>
+        </el-select>
+        <el-button size="mini" @click="save" type="primary"
+          >确定执行该优惠方案</el-button
+        >
+      </el-form-item>
+    </el-form>
+
+    <hr />
+    <el-dialog
+      :visible.sync="openDialog"
+      width="520px"
+      append-to-body
+      :title="
+        ['', '满减方案', '立减方案', '直降方案', '阶梯直降'][discountSetting]
+      "
+    >
+      <el-form
+        ref="updateForm"
+        :model="updateForm"
+        :rules="rules"
+        label-width="120px"
+      >
+        <el-form-item label="方案名称" prop="grade" class="input-group-sm">
+          <!-- <el-input v-model="updateForm.grade" placeholder="请输入方案名称" /> -->
+          <input v-model="updateForm.grade" placeholder="请输入方案名称" class="form-control form-control-sm w-50"/>
+        </el-form-item>
+        <el-form-item label="油品名称" prop="oilName">
+          <el-select
+            v-model="updateForm.oilName"
+            placeholder="油品名称"
+            clearable
+            size="small"
+            class=" w-50"
+          >
+            <el-option
+              v-for="dict in filterOilNameOptions"
+              :key="dict.oilName"
+              :label="dict.oilName"
+              :value="dict.oilName"
+            />
+          </el-select>
+        </el-form-item>
+
+        <!-- 阶梯直降没有此条目 -->
+        <el-form-item
+          label="优惠条件"
+          prop="gasoilDiscountAmt"
+          :rules="{
+            required: discountSetting != 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting != 4"
+        >
+          <el-radio-group
+            v-model="updateForm.discountTerm"
+            v-if="discountSetting == 3"
+          >
+            <el-radio :label="2">按加油金额</el-radio>
+            <el-radio :label="1">按加油升数</el-radio>
+          </el-radio-group>
+          <div
+            v-show="
+              updateForm.discountTerm == 2 ||
+              updateForm.discountTerm == 1 ||
+              discountSetting == 1 ||
+              discountSetting == 2
+            "
+          >
+            {{ ["", "每满", "满", "满"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.discountAmt"
+              size="mini"
+              :min="0"
+            />
+
+            <span>{{
+              updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+            }}</span>
+            ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.gasoilDiscountAmt"
+              size="mini"
+              :min="0"
+            />元
+          </div>
+        </el-form-item>
+
+        <!-- 阶梯直降没有此条目 -->
+        <el-form-item
+          label="会员日"
+          prop="discountSettingFlag"
+          :rules="{
+            required: discountSetting != 4,
+            message: '请选择是否开启会员日',
+            trigger: 'change',
+          }"
+          v-if="discountSetting != 4"
+        >
+          <el-radio-group v-model="updateForm.discountSettingFlag">
+            <el-radio label="0">关闭</el-radio>
+            <el-radio label="1">开启</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <el-form-item
+          label="会员日周期类型"
+          prop="discountType"
+          v-show="updateForm.discountSettingFlag == 1"
+          :rules="{
+            required: updateForm.discountSettingFlag == 1,
+            message: '请选择会员日的周期类型',
+            trigger: 'change',
+          }"
+        >
+          <el-select
+            v-model="updateForm.discountType"
+            clearable
+            size="small"
+            @change="timeClear"
+          >
+            <el-option label="每周指定日" value="1"></el-option>
+            <el-option label="每月指定日" value="2"></el-option>
+            <el-option label="固定活动日" value="3"></el-option>
+          </el-select>
+          <div
+            v-show="updateForm.discountType != 3"
+            style="
+              display: flex;
+              flex-wrap: wrap;
+              border-style: solid;
+              border-color: #f5f7fa;
+            "
+          >
+            <div
+              v-for="(item, index) in timeSelect[updateForm.discountType]"
+              :key="index"
+              style="margin: 3px"
+            >
+              <div
+                class="hover-style"
+                style="
+                  border-radius: 5px;
+                  font-weight: bold;
+                  font-size: 12px;
+                  cursor: pointer;
+                "
+                @click="clickCalendar(index)"
+              >
+                <div>{{ item }}</div>
+                <div
+                  v-if="updateForm.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 v-show="updateForm.discountType == 3">
+            <el-date-picker
+              clearable
+              size="small"
+              style="margin-left: 10px; width: 200px"
+              v-model="updateForm.collectClickDay"
+              type="dates"
+              value-format="yyyy-MM-dd"
+              placeholder="选择提醒时间设置"
+            >
+            </el-date-picker>
+          </div>
+        </el-form-item>
+        <el-form-item
+          label="会员日优惠条件"
+          prop="discountActivityAmt"
+          v-show="updateForm.discountSettingFlag == 1"
+          :rules="{
+            required: updateForm.discountSettingFlag == 1,
+            message: '请填写会员日的优惠金额',
+            trigger: 'change',
+          }"
+        >
+          <div>
+            {{ ["", "每满", "满", "满"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.discountAmt"
+              size="mini"
+              :min="0"
+              disabled
+            />
+
+            <span>{{
+              updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+            }}</span>
+            ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.discountActivityAmt"
+              size="mini"
+              :min="0"
+            />元
+          </div>
+          <!-- <el-input-number
+            v-model="updateForm.integralProportion"
+            :min="1"
+            placeholder="请输入加倍比例"
+            size="small"
+          />
+          <span>倍</span> -->
+          <!-- 满
+          <el-input-number
+            v-model="updateForm.discountAmt"
+            size="mini"
+            :min="0"
+            disabled
+          /><span>{{
+            updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+          }}</span
+          >,每升优惠<el-input-number
+            v-model="updateForm.discountActivityAmt"
+            size="mini"
+            :min="0"
+          />元 -->
+        </el-form-item>
+        <el-form-item label="叠加等级优惠" prop="vipDiscountyPlus">
+          <el-radio-group v-model="updateForm.vipDiscountyPlus">
+            <el-radio label="1">是</el-radio>
+            <el-radio label="0">否</el-radio>
+          </el-radio-group>
+          <div style="margin-left: 20px; color: red; font-size:12px">
+            注:"否" 客户只享受 {{ discountName }} 优惠
+          </div>
+        </el-form-item>
+        <el-form-item label="可否叠加劵" prop="couponPlus">
+          <el-radio-group v-model="updateForm.couponPlus">
+            <el-radio label="1">是</el-radio>
+            <el-radio label="0">否</el-radio>
+          </el-radio-group>
+          <div style="margin-left: 20px; color: red;font-size:12px">
+            注:"否" 客户只享受 {{ discountName }} 优惠
+          </div>
+        </el-form-item>
+        
+        <!-- 只有阶梯直降有此条目 -->
+        <el-form-item
+          label="优惠条件"
+          prop="discountTerm"
+          :rules="{
+            required: discountSetting == 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting == 4"
+        >
+          <el-radio-group v-model="updateForm.discountTerm">
+            <el-radio :label="2">按加油金额</el-radio>
+            <el-radio :label="1">按加油升数</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <!-- 只有阶梯直降有此条目 -->
+        <el-form-item
+          label="阶梯设置"
+          prop="discountType"
+          :rules="{
+            required: discountSetting == 4,
+            message: '请选择会员日的周期类型',
+            trigger: 'change',
+          }"
+          v-if="discountSetting == 4"
+        >
+        <el-button
+          icon="el-icon-plus"
+          size="mini"
+          class="mb-3 mr-4"
+          @click="handleUpdateClick"
+          type="secondary"
+        >
+          添加条目
+        </el-button>
+        </el-form-item>
+
+        <div class="mx-auto mb-4 shadow-lg bg-white pt-4 pb-2 px-1 rounded" style="width: 450px;">
+          <div class="input-group input-group-sm mb-4 mt-1">
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text"> &lt;= 加油金额 &lt;= </span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元,每升优惠</span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元</span>
+            </div>
+            <div class="input-group-append" id="button-addon4">
+              <button class="btn btn-danger" type="button">删除</button>
+            </div>
+          </div>
+          <div class="input-group input-group-sm mb-4 mt-1">
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text"> &lt;= 加油金额 &lt;= </span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元,每升优惠</span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元</span>
+            </div>
+            <div class="input-group-append" id="button-addon4">
+              <button class="btn btn-danger" type="button">删除</button>
+            </div>
+          </div>
+        </div>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handleSubmit">确 定</el-button>
+        <el-button @click="cancelSubmit">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      :inline="true"
+      label-width="68px"
+      v-show="discountSetting != 0"
+    >
+      <div>
+        <el-button
+          icon="el-icon-plus"
+          size="small"
+          class="mb-3 mr-4"
+          @click="handleUpdateClick"
+          style="float: right"
+          type="warning"
+        >
+          {{
+            this.discountSetting == 1
+              ? "添加满减方案条目"
+              : this.discountSetting == 2
+              ? "添加立减方案条目"
+              : this.discountSetting == 3
+              ? "添加直降方案条目"
+              : this.discountSetting == 4
+              ? "添加阶梯直降条目"
+              : "无"
+          }}
+        </el-button>
+      </div>
+    </el-form>
+    <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-if="discountSetting == 3"
+      >
+        <template slot-scope="scope">
+          满 {{ scope.row.discountAmt }}
+          {{ scope.row.discountTerm == 2 ? "元" : "L" }},每升优惠
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="优惠条件"
+        align="center"
+        v-if="discountSetting == 1"
+      >
+        <template slot-scope="scope">
+          每满 {{ scope.row.discountAmt }} 元,减
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="优惠条件"
+        align="center"
+        v-if="discountSetting == 2"
+      >
+        <template slot-scope="scope">
+          满 {{ scope.row.discountAmt }} 元,减
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column label="会员日" align="center">
+        <template slot-scope="scope">
+          <span v-if="scope.row.discountSettingFlag == 0"> 无活动 </span>
+          <span v-else-if="scope.row.discountSettingFlag == 1">
+            {{ discountSettingTranslate(scope.row) }}
+          </span>
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="叠加等级优惠"
+        align="center"
+        prop="vipDiscountyPlus"
+        :formatter="vipDiscountyPlusFotmat"
+      />
+      <af-table-column
+        label="叠加劵"
+        align="center"
+        prop="couponPlus"
+        :formatter="couponPlusFotmat"
+      />
+      <af-table-column
+        label="优惠方案类型"
+        v-if="false"
+        align="center"
+        prop="discountPlanType"
+      />
+      <af-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)"
+            >修改</el-button
+          > -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </af-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import {
+  listPlan,
+  getPlan,
+  delPlan,
+  addPlan,
+  updatePlan,
+  exportPlan,
+} from "@/api/market/plan";
+import { getStationPay, updatePay } from "@/api/station/pay";
+import { getDept } from "@/api/system/dept";
+import { listPrice } from "@/api/station/price";
+export default {
+  name: "Market_Discount",
+  data() {
+    const validatorGasoilDiscountAmt = (rule, value, callback) => {
+      if (this.discountSetting == 3) {
+        if (
+          this.updateForm.discountTerm === undefined ||
+          this.updateForm.discountTerm === ""
+        ) {
+          callback(new Error("请选择优惠方式"));
+          return;
+        }
+      }
+      const start = +this.updateForm.discountAmt;
+      const end = +this.updateForm.gasoilDiscountAmt;
+      if (isNaN(start) || isNaN(end)) {
+        callback(new Error("检查优惠方式完整性"));
+        return;
+      }
+      callback();
+    };
+
+    return {
+      pageStatus: 0,
+      discountList: [],
+      total: 0,
+      oilNameOptions: [],
+      title: "",
+      openDialog: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        grade: null,
+        discountWay: null,
+        gasoilDiscountLitre: null,
+        dieseloilDiscountLitre: null,
+        gradeType: null,
+        gasoilConsume: null,
+        gasoilGrowthValue: null,
+        dieseloilConsume: null,
+        dieseloilGrowthValue: null,
+        growthValue: null,
+        date: null,
+        deductionGrowthValue: null,
+      },
+      updateFormDynamic1: ["", "满", "每满", "满"],
+      updateFormDynamic2: ["", "减", "减", "每升优惠"],
+      ruleForm: {},
+      // 表单校验
+      rules: {
+        grade: [{ required: true, message: "请输入方案名称", trigger: "blur" }],
+        oilName: [
+          { required: true, message: "请选择油品名称", trigger: "change" },
+        ],
+        discountTerm: [
+          { required: true, message: "选择油品名称", trigger: "change" },
+        ],
+        gasoilDiscountAmt: [
+          { validator: validatorGasoilDiscountAmt, trigger: "change" },
+        ],
+        discountAmt: [
+          { required: true, message: "请填写优惠金额", trigger: "blur" },
+        ],
+        vipDiscountyPlus: [
+          {
+            required: true,
+            message: "选择等级优惠是否叠加",
+            trigger: "change",
+          },
+        ],
+        couponPlus: [
+          { required: true, message: "选择可否叠加券", trigger: "change" },
+        ],
+      },
+      dtrules: {},
+      discountSetting: 0,
+      updateForm: {
+        collectClickCalendar: [],
+        collectClickDay: "",
+      },
+      currentDiscountName: "",
+      timeSelect: [
+        ,
+        ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
+        [
+          "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",
+        ],
+      ],
+    };
+  },
+  computed: {
+    discountName() {
+      return this.discountSetting == 1
+        ? "满减"
+        : this.discountSetting == 2
+        ? "立减"
+        : this.discountSetting == 3
+        ? "直降"
+        : "无";
+    },
+    filterOilNameOptions() {
+      return this.oilNameOptions.filter((ele) => {
+        let flag = true;
+        this.discountList.forEach((item) => {
+          if (ele.oilName == item.oilName) {
+            flag = false;
+          }
+        });
+        return flag;
+      });
+    },
+  },
+  created() {
+    this.setPageStatus();
+    this.init();
+  },
+  methods: {
+    init() {
+      listPrice().then((response) => {
+        this.oilNameOptions = response.rows;
+      });
+      this.getPay().then(() => {
+        this.getList();
+      });
+    },
+    setPageStatus() {
+      this.queryPageStatus([2]).then((res) => {
+        this.pageStatus = res;
+      });
+    },
+    timeClear() {
+      this.updateForm.collectClickCalendar = [];
+      this.updateForm.collectClickDay = [];
+    },
+    getPay() {
+      return getStationPay().then((response) => {
+        this.ruleForm = response.data;
+        this.discountSetting = response.data.discountSetting;
+        this.currentDiscountName = this.discountName;
+      });
+    },
+    save() {
+      this.$refs["ruleForm"].validate((valid) => {
+        if (valid) {
+          if (this.ruleForm.deptId != null) {
+            let upPromise = null;
+            let e = this.ruleForm.discountSetting;
+            if (e == "0") {
+              upPromise = updatePay(this.ruleForm).then((response) => {
+                this.msgSuccess("优惠方案设置成功");
+              });
+            } else if (e == "1") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("满减规则下无方案");
+                return;
+              }
+            } else if (e == "2") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("立减规则下无方案");
+                return;
+              }
+            } else if (e == "3") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("直降规则下无方案");
+                return;
+              }
+            }
+            upPromise
+              .catch((err) => {
+                this.msgError("设置时出错,请刷新后重试~");
+              })
+              .then((res) => {
+                this.getPay();
+              });
+          } else {
+            this.getPay();
+          }
+        }
+      });
+    },
+    discountSettingChang(e) {
+      console.log(e);
+      this.discountSetting = e;
+      this.getList();
+    },
+    getList() {
+      const query = {
+        pageNum: 1,
+        pageSize: 100,
+        discountPlanType: this.discountSetting,
+      };
+      listPlan(query).then((response) => {
+        this.discountList = response.rows;
+        this.total = response.total;
+      });
+    },
+    vipDiscountyPlusFotmat(row, column) {
+      if (row.vipDiscountyPlus === "1") {
+        return "是";
+      } else if (row.vipDiscountyPlus === "0") {
+        return "否";
+      }
+    },
+    couponPlusFotmat(row, column) {
+      if (row.couponPlus === "1") {
+        return "是";
+      } else if (row.couponPlus === "0") {
+        return "否";
+      }
+    },
+    handleUpdateClick() {
+      this.openDialog = true;
+      this.updateForm = {
+        discountPlanType: this.discountSetting,
+      };
+    },
+    handleSubmit() {
+      this.$refs["updateForm"].validate((valid) => {
+        if (valid) {
+          if (this.updateForm.discountSettingFlag == "1") {
+            if (
+              this.updateForm.discountType == "1" ||
+              this.updateForm.discountType == "2"
+            ) {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickCalendar.toString();
+            } else {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickDay.toString();
+            }
+          }
+          if (this.updateForm.id != null) {
+            updatePlan(this.updateForm).then((response) => {
+              this.msgSuccess("修改成功");
+              this.openDialog = false;
+              this.getList();
+            });
+          } else {
+            addPlan(this.updateForm).then((response) => {
+              this.msgSuccess("新增成功");
+              this.openDialog = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    clickCalendar(index) {
+      if (this.updateForm.collectClickCalendar.indexOf(index) === -1) {
+        this.updateForm.collectClickCalendar.push(index);
+      } else if (this.updateForm.collectClickCalendar.indexOf(index) > -1) {
+        const temp = this.updateForm.collectClickCalendar.findIndex((ele) => {
+          return ele == index;
+        });
+        this.updateForm.collectClickCalendar.splice(temp, 1);
+      }
+      this.$refs.updateForm.validateField("discountType");
+      this.updateForm = { ...this.updateForm };
+    },
+    cancelSubmit() {
+      this.openDialog = false;
+    },
+
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      const id = row.id;
+      this.title = "修改满减优惠";
+      this.openDialog = true;
+      this.updateForm = row;
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id;
+      this.$confirm("是否确认删除满减优惠方案?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          return delPlan(ids);
+        })
+        .then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        });
+    },
+    // /** 导出按钮操作 */
+    // handleExport() {
+    //   const queryParams = this.queryParams;
+    //   this.$confirm("是否确认导出所有优惠设置数据项?", "警告", {
+    //     confirmButtonText: "确定",
+    //     cancelButtonText: "取消",
+    //     type: "warning",
+    //   })
+    //     .then(function () {
+    //       return exportPlan(queryParams);
+    //     })
+    //     .then((response) => {
+    //       this.download(response.msg);
+    //     });
+    // },
+    discountSettingTranslate(row) {
+      if (row.discountSettingFlag == 0) {
+        return "未设置";
+      }
+      // if (this.discountList.integralActivity == 0) {
+      //   return "";
+      // }
+
+      let timeString = "";
+      const discountType = row.discountType;
+
+      if (discountType == 1) {
+        timeString += "每周的";
+      }
+      if (discountType == 2) {
+        timeString += "每月的";
+      }
+      if (discountType == 3) {
+        timeString += "指定的日期 ";
+      }
+      if (discountType == 1 || discountType == 2) {
+        (row.discountDate || "")
+          .split(",")
+          .filter((ele) => {
+            return ele !== "";
+          })
+          .forEach((ele) => {
+            timeString += this.timeSelect[discountType][ele] + "、";
+          });
+      } else if (discountType == 3) {
+        timeString += row.discountDate.toString();
+      }
+
+      timeString = timeString.replace(/(、)$/g, "") + " 优惠:";
+      if (this.discountSetting == 3) {
+        timeString +=
+          "满" +
+          row.discountAmt +
+          (row.discountTerm == 2 ? "元" : "L") +
+          ",每升优惠" +
+          row.discountActivityAmt +
+          "元";
+      } else if (this.discountSetting == 1) {
+        timeString +=
+          "每满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
+      } else if (this.discountSetting == 2) {
+        timeString +=
+          "满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
+      }
+      return timeString;
+    },
+  },
+};
+</script>
+<style>
+</style>

+ 1120 - 217
src/views/dev/Dev_Test.vue

@@ -1,268 +1,1171 @@
 <template>
-<div>
-  hah
-</div>
+  <div v-if="pageStatus == 0">配置加载中...</div>
+  <div v-else-if="pageStatus == 1">此页面不对此账号开放</div>
+  <div v-else-if="pageStatus == 2">
+    没有此页内容的配置权限,请检查集团上的配置
+  </div>
+  <div v-else-if="pageStatus == 3">加载发生错误</div>
+  <div v-else-if="pageStatus == 4" class="app-container">
+    <div class="card mx-auto shadow" style="width: 310px">
+      <div class="card-body">
+        <el-form
+          ref="ruleForm"
+          :model="ruleForm"
+          :rules="rules"
+          label-width="80px"
+        >
+          <el-form-item label="当前方案">
+            {{ currentDiscountName }}
+          </el-form-item>
+
+          <el-form-item label="变改方案">
+            <el-select
+              v-model="ruleForm.discountSetting"
+              placeholder="请选择优惠方案"
+              clearable
+              size="small"
+              style="width: 100px"
+              @change="discountSettingChang"
+            >
+              <el-option label="无" value="0"></el-option>
+              <el-option label="满减" value="1"></el-option>
+              <el-option label="立减" value="2"></el-option>
+              <el-option label="直降" value="3"></el-option>
+              <el-option label="阶梯直降" value="4"></el-option>
+            </el-select>
+            <button
+              href="#"
+              type="button"
+              @click="save"
+              class="btn btn-primary btn-sm ml-3 mb-1"
+            >
+              执行
+            </button>
+          </el-form-item>
+        </el-form>
+      </div>
+    </div>
+
+    <hr />
+    <el-dialog
+      :visible.sync="openDialog"
+      width="520px"
+      append-to-body
+      :title="
+        ['', '满减方案', '立减方案', '直降方案', '阶梯直降'][discountSetting]
+      "
+    >
+      <el-form
+        ref="updateForm"
+        :model="updateForm"
+        :rules="rules"
+        label-width="170px"
+      >
+        <el-form-item label="方案名称" prop="grade" class="input-group-sm">
+          <input
+            v-model="updateForm.grade"
+            placeholder=""
+            class="form-control form-control-sm w-50"
+          />
+        </el-form-item>
+        <el-form-item label="油品名称" prop="oilName">
+          <select
+            v-model="updateForm.oilName"
+            class="form-control form-control-sm w-50"
+            :disabled="ladderUp"
+          >
+            <option
+              v-for="dict in filterOilNameOptions"
+              :key="dict.oilName"
+              :value="dict.oilName"
+            >
+              {{ dict.oilName }}
+            </option>
+          </select>
+        </el-form-item>
+
+        <!-- 阶梯直降没有此规则 -->
+        <el-form-item
+          label="优惠条件"
+          prop="gasoilDiscountAmt"
+          :rules="{
+            required: discountSetting != 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting != 4"
+        >
+          <el-radio-group
+            v-model="updateForm.discountTerm"
+            v-if="discountSetting == 3"
+          >
+            <el-radio label="2">按加油金额</el-radio>
+            <el-radio label="1">按加油升数</el-radio>
+          </el-radio-group>
+          <div
+            v-show="
+              updateForm.discountTerm == 2 ||
+              updateForm.discountTerm == 1 ||
+              discountSetting == 1 ||
+              discountSetting == 2
+            "
+          >
+            {{ ["", "每满", "满", "满"][discountSetting] }}
+            <!-- <el-input-number
+              v-model="updateForm.discountAmt"
+              size="mini"
+              :min="0"
+            /> -->
+            <input
+              v-model="updateForm.discountAmt"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
+            />
+
+            <span>{{
+              updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+            }}</span>
+            ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
+            <!-- <el-input-number
+              v-model="updateForm.gasoilDiscountAmt"
+              size="mini"
+              :min="0"
+            /> -->
+            <input
+              v-model="updateForm.gasoilDiscountAmt"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
+            />
+            元
+          </div>
+        </el-form-item>
+
+        <!-- 阶梯直降没有此规则 -->
+        <el-form-item
+          label="会员日"
+          prop="discountSettingFlag"
+          :rules="{
+            required: discountSetting != 4,
+            message: '请选择是否开启会员日',
+            trigger: 'change',
+          }"
+          v-if="discountSetting != 4"
+        >
+          <el-radio-group v-model="updateForm.discountSettingFlag">
+            <el-radio label="0">关闭</el-radio>
+            <el-radio label="1">开启</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <el-form-item
+          label="会员日周期类型"
+          prop="discountType"
+          v-show="updateForm.discountSettingFlag == 1"
+          :rules="{
+            required: updateForm.discountSettingFlag == 1,
+            message: '请选择会员日的周期类型',
+            trigger: 'change',
+          }"
+        >
+    
+          <select
+            v-model="updateForm.discountType"
+            class="form-control form-control-sm w-50"
+            @change="timeClear"
+          >
+            <option value="1">每周指定日</option>
+            <option value="2">每月指定日</option>
+            <option value="3">固定活动日</option>
+          </select>
+
+          <div
+            v-show="updateForm.discountType != 3"
+            style="
+              display: flex;
+              flex-wrap: wrap;
+              border-style: solid;
+              border-color: #f5f7fa;
+            "
+          >
+            <div
+              v-for="(item, index) in timeSelect[updateForm.discountType]"
+              :key="index"
+              style="margin: 3px"
+            >
+              <div
+                class="hover-style"
+                style="
+                  border-radius: 5px;
+                  font-weight: bold;
+                  font-size: 12px;
+                  cursor: pointer;
+                "
+                @click="clickCalendar(index)"
+              >
+                <div>{{ item }}</div>
+                <div
+                  v-if="updateForm.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 v-show="updateForm.discountType == 3" >
+            <el-date-picker
+              clearable
+              size="small"
+              style="width: 200px"
+              v-model="updateForm.collectClickDay"
+              type="dates"
+              value-format="yyyy-MM-dd"
+              placeholder="选择提醒时间设置"
+            >
+            </el-date-picker>
+          </div>
+        </el-form-item>
+
+        <el-form-item
+          label="会员日优惠条件"
+          prop="discountActivityAmt"
+          v-show="updateForm.discountSettingFlag == 1"
+          :rules="{
+            required: updateForm.discountSettingFlag == 1,
+            message: '请填写会员日的优惠金额',
+            trigger: 'change',
+          }"
+        >
+          <div>
+            {{ ["", "每满", "满", "满"][discountSetting] }}
+            <!--
+            <el-input-number
+              v-model="updateForm.discountAmt"
+              size="mini"
+              :min="0"
+              disabled
+            />
+            -->
+            <input
+              v-model="updateForm.discountAmt"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
+              disabled
+            />
+
+            <span>{{
+              updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+            }}</span>
+            ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
+            <input
+              v-model="updateForm.discountActivityAmt"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
+            />元
+          </div>
+        </el-form-item>
+
+        <el-form-item label="叠加等级优惠" prop="vipDiscountyPlus">
+          <el-radio-group v-model="updateForm.vipDiscountyPlus">
+            <el-radio label="1">叠加</el-radio>
+            <el-radio label="0">不叠加</el-radio>
+          </el-radio-group>
+          <!--
+          <div style="margin-left: 20px; color: red; font-size: 12px">
+            注:"否" 客户只享受 {{ discountName }} 优惠
+          </div>
+          -->
+        </el-form-item>
+
+        <!--
+        <el-form-item label="可否叠加劵" prop="couponPlus">
+          <el-radio-group v-model="updateForm.couponPlus">
+            <el-radio label="1">是</el-radio>
+            <el-radio label="0">否</el-radio>
+          </el-radio-group>
+          <div style="margin-left: 20px; color: red; font-size: 12px">
+            注:"否" 客户只享受 {{ discountName }} 优惠
+          </div>
+        </el-form-item>
+        -->
+
+        <!-- 只有阶梯直降有此规则 -->
+        <el-form-item
+          label="优惠条件"
+          prop="discountTerm"
+          :rules="{
+            required: discountSetting == 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting == 4"
+        >
+          <el-radio-group v-model="updateForm.discountTerm">
+            <el-radio label="2">按加油金额</el-radio>
+            <el-radio label="1">按加油升数</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <!-- 只有阶梯直降有此规则 -->
+        <el-form-item
+          label="阶梯设置"
+          prop="list"
+
+          v-if="discountSetting == 4"
+        >
+          <el-button
+            icon="el-icon-plus"
+            size="mini"
+            class="mb-3 mr-4"
+            @click="addLadder"
+            type="secondary"
+          >
+            添加规则
+          </el-button>
+        </el-form-item>
+
+        <div
+          class="mx-auto mb-4 bg-light pt-4 pb-2 px-1 rounded"
+          style="width: 450px"
+          v-if="discountSetting == 4"
+        >
+          <div
+            class="input-group input-group-sm mb-4 mt-1"
+            v-for="(item, index) in updateForm.list"
+            :key="index"
+          >
+            <input
+              type="text"
+              class="form-control"
+              v-model="item.discountAmt"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">
+                {{
+                  updateForm.discountTerm == 1
+                    ? "升&lt;= 加油升数 &lt;"
+                    : "元&lt;= 加油金额 &lt;"
+                }}
+              </span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              v-model="item.discountAmtEnd"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text"
+                >{{
+                  updateForm.discountTerm == 1 ? "升" : "元"
+                }},每升优惠</span
+              >
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              v-model="item.gasoilDiscountAmt"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元</span>
+            </div>
+            <div class="input-group-append" id="button-addon4">
+              <button
+                class="btn btn-danger"
+                type="button"
+                @click="delLadder(index)"
+              >
+                删除
+              </button>
+            </div>
+          </div>
+        </div>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handleSubmit">确 定</el-button>
+        <el-button @click="cancelSubmit">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      :inline="true"
+      label-width="68px"
+      v-show="discountSetting != 0"
+      class="mx-auto"
+    >
+      <div>
+        <el-button
+          icon="el-icon-plus"
+          size="mini"
+          class="mb-3 mr-4"
+          @click="handleUpdateClick"
+          style="float: right"
+          type="warning"
+        >
+          {{
+            this.discountSetting == 1
+              ? "添加满减方案规则"
+              : this.discountSetting == 2
+              ? "添加立减方案规则"
+              : this.discountSetting == 3
+              ? "添加直降方案规则"
+              : this.discountSetting == 4
+              ? "添加阶梯直降规则"
+              : "无"
+          }}
+        </el-button>
+      </div>
+    </el-form>
+    <el-table
+      :data="discountList"
+      v-show="discountSetting != 0 && discountSetting != 4"
+      class="shadow"
+    >
+      <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-if="discountSetting == 3"
+      >
+        <template slot-scope="scope">
+          满 {{ scope.row.discountAmt }}
+          {{ scope.row.discountTerm == 2 ? "元" : "L" }},每升优惠
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="优惠条件"
+        align="center"
+        v-if="discountSetting == 1"
+      >
+        <template slot-scope="scope">
+          每满 {{ scope.row.discountAmt }} 元,减
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="优惠条件"
+        align="center"
+        v-if="discountSetting == 2"
+      >
+        <template slot-scope="scope">
+          满 {{ scope.row.discountAmt }} 元,减
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="会员日"
+        align="center"
+        v-if="discountSetting != 4"
+      >
+        <template slot-scope="scope">
+          <span v-if="scope.row.discountSettingFlag == 0"> 无活动 </span>
+          <span v-else-if="scope.row.discountSettingFlag == 1">
+            {{ discountSettingTranslate(scope.row) }}
+          </span>
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="叠加等级优惠"
+        align="center"
+        prop="vipDiscountyPlus"
+        :formatter="vipDiscountyPlusFotmat"
+      />
+      <!--
+      <af-table-column
+        label="叠加劵"
+        align="center"
+        prop="couponPlus"
+        :formatter="couponPlusFotmat"
+      />
+      -->
+      <af-table-column
+        label="优惠方案类型"
+        v-if="false"
+        align="center"
+        prop="discountPlanType"
+      />
+      <af-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </af-table-column>
+    </el-table>
+    <el-table
+      :data="discountListTep"
+      v-show="discountSetting == 4"
+      type="expand"
+      class="shadow"
+    >
+      <af-table-column type="expand">
+        <template slot-scope="props">
+          <div class="container">
+            <div class="row">
+              <div
+              class="input-group input-group-sm mb-4 mt-1 col-lg-6"
+              v-for="(item, index) in props.row.list"
+              :key="index"
+              style="width:600px;"
+            >
+              <div class="input-group-append">
+                <span class="input-group-text"> 规则 {{index + 1}}: </span>
+              </div>
+              <input
+                type="text"
+                class="form-control"
+                v-model="item.discountAmt"
+                disabled
+                
+              />
+              <div class="input-group-append">
+                <span class="input-group-text"> {{updateForm.discountTerm==1 ? '升&lt;= 加油升数 &lt;': "元&lt;= 加油金额 &lt;"}}  </span>
+              </div>
+              <input
+                type="text"
+                class="form-control"
+                v-model="item.discountAmtEnd"
+                disabled
+              />
+              <div class="input-group-append">
+                <span class="input-group-text">{{updateForm.discountTerm==1 ? '升,':'元,'}}</span>
+              </div>
+              <div class="input-group-append">
+                <span class="input-group-text">每升优惠</span>
+              </div>
+              <input
+                type="text"
+                class="form-control"
+                v-model="item.gasoilDiscountAmt"
+                disabled
+              />
+              <div class="input-group-append">
+                <span class="input-group-text">元</span>
+              </div>
+              <div class="input-group-append" id="button-addon4">
+              </div>
+            </div>
+            </div>
+          </div>
+        </template>
+      </af-table-column>
+      <af-table-column label="方案名称" align="center" prop="grade" />
+      <af-table-column label="油品名称" align="center" prop="oilName" />
+      <af-table-column
+        label="叠加等级优惠"
+        align="center"
+        prop="vipDiscountyPlus"
+        :formatter="vipDiscountyPlusFotmat"
+      />
+      <!--
+      <af-table-column
+        label="叠加劵"
+        align="center"
+        prop="couponPlus"
+        :formatter="couponPlusFotmat"
+      />
+      -->
+      <af-table-column
+        label="优惠方案类型"
+        v-if="false"
+        align="center"
+        prop="discountPlanType"
+      />
+      <af-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+        width="200px"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleLadderUpdata(scope.row)"
+            >修改规则</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDeleteLadder(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </af-table-column>
+    </el-table>
+  </div>
 </template>
 
 <script>
 import {
-  sysDeptDemoList,
-  selectCustomerLabelInfo,
-  addAndDelCustomerLabel,
-  selectPhoneList,
-  selectNotCustomerLabelInfo,
-} from "@/api/label/label";
+  listPlan,
+  getPlan,
+  delPlan,
+  addPlan,
+  updatePlan,
+  exportPlan,
+  addMarketPlanInfo,
+  deleteMarketPlan
+} from "@/api/market/plan";
+import { getStationPay, updatePay } from "@/api/station/pay";
+import { getDept } from "@/api/system/dept";
+import { listPrice } from "@/api/station/price";
 export default {
-  name: "Dev_Test",
+  name: "Market_Discount",
   data() {
+    const validatorGasoilDiscountAmt = (rule, value, callback) => {
+      if (this.discountSetting == 3) {
+        if (
+          this.updateForm.discountTerm === undefined ||
+          this.updateForm.discountTerm === ""
+        ) {
+          callback(new Error("请选择优惠方式"));
+          return;
+        }
+      }
+      const start = +this.updateForm.discountAmt;
+      const end = +this.updateForm.gasoilDiscountAmt;
+      if (isNaN(start) || isNaN(end)) {
+        callback(new Error("检查优惠方式完整性"));
+        return;
+      }
+      callback();
+    };
+    const validatorLadderList = (rule, value, callback) => {
+      if (this.discountSetting != 4) {
+        return 
+      }
+
+      if(this.updateForm.list.length < 1 || !this.updateForm.list){
+        callback(new Error("请设置优惠的阶梯"));
+        return;
+      }
+      this.updateForm.list.map((ele)=>{
+        if(ele.discountAmt == '' || ele.discountAmt == null || ele.discountAmtEnd == '' || ele.discountAmtEnd == null || ele.gasoilDiscountAmt == '' || ele.gasoilDiscountAmt == null){
+          callback(new Error("请检查阶梯填入信息的完整性"));
+          return;
+        }
+        if(isNaN(+ele.discountAmtEnd) || isNaN(+ele.discountAmt) || isNaN(+ele.gasoilDiscountAmt)){
+          callback(new Error("请检查拼写,规则填入的必须是有效数字"));
+          return;
+        }
+        if((+ele.discountAmtEnd) <= (+ele.discountAmt)){
+          callback(new Error("您填写的一条规则里,起始值比结束值大"));
+          return;
+        }
+      })
+      const sortList = JSON.parse(JSON.stringify(this.updateForm.list))
+      const sortedList = sortList.sort((q,w)=>{
+        return q.discountAmt - w.discountAmt
+      })
+      
+      sortedList.reduce((prev, curr, ind, arr)=>{
+        if(prev.discountAmtEnd > curr.discountAmt){
+          callback(new Error("您填写的规则起始值存在冲突,请检查"));
+          return;
+        }
+        return curr
+      })
+      callback();
+    };
+
     return {
-      activeNames: undefined,
-      labelList: {},
-      notCustomerLabelList: [],
-      customerLabelList: [],
-      loading: false,
-      error: false,
-      currentLabelId: undefined,
+      testd: 1,
       pageStatus: 0,
-      timer: null,
-      leftData: [],
-      rightData: [],
-      leftTotal:100,
-      rightTotal:100,
-      leftQuery: {
+      discountList: [],
+      total: 0,
+      oilNameOptions: [],
+      title: "",
+      openDialog: false,
+      // 查询参数
+      queryParams: {
         pageNum: 1,
         pageSize: 10,
-        labelId:null,
-        customerName: null,
-        phone:null
+        grade: null,
+        discountWay: null,
+        gasoilDiscountLitre: null,
+        dieseloilDiscountLitre: null,
+        gradeType: null,
+        gasoilConsume: null,
+        gasoilGrowthValue: null,
+        dieseloilConsume: null,
+        dieseloilGrowthValue: null,
+        growthValue: null,
+        date: null,
+        deductionGrowthValue: null,
       },
-      rightQuery: {
-        pageNum: 1,
-        pageSize: 10,
-        labelId:null,
-        customerName: null,
-        phone:null
+      updateFormDynamic1: ["", "满", "每满", "满"],
+      updateFormDynamic2: ["", "减", "减", "每升优惠"],
+      ruleForm: {},
+      // 表单校验
+      rules: {
+        grade: [{ required: true, message: "请输入方案名称", trigger: "blur" }],
+        oilName: [
+          { required: true, message: "请选择油品名称", trigger: "change" },
+        ],
+        discountTerm: [
+          { required: true, message: "选择油品名称", trigger: "change" },
+        ],
+        gasoilDiscountAmt: [
+          { validator: validatorGasoilDiscountAmt, trigger: "change" },
+        ],
+        discountAmt: [
+          { required: true, message: "请填写优惠金额", trigger: "blur" },
+        ],
+        vipDiscountyPlus: [
+          {
+            required: true,
+            message: "选择等级优惠是否叠加",
+            trigger: "change",
+          },
+        ],
+        // couponPlus: [
+        //   { required: true, message: "选择可否叠加券", trigger: "change" },
+        // ],
+        list:[
+          { validator: validatorLadderList, trigger: "change" },
+        ]
       },
-      moveRightData:[],
-      moveLeftData:[]
+      dtrules: {},
+      discountSetting: 0,
+      updateForm: {
+        collectClickCalendar: [],
+        collectClickDay: [],
+      },
+      currentDiscountName: "",
+      timeSelect: [
+        ,
+        ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
+        [
+          "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",
+        ],
+      ],
+      discountListTep: [
+      ],
+      ladderUp:false,
     };
   },
+  computed: {
+    discountName() {
+      return this.discountSetting == 1
+        ? "满减"
+        : this.discountSetting == 2
+        ? "立减"
+        : this.discountSetting == 3
+        ? "直降"
+        : this.discountSetting == 4
+        ? "阶梯直降"
+        : "无";
+    },
+    filterOilNameOptions() {
+      return this.oilNameOptions.filter((ele) => {
+        let flag = true;
+        this.discountList.forEach((item) => {
+          if (ele.oilName == item.oilName) {
+            flag = false;
+          }
+        });
+        return flag;
+      });
+    },
+  },
   created() {
+    this.setPageStatus();
     this.init();
   },
-  computed:{
-    toggleable(){
-      if(this.moveRightData.length === 0 && this.moveLeftData.length === 0){
-        return true;
-      }
-      return false;
-    }
-  },
   methods: {
-    getLeftData(){
-      // this.leftData = [];
-      selectNotCustomerLabelInfo(this.leftQuery)
-        .then((res) => {
-          if (res.code == 200) {
-            this.leftData = res.rows;
-            this.leftTotal = res.total
-          } else {
-            throw new Error("");
-          }
-        })
-        .catch((err) => {
-          this.leftData = [];
-          this.leftTotal = 0;
-          this.msgError("拉取左边标签用户失败,请刷新~");
+    handleLadderUpdata(row){
+      this.updateForm = row
+      this.ladderUp = true;
+      this.openDialog = true;
+    },
+    delLadder(index) {
+      this.updateForm.list.splice(index, 1);
+      if (this.updateForm.list < 1) {
+        this.updateForm.list.push({
+          discountAmtEnd: null,
+          discountAmt: null,
+          gasoilDiscountAmt: null,
         });
-      
+        this.updateForm = { ...this.updateForm };
+      }
+    },
+    addLadder(e) {
+      this.updateForm.list.push({
+        discountAmtEnd: null,
+        discountAmt: null,
+        gasoilDiscountAmt: null,
+      });
+      this.updateForm = { ...this.updateForm };
+    },
+    test(e) {
+      console.log("---");
+      console.log(e);
+      console.log(123);
+      console.log(this.testd);
+    },
+    init() {
+      listPrice().then((response) => {
+        this.oilNameOptions = response.rows;
+      });
+      this.getPay().then(() => {
+        this.getList();
+      });
+    },
+    setPageStatus() {
+      this.queryPageStatus([2]).then((res) => {
+        this.pageStatus = res;
+      });
+    },
+    timeClear() {
+      this.updateForm.collectClickCalendar = [];
+      this.updateForm.collectClickDay = [];
+    },
+    getPay() {
+      return getStationPay().then((response) => {
+        this.ruleForm = response.data;
+        this.discountSetting = response.data.discountSetting;
+        this.currentDiscountName = this.discountName;
+      });
     },
-    getRightData(){
-      // this.rightData = [];
-      selectPhoneList(this.rightQuery)
-        .then((res) => {
-          if (res.code == 200) {
-            this.rightData = res.rows;
-            this.rightTotal = res.total;
+    save() {
+      this.$refs["ruleForm"].validate((valid) => {
+        if (valid) {
+          if (this.ruleForm.deptId != null) {
+            let upPromise = null;
+            let e = this.ruleForm.discountSetting;
+            if (e == "0") {
+              upPromise = updatePay(this.ruleForm).then((response) => {
+                this.msgSuccess("优惠方案设置成功");
+              });
+            } else if (e == "1") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("满减规则下无方案");
+                return;
+              }
+            } else if (e == "2") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("立减规则下无方案");
+                return;
+              }
+            } else if (e == "3") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("直降规则下无方案");
+                return;
+              }
+            } else if (e == "4") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("直降规则下无方案");
+                return;
+              }
+            }
+            upPromise
+              .catch((err) => {
+                this.msgError("设置时出错,请刷新后重试~");
+              })
+              .then((res) => {
+                this.getPay();
+              });
           } else {
-            throw new Error("");
+            this.getPay();
           }
-        })
-        .catch(() => {
-          this.rightData = [];
-          this.rightTotal = 0;
-          this.msgError("拉取右边标签用户失败,请刷新~");
-        });
-
+        }
+      });
     },
-    handleMoveLabel(direction = 'right', type = 1, row, labelIdArr){  // type 1 传row  type 2 idArr    direction right 向右转移 left 向左转移
-       let changeArr = []
-       if(type == 1){
-          changeArr.push(row.phone)
-       }else if(type == 2){
-         changeArr = labelIdArr
-       }
+    discountSettingChang(e) {
+      this.discountSetting = e;
+      this.getList();
+    },
+    getList() {
       const query = {
-        labelId: direction == 'right' ? this.leftQuery.labelId : this.rightQuery.labelId,
-        flag: "1",
-        phoneList: changeArr,
+        pageNum: 1,
+        pageSize: 100,
+        discountPlanType: this.discountSetting,
       };
-      if (direction == "right") {
-        query.flag = "0";
-      } else if (direction == "left") {
-        query.flag = "1";
-      }
-      addAndDelCustomerLabel(query).then((res) => {
-        if (res.code == 200) {
-          this.getLeftData();
-          this.getRightData();
-        } else {
-          throw new Error("");
+      listPlan(query).then((response) => {
+        if (this.discountSetting == 4) {
+          this.discountListTep = response.rows;
+          return;
         }
-      }).catch((err)=>{
-        
+        this.discountList = response.rows;
+        this.total = response.total;
       });
-
     },
-    clearLeftQuery(labelId = this.leftQuery.labelId){
-      this.leftQuery =  {
-        pageNum: 1,
-        pageSize: 10,
-        labelId,
-        customerName: null,
-        phone:null
+    vipDiscountyPlusFotmat(row, column) {
+      if (row.vipDiscountyPlus === "1") {
+        return "是";
+      } else if (row.vipDiscountyPlus === "0") {
+        return "否";
       }
     },
-    clearRightQuery(labelId = this.rightQuery.labelId){
-      console.log(this.rightQuery);
-      this.rightQuery =  {
-        pageNum: 1,
-        pageSize: 10,
-        labelId,
-        customerName: null,
-        phone:null
+    couponPlusFotmat(row, column) {
+      if (row.couponPlus === "1") {
+        return "是";
+      } else if (row.couponPlus === "0") {
+        return "否";
       }
     },
-    handleLeftChange(val) {
-      let changeArr = [];
-      val.map((ele) => {
-        changeArr.push(ele.phone);
-      });
-      this.moveLeftData = []
-      this.moveRightData = changeArr
-      this.$refs.rightTable.map((ele)=>{
-        ele.clearSelection();
-      });
+    handleUpdateClick() {
+      this.openDialog = true;
+      this.ladderUp = false;
+      this.updateForm = {
+        discountPlanType: this.discountSetting,
+        collectClickDay:[],
+        collectClickCalendar:[]
+      };
+      if (this.discountSetting == 4) {
+        this.updateForm.list = [
+          {
+            discountAmtEnd: null,
+            discountAmt: null,
+            gasoilDiscountAmt: null,
+          },
+        ];
+      }
     },
-    handleRightChange(val) {
-      let changeArr = [];
-      val.map((ele) => {
-        changeArr.push(ele.phone);
-      });
-      this.moveLeftData = changeArr
-      this.moveRightData = []
-      this.$refs.leftTable.map((ele)=>{
-        ele.clearSelection()
+    handleSubmit() {
+      this.$refs["updateForm"].validate((valid) => {
+        if (valid) {
+          // 会员日特殊处理
+          if (
+            this.updateForm.discountSettingFlag == "1" &&
+            this.discountSetting != "4"
+          ) {
+            if (
+              this.updateForm.discountType == "1" ||
+              this.updateForm.discountType == "2"
+            ) {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickCalendar.toString();
+            } else {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickDay.toString();
+            }
+          }
+          console.log("发送了1");
+          // 阶梯直降
+          if (this.discountSetting == "4") {
+            console.log("发送了2");
+            addMarketPlanInfo(this.updateForm)
+              .then((res) => {
+                this.msgSuccess("新增成功");
+                this.openDialog = false;
+                this.getList();
+                return ;
+              });
+              return ;
+          }
+          if (this.updateForm.id != null) {
+            updatePlan(this.updateForm).then((response) => {
+              this.msgSuccess("修改成功");
+              this.openDialog = false;
+              this.getList();
+            });
+          } else {
+            addPlan(this.updateForm).then((response) => {
+              if(this.ladderUp){
+                this.msgSuccess("修改成功");
+              }else{
+                this.msgSuccess("新增成功");
+              }
+              this.openDialog = false;
+              this.getList();
+            });
+          }
+        }
       });
     },
-    init() {
-      this.setPageStatus();
-      this.getLabelList();
+    clickCalendar(index) {
+      if (this.updateForm.collectClickCalendar.indexOf(index) === -1) {
+        this.updateForm.collectClickCalendar.push(index);
+      } else if (this.updateForm.collectClickCalendar.indexOf(index) > -1) {
+        const temp = this.updateForm.collectClickCalendar.findIndex((ele) => {
+          return ele == index;
+        });
+        this.updateForm.collectClickCalendar.splice(temp, 1);
+      }
+      this.$refs.updateForm.validateField("discountType");
+      this.updateForm = { ...this.updateForm };
     },
-    setPageStatus() {
-      this.queryPageStatus([2]).then((res) => {
-        this.pageStatus = res;
-      });
+    cancelSubmit() {
+      this.openDialog = false;
     },
-    openLabel(id) {
-      this.clearLeftQuery(id);
-      this.clearRightQuery(id);
-      this.getLeftData();
-      this.getRightData();
+
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      const id = row.id;
+      this.title = "修改满减优惠";
+      this.openDialog = true;
+      this.updateForm = row;
     },
-    // getLabelUser(id) {
-    //   this.loading = true;
-    //   selectCustomerLabelInfo({
-    //     labelId: id,
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id;
+      this.$confirm("是否确认删除满减优惠方案?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          return delPlan(ids);
+        })
+        .then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        });
+    },
+    handleDeleteLadder(row){
+      const oilName = row.oilName;
+      this.$confirm("是否确认该油品的阶梯直降?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          return deleteMarketPlan({
+            oilName: oilName,
+            discountPlanType:"4"
+          });
+        })
+        .then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        });
+    },
+    // /** 导出按钮操作 */
+    // handleExport() {
+    //   const queryParams = this.queryParams;
+    //   this.$confirm("是否确认导出所有优惠设置数据项?", "警告", {
+    //     confirmButtonText: "确定",
+    //     cancelButtonText: "取消",
+    //     type: "warning",
     //   })
-    //     .then((res) => {
-    //       if (res.code == 200) {
-    //         this.notCustomerLabelList = res.data.notCustomerLabelList;
-    //         this.customerLabelList = res.data.phoneList;
-    //       } else {
-    //         throw new Error("");
-    //       }
+    //     .then(function () {
+    //       return exportPlan(queryParams);
     //     })
-    //     .catch(() => {
-    //       this.loading = false;
-    //       this.error = true;
-    //       this.msgError("拉取标签下用户信息失败");
+    //     .then((response) => {
+    //       this.download(response.msg);
     //     });
     // },
-    toggleLabel(){
-      console.log(this.moveLeftData);
-      console.log(this.moveRightData);
-      if(this.moveLeftData.length !== 0){
-        this.handleMoveLabel('left',2,null,this.moveLeftData)
-        return;
+    discountSettingTranslate(row) {
+      if (row.discountSettingFlag == 0) {
+        return "未设置";
       }
-      if(this.moveRightData.length !== 0){
-        this.handleMoveLabel('right',2,null,this.moveRightData)
-        return;
+      // if (this.discountList.integralActivity == 0) {
+      //   return "";
+      // }
+
+      let timeString = "";
+      const discountType = row.discountType;
+
+      if (discountType == 1) {
+        timeString += "每周的";
+      }
+      if (discountType == 2) {
+        timeString += "每月的";
+      }
+      if (discountType == 3) {
+        timeString += "指定的日期 ";
+      }
+      if (discountType == 1 || discountType == 2) {
+        (row.discountDate || "")
+          .split(",")
+          .filter((ele) => {
+            return ele !== "";
+          })
+          .forEach((ele) => {
+            timeString += this.timeSelect[discountType][ele] + "、";
+          });
+      } else if (discountType == 3) {
+        timeString += row.discountDate.toString();
       }
-      return;
-    },
 
-    getLabelList() {
-      return sysDeptDemoList().then((res) => {
-        if (res.code == 200) {
-          this.labelList = res.data;
-        } else {
-          this.msgError("初始化数据失败");
-        }
-      });
+      timeString = timeString.replace(/(、)$/g, "") + " 优惠:";
+      if (this.discountSetting == 3) {
+        timeString +=
+          "满" +
+          row.discountAmt +
+          (row.discountTerm == 2 ? "元" : "L") +
+          ",每升优惠" +
+          row.discountActivityAmt +
+          "元";
+      } else if (this.discountSetting == 1) {
+        timeString +=
+          "每满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
+      } else if (this.discountSetting == 2) {
+        timeString +=
+          "满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
+      }
+      return timeString;
     },
-
-    // transfer(originlArr, direction, changeArr) {
-    //   const query = {
-    //     labelId: this.activeNames,
-    //     flag: "1",
-    //     phoneList: changeArr,
-    //   };
-    //   if (direction == "right") {
-    //     query.flag = "0";
-    //   } else if (direction == "left") {
-    //     query.flag = "1";
-    //   }
-    //   addAndDelCustomerLabel(query).then((res) => {
-    //     if (res.code == 200) {
-    //       this.getRightUser();
-    //     } else {
-    //     }
-    //   });
-    // },
   },
 };
 </script>
-
-<style lang="scss">
-.Label_AddUser {
-  .collapse {
-    width: 1200px;
-    margin: 0 auto;
-
-    //.el-collapse-item__wrap {
-    // border-bottom: 1px solid;
-    //}
-
-    .el-transfer-panel {
-      width: 300px;
-      height: 600px;
-    }
-
-    .el-transfer-panel__list.is-filterable {
-      height: 465px;
-    }
-  }
-}
+<style>
 </style>

+ 912 - 0
src/views/label/Label_Batch.vue

@@ -0,0 +1,912 @@
+<template>
+  <div v-if="pageStatus == 0">配置加载中...</div>
+  <div v-else-if="pageStatus == 1">此页面不对此账号开放</div>
+  <div v-else-if="pageStatus == 2">
+    没有此页内容的配置权限,请检查集团上的配置
+  </div>
+  <div v-else-if="pageStatus == 3">加载发生错误</div>
+  <div v-else-if="pageStatus == 4" class="app-container">
+    <el-form
+      ref="ruleForm"
+      :model="ruleForm"
+      :rules="rules"
+      label-width="130px"
+    >
+      <el-form-item label="当前执行优惠方案">
+        {{ currentDiscountName }}
+      </el-form-item>
+      <el-form-item label="优惠方案">
+        <el-select
+          v-model="ruleForm.discountSetting"
+          placeholder="请选择优惠方案"
+          clearable
+          size="small"
+          @change="discountSettingChang"
+        >
+          <el-option label="无" value="0"></el-option>
+          <el-option label="满减" value="1"></el-option>
+          <el-option label="立减" value="2"></el-option>
+          <el-option label="直降" value="3"></el-option>
+          <el-option label="阶梯直降" value="4"></el-option>
+        </el-select>
+        <el-button size="mini" @click="save" type="primary"
+          >确定执行该优惠方案</el-button
+        >
+      </el-form-item>
+    </el-form>
+
+    <hr />
+    <el-dialog
+      :visible.sync="openDialog"
+      width="520px"
+      append-to-body
+      :title="
+        ['', '满减方案', '立减方案', '直降方案', '阶梯直降'][discountSetting]
+      "
+    >
+      <el-form
+        ref="updateForm"
+        :model="updateForm"
+        :rules="rules"
+        label-width="120px"
+      >
+        <el-form-item label="方案名称" prop="grade" class="input-group-sm">
+          <!-- <el-input v-model="updateForm.grade" placeholder="请输入方案名称" /> -->
+          <input v-model="updateForm.grade" placeholder="请输入方案名称" class="form-control form-control-sm w-50"/>
+        </el-form-item>
+        <el-form-item label="油品名称" prop="oilName">
+          <el-select
+            v-model="updateForm.oilName"
+            placeholder="油品名称"
+            clearable
+            size="small"
+            class=" w-50"
+          >
+            <el-option
+              v-for="dict in filterOilNameOptions"
+              :key="dict.oilName"
+              :label="dict.oilName"
+              :value="dict.oilName"
+            />
+          </el-select>
+        </el-form-item>
+
+        <!-- 阶梯直降没有此条目 -->
+        <el-form-item
+          label="优惠条件"
+          prop="gasoilDiscountAmt"
+          :rules="{
+            required: discountSetting != 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting != 4"
+        >
+          <el-radio-group
+            v-model="updateForm.discountTerm"
+            v-if="discountSetting == 3"
+          >
+            <el-radio :label="2">按加油金额</el-radio>
+            <el-radio :label="1">按加油升数</el-radio>
+          </el-radio-group>
+          <div
+            v-show="
+              updateForm.discountTerm == 2 ||
+              updateForm.discountTerm == 1 ||
+              discountSetting == 1 ||
+              discountSetting == 2
+            "
+          >
+            {{ ["", "每满", "满", "满"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.discountAmt"
+              size="mini"
+              :min="0"
+            />
+
+            <span>{{
+              updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+            }}</span>
+            ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.gasoilDiscountAmt"
+              size="mini"
+              :min="0"
+            />元
+          </div>
+        </el-form-item>
+
+        <!-- 阶梯直降没有此条目 -->
+        <el-form-item
+          label="会员日"
+          prop="discountSettingFlag"
+          :rules="{
+            required: discountSetting != 4,
+            message: '请选择是否开启会员日',
+            trigger: 'change',
+          }"
+          v-if="discountSetting != 4"
+        >
+          <el-radio-group v-model="updateForm.discountSettingFlag">
+            <el-radio label="0">关闭</el-radio>
+            <el-radio label="1">开启</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <el-form-item
+          label="会员日周期类型"
+          prop="discountType"
+          v-show="updateForm.discountSettingFlag == 1"
+          :rules="{
+            required: updateForm.discountSettingFlag == 1,
+            message: '请选择会员日的周期类型',
+            trigger: 'change',
+          }"
+        >
+          <el-select
+            v-model="updateForm.discountType"
+            clearable
+            size="small"
+            @change="timeClear"
+          >
+            <el-option label="每周指定日" value="1"></el-option>
+            <el-option label="每月指定日" value="2"></el-option>
+            <el-option label="固定活动日" value="3"></el-option>
+          </el-select>
+          <div
+            v-show="updateForm.discountType != 3"
+            style="
+              display: flex;
+              flex-wrap: wrap;
+              border-style: solid;
+              border-color: #f5f7fa;
+            "
+          >
+            <div
+              v-for="(item, index) in timeSelect[updateForm.discountType]"
+              :key="index"
+              style="margin: 3px"
+            >
+              <div
+                class="hover-style"
+                style="
+                  border-radius: 5px;
+                  font-weight: bold;
+                  font-size: 12px;
+                  cursor: pointer;
+                "
+                @click="clickCalendar(index)"
+              >
+                <div>{{ item }}</div>
+                <div
+                  v-if="updateForm.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 v-show="updateForm.discountType == 3">
+            <el-date-picker
+              clearable
+              size="small"
+              style="margin-left: 10px; width: 200px"
+              v-model="updateForm.collectClickDay"
+              type="dates"
+              value-format="yyyy-MM-dd"
+              placeholder="选择提醒时间设置"
+            >
+            </el-date-picker>
+          </div>
+        </el-form-item>
+        <el-form-item
+          label="会员日优惠条件"
+          prop="discountActivityAmt"
+          v-show="updateForm.discountSettingFlag == 1"
+          :rules="{
+            required: updateForm.discountSettingFlag == 1,
+            message: '请填写会员日的优惠金额',
+            trigger: 'change',
+          }"
+        >
+          <div>
+            {{ ["", "每满", "满", "满"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.discountAmt"
+              size="mini"
+              :min="0"
+              disabled
+            />
+
+            <span>{{
+              updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+            }}</span>
+            ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
+            <el-input-number
+              v-model="updateForm.discountActivityAmt"
+              size="mini"
+              :min="0"
+            />元
+          </div>
+          <!-- <el-input-number
+            v-model="updateForm.integralProportion"
+            :min="1"
+            placeholder="请输入加倍比例"
+            size="small"
+          />
+          <span>倍</span> -->
+          <!-- 满
+          <el-input-number
+            v-model="updateForm.discountAmt"
+            size="mini"
+            :min="0"
+            disabled
+          /><span>{{
+            updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
+          }}</span
+          >,每升优惠<el-input-number
+            v-model="updateForm.discountActivityAmt"
+            size="mini"
+            :min="0"
+          />元 -->
+        </el-form-item>
+        <el-form-item label="叠加等级优惠" prop="vipDiscountyPlus">
+          <el-radio-group v-model="updateForm.vipDiscountyPlus">
+            <el-radio label="1">是</el-radio>
+            <el-radio label="0">否</el-radio>
+          </el-radio-group>
+          <div style="margin-left: 20px; color: red; font-size:12px">
+            注:"否" 客户只享受 {{ discountName }} 优惠
+          </div>
+        </el-form-item>
+        <el-form-item label="可否叠加劵" prop="couponPlus">
+          <el-radio-group v-model="updateForm.couponPlus">
+            <el-radio label="1">是</el-radio>
+            <el-radio label="0">否</el-radio>
+          </el-radio-group>
+          <div style="margin-left: 20px; color: red;font-size:12px">
+            注:"否" 客户只享受 {{ discountName }} 优惠
+          </div>
+        </el-form-item>
+        
+        <!-- 只有阶梯直降有此条目 -->
+        <el-form-item
+          label="优惠条件"
+          prop="discountTerm"
+          :rules="{
+            required: discountSetting == 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting == 4"
+        >
+          <el-radio-group v-model="updateForm.discountTerm">
+            <el-radio :label="2">按加油金额</el-radio>
+            <el-radio :label="1">按加油升数</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <!-- 只有阶梯直降有此条目 -->
+        <el-form-item
+          label="阶梯设置"
+          prop="discountType"
+          :rules="{
+            required: discountSetting == 4,
+            message: '请选择会员日的周期类型',
+            trigger: 'change',
+          }"
+          v-if="discountSetting == 4"
+        >
+        <el-button
+          icon="el-icon-plus"
+          size="mini"
+          class="mb-3 mr-4"
+          @click="handleUpdateClick"
+          type="secondary"
+        >
+          添加条目
+        </el-button>
+        </el-form-item>
+
+        <div class="mx-auto mb-4 shadow-lg bg-white pt-4 pb-2 px-1 rounded" style="width: 450px;">
+          <div class="input-group input-group-sm mb-4 mt-1">
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text"> &lt;= 加油金额 &lt;= </span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元,每升优惠</span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元</span>
+            </div>
+            <div class="input-group-append" id="button-addon4">
+              <button class="btn btn-danger" type="button">删除</button>
+            </div>
+          </div>
+          <div class="input-group input-group-sm mb-4 mt-1">
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text"> &lt;= 加油金额 &lt;= </span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元,每升优惠</span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              aria-label="Dollar amount (with dot and two decimal places)"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元</span>
+            </div>
+            <div class="input-group-append" id="button-addon4">
+              <button class="btn btn-danger" type="button">删除</button>
+            </div>
+          </div>
+        </div>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="handleSubmit">确 定</el-button>
+        <el-button @click="cancelSubmit">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      :inline="true"
+      label-width="68px"
+      v-show="discountSetting != 0"
+    >
+      <div>
+        <el-button
+          icon="el-icon-plus"
+          size="small"
+          class="mb-3 mr-4"
+          @click="handleUpdateClick"
+          style="float: right"
+          type="warning"
+        >
+          {{
+            this.discountSetting == 1
+              ? "添加满减方案条目"
+              : this.discountSetting == 2
+              ? "添加立减方案条目"
+              : this.discountSetting == 3
+              ? "添加直降方案条目"
+              : this.discountSetting == 4
+              ? "添加阶梯直降条目"
+              : "无"
+          }}
+        </el-button>
+      </div>
+    </el-form>
+    <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-if="discountSetting == 3"
+      >
+        <template slot-scope="scope">
+          满 {{ scope.row.discountAmt }}
+          {{ scope.row.discountTerm == 2 ? "元" : "L" }},每升优惠
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="优惠条件"
+        align="center"
+        v-if="discountSetting == 1"
+      >
+        <template slot-scope="scope">
+          每满 {{ scope.row.discountAmt }} 元,减
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="优惠条件"
+        align="center"
+        v-if="discountSetting == 2"
+      >
+        <template slot-scope="scope">
+          满 {{ scope.row.discountAmt }} 元,减
+          {{ scope.row.gasoilDiscountAmt }} 元
+        </template>
+      </af-table-column>
+      <af-table-column label="会员日" align="center">
+        <template slot-scope="scope">
+          <span v-if="scope.row.discountSettingFlag == 0"> 无活动 </span>
+          <span v-else-if="scope.row.discountSettingFlag == 1">
+            {{ discountSettingTranslate(scope.row) }}
+          </span>
+        </template>
+      </af-table-column>
+      <af-table-column
+        label="叠加等级优惠"
+        align="center"
+        prop="vipDiscountyPlus"
+        :formatter="vipDiscountyPlusFotmat"
+      />
+      <af-table-column
+        label="叠加劵"
+        align="center"
+        prop="couponPlus"
+        :formatter="couponPlusFotmat"
+      />
+      <af-table-column
+        label="优惠方案类型"
+        v-if="false"
+        align="center"
+        prop="discountPlanType"
+      />
+      <af-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)"
+            >修改</el-button
+          > -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </af-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import {
+  listPlan,
+  getPlan,
+  delPlan,
+  addPlan,
+  updatePlan,
+  exportPlan,
+} from "@/api/market/plan";
+import { getStationPay, updatePay } from "@/api/station/pay";
+import { getDept } from "@/api/system/dept";
+import { listPrice } from "@/api/station/price";
+export default {
+  name: "Label_Batch",
+  data() {
+    const validatorGasoilDiscountAmt = (rule, value, callback) => {
+      if (this.discountSetting == 3) {
+        if (
+          this.updateForm.discountTerm === undefined ||
+          this.updateForm.discountTerm === ""
+        ) {
+          callback(new Error("请选择优惠方式"));
+          return;
+        }
+      }
+      const start = +this.updateForm.discountAmt;
+      const end = +this.updateForm.gasoilDiscountAmt;
+      if (isNaN(start) || isNaN(end)) {
+        callback(new Error("检查优惠方式完整性"));
+        return;
+      }
+      callback();
+    };
+
+    return {
+      pageStatus: 0,
+      discountList: [],
+      total: 0,
+      oilNameOptions: [],
+      title: "",
+      openDialog: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        grade: null,
+        discountWay: null,
+        gasoilDiscountLitre: null,
+        dieseloilDiscountLitre: null,
+        gradeType: null,
+        gasoilConsume: null,
+        gasoilGrowthValue: null,
+        dieseloilConsume: null,
+        dieseloilGrowthValue: null,
+        growthValue: null,
+        date: null,
+        deductionGrowthValue: null,
+      },
+      updateFormDynamic1: ["", "满", "每满", "满"],
+      updateFormDynamic2: ["", "减", "减", "每升优惠"],
+      ruleForm: {},
+      // 表单校验
+      rules: {
+        grade: [{ required: true, message: "请输入方案名称", trigger: "blur" }],
+        oilName: [
+          { required: true, message: "请选择油品名称", trigger: "change" },
+        ],
+        discountTerm: [
+          { required: true, message: "选择油品名称", trigger: "change" },
+        ],
+        gasoilDiscountAmt: [
+          { validator: validatorGasoilDiscountAmt, trigger: "change" },
+        ],
+        discountAmt: [
+          { required: true, message: "请填写优惠金额", trigger: "blur" },
+        ],
+        vipDiscountyPlus: [
+          {
+            required: true,
+            message: "选择等级优惠是否叠加",
+            trigger: "change",
+          },
+        ],
+        couponPlus: [
+          { required: true, message: "选择可否叠加券", trigger: "change" },
+        ],
+      },
+      dtrules: {},
+      discountSetting: 0,
+      updateForm: {
+        collectClickCalendar: [],
+        collectClickDay: "",
+      },
+      currentDiscountName: "",
+      timeSelect: [
+        ,
+        ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
+        [
+          "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",
+        ],
+      ],
+    };
+  },
+  computed: {
+    discountName() {
+      return this.discountSetting == 1
+        ? "满减"
+        : this.discountSetting == 2
+        ? "立减"
+        : this.discountSetting == 3
+        ? "直降"
+        : "无";
+    },
+    filterOilNameOptions() {
+      return this.oilNameOptions.filter((ele) => {
+        let flag = true;
+        this.discountList.forEach((item) => {
+          if (ele.oilName == item.oilName) {
+            flag = false;
+          }
+        });
+        return flag;
+      });
+    },
+  },
+  created() {
+    this.setPageStatus();
+    this.init();
+  },
+  methods: {
+    init() {
+      listPrice().then((response) => {
+        this.oilNameOptions = response.rows;
+      });
+      this.getPay().then(() => {
+        this.getList();
+      });
+    },
+    setPageStatus() {
+      this.queryPageStatus([2]).then((res) => {
+        this.pageStatus = res;
+      });
+    },
+    timeClear() {
+      this.updateForm.collectClickCalendar = [];
+      this.updateForm.collectClickDay = [];
+    },
+    getPay() {
+      return getStationPay().then((response) => {
+        this.ruleForm = response.data;
+        this.discountSetting = response.data.discountSetting;
+        this.currentDiscountName = this.discountName;
+      });
+    },
+    save() {
+      this.$refs["ruleForm"].validate((valid) => {
+        if (valid) {
+          if (this.ruleForm.deptId != null) {
+            let upPromise = null;
+            let e = this.ruleForm.discountSetting;
+            if (e == "0") {
+              upPromise = updatePay(this.ruleForm).then((response) => {
+                this.msgSuccess("优惠方案设置成功");
+              });
+            } else if (e == "1") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("满减规则下无方案");
+                return;
+              }
+            } else if (e == "2") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("立减规则下无方案");
+                return;
+              }
+            } else if (e == "3") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("直降规则下无方案");
+                return;
+              }
+            }
+            upPromise
+              .catch((err) => {
+                this.msgError("设置时出错,请刷新后重试~");
+              })
+              .then((res) => {
+                this.getPay();
+              });
+          } else {
+            this.getPay();
+          }
+        }
+      });
+    },
+    discountSettingChang(e) {
+      console.log(e);
+      this.discountSetting = e;
+      this.getList();
+    },
+    getList() {
+      const query = {
+        pageNum: 1,
+        pageSize: 100,
+        discountPlanType: this.discountSetting,
+      };
+      listPlan(query).then((response) => {
+        this.discountList = response.rows;
+        this.total = response.total;
+      });
+    },
+    vipDiscountyPlusFotmat(row, column) {
+      if (row.vipDiscountyPlus === "1") {
+        return "是";
+      } else if (row.vipDiscountyPlus === "0") {
+        return "否";
+      }
+    },
+    couponPlusFotmat(row, column) {
+      if (row.couponPlus === "1") {
+        return "是";
+      } else if (row.couponPlus === "0") {
+        return "否";
+      }
+    },
+    handleUpdateClick() {
+      this.openDialog = true;
+      this.updateForm = {
+        discountPlanType: this.discountSetting,
+      };
+    },
+    handleSubmit() {
+      this.$refs["updateForm"].validate((valid) => {
+        if (valid) {
+          if (this.updateForm.discountSettingFlag == "1") {
+            if (
+              this.updateForm.discountType == "1" ||
+              this.updateForm.discountType == "2"
+            ) {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickCalendar.toString();
+            } else {
+              this.updateForm.discountDate =
+                this.updateForm.collectClickDay.toString();
+            }
+          }
+          if (this.updateForm.id != null) {
+            updatePlan(this.updateForm).then((response) => {
+              this.msgSuccess("修改成功");
+              this.openDialog = false;
+              this.getList();
+            });
+          } else {
+            addPlan(this.updateForm).then((response) => {
+              this.msgSuccess("新增成功");
+              this.openDialog = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    clickCalendar(index) {
+      if (this.updateForm.collectClickCalendar.indexOf(index) === -1) {
+        this.updateForm.collectClickCalendar.push(index);
+      } else if (this.updateForm.collectClickCalendar.indexOf(index) > -1) {
+        const temp = this.updateForm.collectClickCalendar.findIndex((ele) => {
+          return ele == index;
+        });
+        this.updateForm.collectClickCalendar.splice(temp, 1);
+      }
+      this.$refs.updateForm.validateField("discountType");
+      this.updateForm = { ...this.updateForm };
+    },
+    cancelSubmit() {
+      this.openDialog = false;
+    },
+
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      const id = row.id;
+      this.title = "修改满减优惠";
+      this.openDialog = true;
+      this.updateForm = row;
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id;
+      this.$confirm("是否确认删除满减优惠方案?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          return delPlan(ids);
+        })
+        .then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        });
+    },
+    // /** 导出按钮操作 */
+    // handleExport() {
+    //   const queryParams = this.queryParams;
+    //   this.$confirm("是否确认导出所有优惠设置数据项?", "警告", {
+    //     confirmButtonText: "确定",
+    //     cancelButtonText: "取消",
+    //     type: "warning",
+    //   })
+    //     .then(function () {
+    //       return exportPlan(queryParams);
+    //     })
+    //     .then((response) => {
+    //       this.download(response.msg);
+    //     });
+    // },
+    discountSettingTranslate(row) {
+      if (row.discountSettingFlag == 0) {
+        return "未设置";
+      }
+      // if (this.discountList.integralActivity == 0) {
+      //   return "";
+      // }
+
+      let timeString = "";
+      const discountType = row.discountType;
+
+      if (discountType == 1) {
+        timeString += "每周的";
+      }
+      if (discountType == 2) {
+        timeString += "每月的";
+      }
+      if (discountType == 3) {
+        timeString += "指定的日期 ";
+      }
+      if (discountType == 1 || discountType == 2) {
+        (row.discountDate || "")
+          .split(",")
+          .filter((ele) => {
+            return ele !== "";
+          })
+          .forEach((ele) => {
+            timeString += this.timeSelect[discountType][ele] + "、";
+          });
+      } else if (discountType == 3) {
+        timeString += row.discountDate.toString();
+      }
+
+      timeString = timeString.replace(/(、)$/g, "") + " 优惠:";
+      if (this.discountSetting == 3) {
+        timeString +=
+          "满" +
+          row.discountAmt +
+          (row.discountTerm == 2 ? "元" : "L") +
+          ",每升优惠" +
+          row.discountActivityAmt +
+          "元";
+      } else if (this.discountSetting == 1) {
+        timeString +=
+          "每满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
+      } else if (this.discountSetting == 2) {
+        timeString +=
+          "满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
+      }
+      return timeString;
+    },
+  },
+};
+</script>
+<style>
+</style>

+ 511 - 126
src/views/market/Market_Discount.vue

@@ -6,73 +6,101 @@
   </div>
   <div v-else-if="pageStatus == 3">加载发生错误</div>
   <div v-else-if="pageStatus == 4" class="app-container">
-    <el-form
-      ref="ruleForm"
-      :model="ruleForm"
-      :rules="rules"
-      label-width="130px"
-    >
-      <el-form-item label="当前执行优惠方案">
-        {{ currentDiscountName }}
-      </el-form-item>
-      <el-form-item label="优惠方案">
-        <el-select
-          v-model="ruleForm.discountSetting"
-          placeholder="请选择优惠方案"
-          clearable
-          size="small"
-          @change="discountSettingChang"
-        >
-          <el-option label="无" value="0"></el-option>
-          <el-option label="满减" value="1"></el-option>
-          <el-option label="立减" value="2"></el-option>
-          <el-option label="直降" value="3"></el-option>
-          <el-option label="阶梯直降" value="4"></el-option>
-        </el-select>
-        <el-button size="mini" @click="save" type="primary"
-          >确定执行该优惠方案</el-button
+    <div class="card mx-auto shadow" style="width: 310px">
+      <div class="card-body">
+        <el-form
+          ref="ruleForm"
+          :model="ruleForm"
+          :rules="rules"
+          label-width="80px"
         >
-      </el-form-item>
-    </el-form>
+          <el-form-item label="当前方案">
+            {{ currentDiscountName }}
+          </el-form-item>
+
+          <el-form-item label="变改方案">
+            <el-select
+              v-model="ruleForm.discountSetting"
+              placeholder="请选择优惠方案"
+              clearable
+              size="small"
+              style="width: 100px"
+              @change="discountSettingChang"
+            >
+              <el-option label="无" value="0"></el-option>
+              <el-option label="满减" value="1"></el-option>
+              <el-option label="立减" value="2"></el-option>
+              <el-option label="直降" value="3"></el-option>
+              <el-option label="阶梯直降" value="4"></el-option>
+            </el-select>
+            <button
+              href="#"
+              type="button"
+              @click="save"
+              class="btn btn-primary btn-sm ml-3 mb-1"
+            >
+              执行
+            </button>
+          </el-form-item>
+        </el-form>
+      </div>
+    </div>
 
     <hr />
     <el-dialog
       :visible.sync="openDialog"
-      width="600px"
+      width="520px"
       append-to-body
-      :title="['', '满减方案', '立减方案', '直降方案'][discountSetting]"
+      :title="
+        ['', '满减方案', '立减方案', '直降方案', '阶梯直降'][discountSetting]
+      "
     >
       <el-form
         ref="updateForm"
         :model="updateForm"
         :rules="rules"
-        label-width="140px"
+        label-width="170px"
       >
-        <el-form-item label="方案名称" prop="grade">
-          <el-input v-model="updateForm.grade" placeholder="请输入方案名称" />
+        <el-form-item label="方案名称" prop="grade" class="input-group-sm">
+          <input
+            v-model="updateForm.grade"
+            placeholder=""
+            class="form-control form-control-sm w-50"
+          />
         </el-form-item>
         <el-form-item label="油品名称" prop="oilName">
-          <el-select
+          <select
             v-model="updateForm.oilName"
-            placeholder="油品名称"
-            clearable
-            size="small"
+            class="form-control form-control-sm w-50"
+            :disabled="ladderUp"
           >
-            <el-option
+            <option
               v-for="dict in filterOilNameOptions"
               :key="dict.oilName"
-              :label="dict.oilName"
               :value="dict.oilName"
-            />
-          </el-select>
+            >
+              {{ dict.oilName }}
+            </option>
+          </select>
         </el-form-item>
-        <el-form-item label="优惠条件" prop="gasoilDiscountAmt" required>
+
+        <!-- 阶梯直降没有此规则 -->
+        <el-form-item
+          label="优惠条件"
+          prop="gasoilDiscountAmt"
+          :rules="{
+            required: discountSetting != 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting != 4"
+        >
           <el-radio-group
             v-model="updateForm.discountTerm"
             v-if="discountSetting == 3"
           >
-            <el-radio :label="2">按加油金额优惠</el-radio>
-            <el-radio :label="1">按加油升数优惠</el-radio>
+            <el-radio label="2">按加油金额</el-radio>
+            <el-radio label="1">按加油升数</el-radio>
           </el-radio-group>
           <div
             v-show="
@@ -83,37 +111,52 @@
             "
           >
             {{ ["", "每满", "满", "满"][discountSetting] }}
-            <el-input-number
+            <!-- <el-input-number
               v-model="updateForm.discountAmt"
               size="mini"
               :min="0"
+            /> -->
+            <input
+              v-model="updateForm.discountAmt"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
             />
 
             <span>{{
               updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
             }}</span>
             ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
-            <el-input-number
+            <!-- <el-input-number
               v-model="updateForm.gasoilDiscountAmt"
               size="mini"
               :min="0"
-            />元
+            /> -->
+            <input
+              v-model="updateForm.gasoilDiscountAmt"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
+            />
+            元
           </div>
         </el-form-item>
+
+        <!-- 阶梯直降没有此规则 -->
         <el-form-item
           label="会员日"
           prop="discountSettingFlag"
           :rules="{
-            required: true,
+            required: discountSetting != 4,
             message: '请选择是否开启会员日',
             trigger: 'change',
           }"
+          v-if="discountSetting != 4"
         >
           <el-radio-group v-model="updateForm.discountSettingFlag">
             <el-radio label="0">关闭</el-radio>
             <el-radio label="1">开启</el-radio>
           </el-radio-group>
         </el-form-item>
+
         <el-form-item
           label="会员日周期类型"
           prop="discountType"
@@ -124,16 +167,17 @@
             trigger: 'change',
           }"
         >
-          <el-select
+    
+          <select
             v-model="updateForm.discountType"
-            clearable
-            size="small"
+            class="form-control form-control-sm w-50"
             @change="timeClear"
           >
-            <el-option label="每周指定日" value="1"></el-option>
-            <el-option label="每月指定日" value="2"></el-option>
-            <el-option label="固定活动日" value="3"></el-option>
-          </el-select>
+            <option value="1">每周指定日</option>
+            <option value="2">每月指定日</option>
+            <option value="3">固定活动日</option>
+          </select>
+
           <div
             v-show="updateForm.discountType != 3"
             style="
@@ -174,11 +218,11 @@
               </div>
             </div>
           </div>
-          <div v-show="updateForm.discountType == 3">
+          <div v-show="updateForm.discountType == 3" >
             <el-date-picker
               clearable
               size="small"
-              style="margin-left: 10px; width: 200px"
+              style="margin-top:10px;width: 200px"
               v-model="updateForm.collectClickDay"
               type="dates"
               value-format="yyyy-MM-dd"
@@ -187,6 +231,7 @@
             </el-date-picker>
           </div>
         </el-form-item>
+
         <el-form-item
           label="会员日优惠条件"
           prop="discountActivityAmt"
@@ -199,63 +244,147 @@
         >
           <div>
             {{ ["", "每满", "满", "满"][discountSetting] }}
+            <!--
             <el-input-number
               v-model="updateForm.discountAmt"
               size="mini"
               :min="0"
               disabled
             />
+            -->
+            <input
+              v-model="updateForm.discountAmt"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
+              disabled
+            />
 
             <span>{{
               updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
             }}</span>
             ,{{ ["", "减", "减", "每升优惠"][discountSetting] }}
-            <el-input-number
+            <input
               v-model="updateForm.discountActivityAmt"
-              size="mini"
-              :min="0"
+              class="form-control form-control-sm"
+              style="width: 50px; display: inline-block"
             />元
           </div>
-          <!-- <el-input-number
-            v-model="updateForm.integralProportion"
-            :min="1"
-            placeholder="请输入加倍比例"
-            size="small"
-          />
-          <span>倍</span> -->
-          <!-- 满
-          <el-input-number
-            v-model="updateForm.discountAmt"
-            size="mini"
-            :min="0"
-            disabled
-          /><span>{{
-            updateForm.discountTerm == 1 && discountSetting == 3 ? "L" : "元"
-          }}</span
-          >,每升优惠<el-input-number
-            v-model="updateForm.discountActivityAmt"
-            size="mini"
-            :min="0"
-          />元 -->
         </el-form-item>
+
         <el-form-item label="叠加等级优惠" prop="vipDiscountyPlus">
           <el-radio-group v-model="updateForm.vipDiscountyPlus">
-            <el-radio label="1"></el-radio>
-            <el-radio label="0"></el-radio>
+            <el-radio label="1">叠加</el-radio>
+            <el-radio label="0">不叠加</el-radio>
           </el-radio-group>
-          <div style="margin-left: 20px; color: red">
+          <!--
+          <div style="margin-left: 20px; color: red; font-size: 12px">
             注:"否" 客户只享受 {{ discountName }} 优惠
           </div>
+          -->
         </el-form-item>
+
+        <!--
         <el-form-item label="可否叠加劵" prop="couponPlus">
           <el-radio-group v-model="updateForm.couponPlus">
             <el-radio label="1">是</el-radio>
             <el-radio label="0">否</el-radio>
           </el-radio-group>
-          <div style="margin-left: 20px; color: red">
+          <div style="margin-left: 20px; color: red; font-size: 12px">
             注:"否" 客户只享受 {{ discountName }} 优惠
           </div>
         </el-form-item>
+        -->
+
+        <!-- 只有阶梯直降有此规则 -->
+        <el-form-item
+          label="优惠条件"
+          prop="discountTerm"
+          :rules="{
+            required: discountSetting == 4,
+            message: '请填写优惠条件',
+            trigger: 'change',
+          }"
+          v-if="discountSetting == 4"
+        >
+          <el-radio-group v-model="updateForm.discountTerm">
+            <el-radio label="2">按加油金额</el-radio>
+            <el-radio label="1">按加油升数</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <!-- 只有阶梯直降有此规则 -->
+        <el-form-item
+          label="阶梯设置"
+          prop="list"
+
+          v-if="discountSetting == 4"
+        >
+          <el-button
+            icon="el-icon-plus"
+            size="mini"
+            class="mb-3 mr-4"
+            @click="addLadder"
+            type="secondary"
+          >
+            添加规则
+          </el-button>
+        </el-form-item>
+
+        <div
+          class="mx-auto mb-4 bg-light pt-4 pb-2 px-1 rounded"
+          style="width: 450px"
+          v-if="discountSetting == 4"
+        >
+          <div
+            class="input-group input-group-sm mb-4 mt-1"
+            v-for="(item, index) in updateForm.list"
+            :key="index"
+          >
+            <input
+              type="text"
+              class="form-control"
+              v-model="item.discountAmt"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">
+                {{
+                  updateForm.discountTerm == 1
+                    ? "升&lt;= 加油升数 &lt;"
+                    : "元&lt;= 加油金额 &lt;"
+                }}
+              </span>
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              v-model="item.discountAmtEnd"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text"
+                >{{
+                  updateForm.discountTerm == 1 ? "升" : "元"
+                }},每升优惠</span
+              >
+            </div>
+            <input
+              type="text"
+              class="form-control"
+              v-model="item.gasoilDiscountAmt"
+            />
+            <div class="input-group-append">
+              <span class="input-group-text">元</span>
+            </div>
+            <div class="input-group-append" id="button-addon4">
+              <button
+                class="btn btn-danger"
+                type="button"
+                @click="delLadder(index)"
+              >
+                删除
+              </button>
+            </div>
+          </div>
+        </div>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="handleSubmit">确 定</el-button>
@@ -269,11 +398,12 @@
       :inline="true"
       label-width="68px"
       v-show="discountSetting != 0"
+      class="mx-auto"
     >
       <div>
         <el-button
           icon="el-icon-plus"
-          size="small"
+          size="mini"
           class="mb-3 mr-4"
           @click="handleUpdateClick"
           style="float: right"
@@ -281,17 +411,23 @@
         >
           {{
             this.discountSetting == 1
-              ? "添加满减方案条目"
+              ? "添加满减方案规则"
               : this.discountSetting == 2
-              ? "添加立减方案条目"
+              ? "添加立减方案规则"
               : this.discountSetting == 3
-              ? "添加直降方案条目"
+              ? "添加直降方案规则"
+              : this.discountSetting == 4
+              ? "添加阶梯直降规则"
               : "无"
           }}
         </el-button>
       </div>
     </el-form>
-    <el-table :data="discountList" v-show="discountSetting != 0">
+    <el-table
+      :data="discountList"
+      v-show="discountSetting != 0 && discountSetting != 4"
+      class="shadow"
+    >
       <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" />
@@ -329,13 +465,12 @@
       <af-table-column
         label="会员日"
         align="center"
+        v-if="discountSetting != 4"
       >
         <template slot-scope="scope">
-          <span v-if="scope.row.discountSettingFlag == 0">
-            无活动
-          </span>
+          <span v-if="scope.row.discountSettingFlag == 0"> 无活动 </span>
           <span v-else-if="scope.row.discountSettingFlag == 1">
-            {{discountSettingTranslate(scope.row)}}
+            {{ discountSettingTranslate(scope.row) }}
           </span>
         </template>
       </af-table-column>
@@ -345,12 +480,109 @@
         prop="vipDiscountyPlus"
         :formatter="vipDiscountyPlusFotmat"
       />
+      <!--
+      <af-table-column
+        label="叠加劵"
+        align="center"
+        prop="couponPlus"
+        :formatter="couponPlusFotmat"
+      />
+      -->
+      <af-table-column
+        label="优惠方案类型"
+        v-if="false"
+        align="center"
+        prop="discountPlanType"
+      />
+      <af-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            >删除</el-button
+          >
+        </template>
+      </af-table-column>
+    </el-table>
+    <el-table
+      :data="discountListTep"
+      v-show="discountSetting == 4"
+      type="expand"
+      class="shadow"
+    >
+      <af-table-column type="expand">
+        <template slot-scope="props">
+          <div class="container">
+            <div class="row">
+              <div
+              class="input-group input-group-sm mb-4 mt-1 col-lg-6"
+              v-for="(item, index) in props.row.list"
+              :key="index"
+              style="width:600px;"
+            >
+              <div class="input-group-append">
+                <span class="input-group-text"> 规则 {{index + 1}}: </span>
+              </div>
+              <input
+                type="text"
+                class="form-control"
+                v-model="item.discountAmt"
+                disabled
+                
+              />
+              <div class="input-group-append">
+                <span class="input-group-text"> {{updateForm.discountTerm==1 ? '升&lt;= 加油升数 &lt;': "元&lt;= 加油金额 &lt;"}}  </span>
+              </div>
+              <input
+                type="text"
+                class="form-control"
+                v-model="item.discountAmtEnd"
+                disabled
+              />
+              <div class="input-group-append">
+                <span class="input-group-text">{{updateForm.discountTerm==1 ? '升,':'元,'}}</span>
+              </div>
+              <div class="input-group-append">
+                <span class="input-group-text">每升优惠</span>
+              </div>
+              <input
+                type="text"
+                class="form-control"
+                v-model="item.gasoilDiscountAmt"
+                disabled
+              />
+              <div class="input-group-append">
+                <span class="input-group-text">元</span>
+              </div>
+              <div class="input-group-append" id="button-addon4">
+              </div>
+            </div>
+            </div>
+          </div>
+        </template>
+      </af-table-column>
+      <af-table-column label="方案名称" align="center" prop="grade" />
+      <af-table-column label="油品名称" align="center" prop="oilName" />
+      <af-table-column
+        label="叠加等级优惠"
+        align="center"
+        prop="vipDiscountyPlus"
+        :formatter="vipDiscountyPlusFotmat"
+      />
+      <!--
       <af-table-column
         label="叠加劵"
         align="center"
         prop="couponPlus"
         :formatter="couponPlusFotmat"
       />
+      -->
       <af-table-column
         label="优惠方案类型"
         v-if="false"
@@ -361,20 +593,21 @@
         label="操作"
         align="center"
         class-name="small-padding fixed-width"
+        width="200px"
       >
         <template slot-scope="scope">
-          <!-- <el-button
+          <el-button
             size="mini"
             type="text"
             icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            >修改</el-button
-          > -->
+            @click="handleLadderUpdata(scope.row)"
+            >修改规则</el-button
+          >
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
+            @click="handleDeleteLadder(scope.row)"
             >删除</el-button
           >
         </template>
@@ -391,6 +624,8 @@ import {
   addPlan,
   updatePlan,
   exportPlan,
+  addMarketPlanInfo,
+  deleteMarketPlan
 } from "@/api/market/plan";
 import { getStationPay, updatePay } from "@/api/station/pay";
 import { getDept } from "@/api/system/dept";
@@ -416,8 +651,46 @@ export default {
       }
       callback();
     };
+    const validatorLadderList = (rule, value, callback) => {
+      if (this.discountSetting != 4) {
+        return 
+      }
+
+      if(this.updateForm.list.length < 1 || !this.updateForm.list){
+        callback(new Error("请设置优惠的阶梯"));
+        return;
+      }
+      this.updateForm.list.map((ele)=>{
+        if(ele.discountAmt == '' || ele.discountAmt == null || ele.discountAmtEnd == '' || ele.discountAmtEnd == null || ele.gasoilDiscountAmt == '' || ele.gasoilDiscountAmt == null){
+          callback(new Error("请检查阶梯填入信息的完整性"));
+          return;
+        }
+        if(isNaN(+ele.discountAmtEnd) || isNaN(+ele.discountAmt) || isNaN(+ele.gasoilDiscountAmt)){
+          callback(new Error("请检查拼写,规则填入的必须是有效数字"));
+          return;
+        }
+        if((+ele.discountAmtEnd) <= (+ele.discountAmt)){
+          callback(new Error("您填写的一条规则里,起始值比结束值大"));
+          return;
+        }
+      })
+      const sortList = JSON.parse(JSON.stringify(this.updateForm.list))
+      const sortedList = sortList.sort((q,w)=>{
+        return q.discountAmt - w.discountAmt
+      })
+      
+      sortedList.reduce((prev, curr, ind, arr)=>{
+        if(prev.discountAmtEnd > curr.discountAmt){
+          callback(new Error("您填写的规则起始值存在冲突,请检查"));
+          return;
+        }
+        return curr
+      })
+      callback();
+    };
 
     return {
+      testd: 1,
       pageStatus: 0,
       discountList: [],
       total: 0,
@@ -466,15 +739,18 @@ export default {
             trigger: "change",
           },
         ],
-        couponPlus: [
-          { required: true, message: "选择可否叠加券", trigger: "change" },
-        ],
+        // couponPlus: [
+        //   { required: true, message: "选择可否叠加券", trigger: "change" },
+        // ],
+        list:[
+          { validator: validatorLadderList, trigger: "change" },
+        ]
       },
       dtrules: {},
       discountSetting: 0,
       updateForm: {
         collectClickCalendar: [],
-        collectClickDay: '',
+        collectClickDay: [],
       },
       currentDiscountName: "",
       timeSelect: [
@@ -514,6 +790,9 @@ export default {
           "31",
         ],
       ],
+      discountListTep: [
+      ],
+      ladderUp:false,
     };
   },
   computed: {
@@ -524,6 +803,8 @@ export default {
         ? "立减"
         : this.discountSetting == 3
         ? "直降"
+        : this.discountSetting == 4
+        ? "阶梯直降"
         : "无";
     },
     filterOilNameOptions() {
@@ -536,13 +817,43 @@ export default {
         });
         return flag;
       });
-    }
+    },
   },
   created() {
     this.setPageStatus();
     this.init();
   },
   methods: {
+    handleLadderUpdata(row){
+      this.updateForm = row
+      this.ladderUp = true;
+      this.openDialog = true;
+    },
+    delLadder(index) {
+      this.updateForm.list.splice(index, 1);
+      if (this.updateForm.list < 1) {
+        this.updateForm.list.push({
+          discountAmtEnd: null,
+          discountAmt: null,
+          gasoilDiscountAmt: null,
+        });
+        this.updateForm = { ...this.updateForm };
+      }
+    },
+    addLadder(e) {
+      this.updateForm.list.push({
+        discountAmtEnd: null,
+        discountAmt: null,
+        gasoilDiscountAmt: null,
+      });
+      this.updateForm = { ...this.updateForm };
+    },
+    test(e) {
+      console.log("---");
+      console.log(e);
+      console.log(123);
+      console.log(this.testd);
+    },
     init() {
       listPrice().then((response) => {
         this.oilNameOptions = response.rows;
@@ -571,7 +882,7 @@ export default {
       this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
           if (this.ruleForm.deptId != null) {
-            let upPromise = null
+            let upPromise = null;
             let e = this.ruleForm.discountSetting;
             if (e == "0") {
               upPromise = updatePay(this.ruleForm).then((response) => {
@@ -604,21 +915,30 @@ export default {
                 this.msgError("直降规则下无方案");
                 return;
               }
+            } else if (e == "4") {
+              if (this.discountList.length > 0) {
+                upPromise = updatePay(this.ruleForm).then((response) => {
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              } else {
+                this.msgError("直降规则下无方案");
+                return;
+              }
             }
-            upPromise.catch((err)=>{
-              this.msgError("设置时出错,请刷新后重试~")
-            }).then((res) => {
-              this.getPay();
-            })
-          }else{
+            upPromise
+              .catch((err) => {
+                this.msgError("设置时出错,请刷新后重试~");
+              })
+              .then((res) => {
+                this.getPay();
+              });
+          } else {
             this.getPay();
           }
-          
         }
       });
     },
     discountSettingChang(e) {
-      console.log(e)
       this.discountSetting = e;
       this.getList();
     },
@@ -629,6 +949,10 @@ export default {
         discountPlanType: this.discountSetting,
       };
       listPlan(query).then((response) => {
+        if (this.discountSetting == 4) {
+          this.discountListTep = response.rows;
+          return;
+        }
         this.discountList = response.rows;
         this.total = response.total;
       });
@@ -649,14 +973,30 @@ export default {
     },
     handleUpdateClick() {
       this.openDialog = true;
+      this.ladderUp = false;
       this.updateForm = {
         discountPlanType: this.discountSetting,
+        collectClickDay:[],
+        collectClickCalendar:[]
       };
+      if (this.discountSetting == 4) {
+        this.updateForm.list = [
+          {
+            discountAmtEnd: null,
+            discountAmt: null,
+            gasoilDiscountAmt: null,
+          },
+        ];
+      }
     },
     handleSubmit() {
       this.$refs["updateForm"].validate((valid) => {
         if (valid) {
-          if(this.updateForm.discountSettingFlag == "1") {
+          // 会员日特殊处理
+          if (
+            this.updateForm.discountSettingFlag == "1" &&
+            this.discountSetting != "4"
+          ) {
             if (
               this.updateForm.discountType == "1" ||
               this.updateForm.discountType == "2"
@@ -668,6 +1008,19 @@ export default {
                 this.updateForm.collectClickDay.toString();
             }
           }
+          console.log("发送了1");
+          // 阶梯直降
+          if (this.discountSetting == "4") {
+            console.log("发送了2");
+            addMarketPlanInfo(this.updateForm)
+              .then((res) => {
+                this.msgSuccess("新增成功");
+                this.openDialog = false;
+                this.getList();
+                return ;
+              });
+              return ;
+          }
           if (this.updateForm.id != null) {
             updatePlan(this.updateForm).then((response) => {
               this.msgSuccess("修改成功");
@@ -676,7 +1029,11 @@ export default {
             });
           } else {
             addPlan(this.updateForm).then((response) => {
-              this.msgSuccess("新增成功");
+              if(this.ladderUp){
+                this.msgSuccess("修改成功");
+              }else{
+                this.msgSuccess("新增成功");
+              }
               this.openDialog = false;
               this.getList();
             });
@@ -723,6 +1080,24 @@ export default {
           this.msgSuccess("删除成功");
         });
     },
+    handleDeleteLadder(row){
+      const oilName = row.oilName;
+      this.$confirm("是否确认该油品的阶梯直降?", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          return deleteMarketPlan({
+            oilName: oilName,
+            discountPlanType:"4"
+          });
+        })
+        .then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        });
+    },
     // /** 导出按钮操作 */
     // handleExport() {
     //   const queryParams = this.queryParams;
@@ -749,7 +1124,6 @@ export default {
       let timeString = "";
       const discountType = row.discountType;
 
-
       if (discountType == 1) {
         timeString += "每周的";
       }
@@ -760,22 +1134,33 @@ export default {
         timeString += "指定的日期 ";
       }
       if (discountType == 1 || discountType == 2) {
-        (row.discountDate||'').split(',').filter((ele)=>{
-          return ele !== ''
-        }).forEach((ele) => {
-          timeString += this.timeSelect[discountType][ele] + "、";
-        });
+        (row.discountDate || "")
+          .split(",")
+          .filter((ele) => {
+            return ele !== "";
+          })
+          .forEach((ele) => {
+            timeString += this.timeSelect[discountType][ele] + "、";
+          });
       } else if (discountType == 3) {
         timeString += row.discountDate.toString();
       }
 
       timeString = timeString.replace(/(、)$/g, "") + " 优惠:";
-      if(this.discountSetting == 3){
-        timeString +=  '满' +  row.discountAmt + (row.discountTerm == 2 ? "元" : "L" ) + ',每升优惠' + row.discountActivityAmt + '元'
-      }else if(this.discountSetting == 1){
-        timeString += '每满' + row.discountAmt + '元,减' + row.discountActivityAmt + '元'
-      }else if(this.discountSetting == 2){
-        timeString += '满' + row.discountAmt + '元,减' + row.discountActivityAmt + '元'
+      if (this.discountSetting == 3) {
+        timeString +=
+          "满" +
+          row.discountAmt +
+          (row.discountTerm == 2 ? "元" : "L") +
+          ",每升优惠" +
+          row.discountActivityAmt +
+          "元";
+      } else if (this.discountSetting == 1) {
+        timeString +=
+          "每满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
+      } else if (this.discountSetting == 2) {
+        timeString +=
+          "满" + row.discountAmt + "元,减" + row.discountActivityAmt + "元";
       }
       return timeString;
     },