su
su1124
2023-12-29 d10c7c728234b5a9098b7bd5bb7a914a14e33c20
src/views/system/package/index.vue
@@ -26,19 +26,19 @@
      </el-form-item>
      <el-form-item label="套餐分类" prop="categoryId">
        <el-select
            v-model="queryParams.categoryId"
            placeholder="请选择状态"
            style="width: 200px"
            filterable
            clearable
          >
            <el-option
              v-for="dict in categoryList"
              :key="dict.id"
              :label="dict.name"
              :value="dict.id"
            ></el-option>
          </el-select>
          v-model="queryParams.categoryId"
          placeholder="请选择状态"
          style="width: 200px"
          filterable
          clearable
        >
          <el-option
            v-for="dict in categoryList"
            :key="dict.id"
            :label="dict.name"
            :value="dict.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button
@@ -130,6 +130,13 @@
          fixed
        />
        <!-- <el-table-column label="编号" align="center" prop="pacId" /> -->
         <el-table-column
          label="套餐分类"
          width="100px"
          align="center"
          prop="categoryNames"
          fixed
        ></el-table-column>
        <el-table-column
          label="套餐名称"
          align="center"
@@ -137,6 +144,8 @@
          width="150px"
          fixed
        />
        <el-table-column label="价格" width="80px" align="center" prop="price" fixed>
        </el-table-column>
        <el-table-column
          label="单项列表"
          align="center"
@@ -172,15 +181,9 @@
            <image-preview :src="scope.row.pacPhone" :width="50" :height="50" />
          </template>
        </el-table-column> -->
        <el-table-column label="价格" width="80px" align="center" prop="price">
        </el-table-column>
        <el-table-column
          label="套餐分类"
          width="100px"
          align="center"
          prop="categoryNames"
        ></el-table-column>
        <el-table-column
          label="关键字"
          width="110px"
@@ -193,8 +196,11 @@
          align="center"
          prop="isOnSale"
        >
        <template slot-scope="scope">
            <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isOnSale"/>
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_yes_no"
              :value="scope.row.isOnSale"
            />
          </template>
        </el-table-column>
        <!-- <el-table-column
@@ -304,6 +310,13 @@
        <!-- <div class="dialo">
        <div class="dialo1"> -->
        <el-form-item label="套餐名称" prop="pacName">
          <span
            slot="label"
            style="display: inline-block; border-bottom: 2px solid blue"
            @click="handlePackage"
          >
            套餐名称
          </span>
          <el-input
            v-model="form.pacName"
            placeholder="请输入套餐名称"
@@ -331,7 +344,7 @@
          </el-select>
        </el-form-item>
        <el-form-item label="商品类目" prop="categoryId">
        <el-form-item label="套餐类目" prop="categoryId">
          <!-- <el-input
            v-model="form.createId"
            placeholder="请输入商品类目"
@@ -339,7 +352,7 @@
          /> -->
          <el-select
            v-model="form.categoryId"
            placeholder="请选择商品类目"
            placeholder="请选择套餐类目"
            style="width: 200px"
            @change="shangpin"
            filterable
@@ -353,7 +366,6 @@
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="关键字" prop="keywords">
          <el-select
@@ -393,7 +405,7 @@
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="排序" prop="sort">
          <el-input
            v-model="form.sort"
@@ -558,10 +570,12 @@
        </div>
      </template>
    </el-dialog> -->
    <Packages ref="aaa" @add="handleChanges" />
  </div>
</template>
<script>
import Packages from "@/components/Packages";
import { listCategory } from "@/api/mall/category";
import { listKeyword } from "@/api/mall/keyword";
import {
@@ -579,11 +593,24 @@
export default {
  name: "Package",
  dicts: ["sys_normal_disable", "sys_yes_no"],
  components: { Packages },
  data() {
    let checkPhoneNum = (rule, value, callback) => {
      console.log(value);
      let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/);
      if (value == "" && value == undefined && !value) {
        return callback("");
      } else if (value != undefined && value != "") {
        return callback();
      } else if (!patter.test(value)) {
        return callback("");
      }
    };
    return {
      categoryList:[],
      keys:"",
      categoryList: [],
      keys: "",
      keywordList: [],
      dataListAll: [],
      // 多选框
      priceNow: "",
      checkAll: false,
@@ -629,7 +656,29 @@
      // 表单校验
      rules: {
        deleted: [
          { required: true, message: "$comment不能为空", trigger: "blur" },
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
        pacName: [
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
        pacStatus: [
          { required: true, validator: checkPhoneNum, trigger: "change" },
        ],
        // categoryId: [
        //   { required: true, validator: checkPhoneNum, trigger: "change" },
        // ],
        keywords: [
          { required: true, validator: checkPhoneNum, trigger: "change" },
        ],
        isOnSale: [
          { required: true, validator: checkPhoneNum, trigger: "change" },
        ],
        sort: [{ required: true, validator: checkPhoneNum, trigger: "blur" }],
        retailPrice: [
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
        counterPrice: [
          { required: true, validator: checkPhoneNum, trigger: "blur" },
        ],
      },
    };
@@ -663,10 +712,10 @@
      });
    },
    sel(val) {
      let id = val
      let id = val;
      this.keys = "";
      id.forEach((item) => {
        this.keys += item + ","
        this.keys += item + ",";
      });
    },
    /** 查询类目列表 */
@@ -676,7 +725,7 @@
        this.categoryList = response.rows;
      });
    },
    shangpin(vals){
    shangpin(vals) {
      console.log(vals);
    },
    // 取消按钮
@@ -709,6 +758,20 @@
      this.queryParams.pageNum = 1;
      this.getList();
    },
    handlePackage() {
      this.$refs.aaa.open = true;
      this.$refs.aaa.getList();
      this.$refs.aaa.title = "套餐字典";
    },
    handleChanges(param1) {
      this.form.pacName = param1[0].pacName;
      this.form.hisPacId = param1[0].pacId;
      if (param1[0].price) {
        this.form.counterPrice = param1[0].price;
        this.form.retailPrice = param1[0].price;
      }
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
@@ -729,15 +792,15 @@
      this.reset();
      this.open = true;
      this.title = "体检套餐信息维护";
      getAllList().then((response) => {
        this.allList = response.data;
        if (this.allList.proStatus === 0) {
          this.allList.proStatus = "启用";
        } else {
          this.allList.proStatus = "停用";
        }
        this.loading = false;
      });
      // getAllList().then((response) => {
      //   this.allList = response.data;
      //   if (this.allList.proStatus === 0) {
      //     this.allList.proStatus = "启用";
      //   } else {
      //     this.allList.proStatus = "停用";
      //   }
      //   this.loading = false;
      // });
      // if (!this.form.tjProjectList) {
      //     this.form.tjProjectList = []
      //     this.form.tjProjectList.push({
@@ -754,11 +817,10 @@
    // 是否启用
    handleStatusChange(row) {
      let data = {
        pacId:row.pacId,
        pacStatus:row.pacStatus,
      }
        pacId: row.pacId,
        pacStatus: row.pacStatus,
      };
      let text = row.pacStatus === "0" ? "启用" : "停用";
      this.$confirm("确认要" + text + row.pacName + "套餐吗?")
        .then(function () {
@@ -800,6 +862,16 @@
    // 新增行
    addmembers() {
      if (this.form.pacName) {
        this.loading = true;
        getAllList().then((response) => {
          this.allList = response.data;
          if (this.allList.proStatus === 0) {
            this.allList.proStatus = "启用";
          } else {
            this.allList.proStatus = "停用";
          }
          this.loading = false;
        });
        if (!this.form.tjProjectList) {
          this.form.tjProjectList = [];
          this.form.tjProjectList.push({
@@ -859,6 +931,20 @@
          });
        }
      });
      for (let i = 0; i < this.form.tjProjectList.length; i++) {
        for (let j = i + 1; j < this.form.tjProjectList.length; j++) {
          if (
            this.form.tjProjectList[i].proId == this.form.tjProjectList[j].proId
          ) {
            this.form.tjProjectList.splice(j, 1);
            j--;
            this.$modal.msgError("此项目已录入,不可重复录入");
          }
        }
      }
      return this.form.tjProjectList;
    },
    /** 提交按钮 */
    submitForm() {
@@ -1004,14 +1090,17 @@
  display: flex;
  justify-content: center;
}
.pag1 {
  width: 30%;
}
.dialog-footer {
  position: absolute;
  left: 40%;
  bottom: 2%;
}
/* .dialo{
  display: flex;
  flex-direction: row;