瀏覽代碼

客户存货分类页面更改

chen 3 年之前
父節點
當前提交
9eb75b4c7b

+ 40 - 0
src/api/basic_data/dealer.js

@@ -98,4 +98,44 @@ export function getDictionaries(params) {
     method: 'get',
     params
   })
+}
+//产品品类列表
+export function getProductCategoryList(params) {
+  return request({
+    url: '/product-category/list',
+    method: 'get',
+    params
+  })
+}
+//根据父级查询部门
+export function getAdminWebsitByparent(params) {
+  return request({
+    url: '/admin/websit/byparent',
+    method: 'get',
+    params
+  })
+}
+//帐号列表
+export function getAdminUserList(params) {
+  return request({
+    url: '/admin/user/list',
+    method: 'get',
+    params
+  })
+}
+//经销商客户存货分类-详情
+export function getCustomerPtDetail(params) {
+  return request({
+    url: '/customer/pt/detail',
+    method: 'get',
+    params
+  })
+}
+//修改经销商客户存货分类
+export function getCustomerPtUpdate(data) {
+  return request({
+    url: '/customer/pt/update',
+    method: 'post',
+    data
+  })
 }

+ 24 - 15
src/views/basic_data/dealer/dealer_deposit.vue

@@ -216,7 +216,6 @@
         <el-form-item label="押金比例" prop="rate">
           <el-input
             placeholder="请输入押金比例"
-            @focus="rateFn"
             v-model.number="dialogForm.rate"
             class="inputStyle"
           >
@@ -235,7 +234,6 @@
         <el-form-item label="押金定额金额" prop="amount">
           <el-input
             placeholder="请输入押金定额"
-            @focus="amountFn"
             v-model.number="dialogForm.amount"
             class="inputStyle"
           ></el-input>
@@ -315,13 +313,13 @@ export default {
         customerName: "",
       },
       dialogForm: {
-        amount: "",
+        amount: 0,
         customerId: "",
         customerName: "",
         customerNumber: "",
         endTime: "",
 
-        rate: "",
+        rate: 0,
         remark: "",
         startTime: "",
       },
@@ -332,7 +330,7 @@ export default {
             message: "请输入0-100的数字",
             trigger: "blur",
             type: "number",
-            required: true,
+            required: false,
           },
           // {
           //   validator: rate,
@@ -344,7 +342,7 @@ export default {
             trigger: "blur",
             message: "请输入定额押金",
             type: "number",
-            required: true,
+            required: false,
           },
           // {
           //   validator: amount,
@@ -382,19 +380,30 @@ export default {
     await this.getList({ pageNum: 1, pageSize: 10 });
     await this.getDealerDataList({ pageNum: 1, pageSize: -1 });
   },
-
-  methods: {
-    //押金
-    amountFn(e) {
-      if (this.dialogForm.rate != 0 || this.dialogForm.rate != "") {
-        this.$message.warning("已选押金比例,如需选择定额押金,请把押金比例归零");
+  watch: {
+    "dialogForm.amount": function (newValue, oldValue) {
+      if (this.dialogForm.amount !== 0) {
+        this.dialogForm.rate = 0;
       }
     },
-    rateFn(e) {
-      if (this.dialogForm.amount != 0 || this.dialogForm.amount != "") {
-        this.$message.warning("已选定额押金,如需选择押金比例,请把定额押金归零");
+    "dialogForm.rate": function (newValue, oldValue) {
+      if (this.dialogForm.rate !== 0) {
+        this.dialogForm.amount = 0;
       }
     },
+  },
+  methods: {
+    // //押金
+    // amountFn(e) {
+    //   if (this.dialogForm.rate != 0 || this.dialogForm.rate != "") {
+    //     this.$message.warning("已选押金比例,如需选择定额押金,请把押金比例归零");
+    //   }
+    // },
+    // rateFn(e) {
+    //   if (this.dialogForm.amount != 0 || this.dialogForm.amount != "") {
+    //     this.$message.warning("已选定额押金,如需选择押金比例,请把定额押金归零");
+    //   }
+    // },
     //取消
     async cancelFn() {
       this.dialogForm = {

+ 212 - 60
src/views/basic_data/dealer/dealer_stock.vue

@@ -18,24 +18,8 @@
               ></el-input>
             </el-form-item>
           </el-col>
-          <el-col :xs="24" :sm="12" :lg="6">
-            <el-form-item label="存货分类编码" prop="bianMa">
-              <el-input
-                v-model="searchForm.mainId"
-                placeholder="请输入"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="24" :sm="12" :lg="6">
-            <el-form-item label="存货分类" prop="mainName">
-              <el-input
-                v-model="searchForm.mainName"
-                placeholder="请输入"
-              ></el-input>
-            </el-form-item>
-          </el-col>
 
-          <el-col :xs="24" :sm="12" :lg="6">
+          <el-col :xs="24" :sm="12" :lg="18">
             <el-form-item label="" class="fr">
               <el-button size="small" @click="clearFn">清空</el-button>
               <el-button size="small" type="primary" @click="searchFn"
@@ -87,6 +71,13 @@
           ></el-table-column>
           <el-table-column
             align="center"
+            label="经销商编码"
+            prop="customerNumber"
+            min-width="160"
+            show-overflow-tooltip
+          ></el-table-column>
+          <el-table-column
+            align="center"
             label="经销商名称"
             prop="customerName"
             min-width="160"
@@ -94,15 +85,15 @@
           ></el-table-column>
           <el-table-column
             align="center"
-            label="存货分类编码"
-            prop="mainId"
+            label="产品大类(钱包)"
+            prop="mainName"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
           <el-table-column
             align="center"
-            label="存货分类名称"
-            prop="mainName"
+            label="业务员"
+            prop="serviceName"
             min-width="160"
             show-overflow-tooltip
           ></el-table-column>
@@ -142,6 +133,12 @@
             show-overflow-tooltip
           >
             <template slot-scope="scope">
+              <el-button
+                type="text"
+                class="textColor"
+                @click="editFn(scope.row.id)"
+                >编辑</el-button
+              >
               <el-popconfirm
                 @onConfirm="deleFn(scope.row.id)"
                 title="这是一段内容确定删除吗?"
@@ -171,7 +168,7 @@
 
     <!-- 弹窗 -->
     <el-dialog
-      title="编辑"
+      :title="title"
       :visible.sync="dialogForm"
       width="30%"
       :show-close="false"
@@ -199,17 +196,77 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="存货分类" prop="mainId">
+        <el-form-item label="产品大类" prop="mainId">
           <el-select
             class="selectStyle"
             v-model="addForm.mainId"
+            placeholder="名称"
+          >
+            <el-option
+              v-for="item in categoryList"
+              :key="item.productCategoryId"
+              :label="item.productCategoryName"
+              :value="item.productCategoryId"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="一级区域" prop="oneParentId">
+          <el-select
+            class="selectStyle"
+            v-model="addForm.oneParentId"
+            placeholder="名称"
+          >
+            <el-option
+              v-for="item in oneList"
+              :key="item.adminWebsitId"
+              :label="item.name"
+              :value="item.adminWebsitId"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="二级区域" prop="twoParentId">
+          <el-select
+            class="selectStyle"
+            v-model="addForm.twoParentId"
+            placeholder="名称"
+          >
+            <el-option
+              v-for="item in twoList"
+              :key="item.adminWebsitId"
+              :label="item.name"
+              :value="item.adminWebsitId"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="三级区域" prop="threeParentId"
+          ><el-select
+            class="selectStyle"
+            v-model="addForm.threeParentId"
+            placeholder="名称"
+          >
+            <el-option
+              v-for="item in threeList"
+              :key="item.adminWebsitId"
+              :label="item.name"
+              :value="item.adminWebsitId"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="对应业务员" prop="serviceId">
+          <el-select
+            class="selectStyle"
+            v-model="addForm.serviceId"
             placeholder="请选择"
           >
             <el-option
-              v-for="item in selectList"
-              :key="item.value"
-              :label="item.dictValue"
-              :value="item.sysDictId"
+              v-for="(item, i) in userList"
+              :key="i"
+              :label="item.nickName"
+              :value="item.adminUserId"
             >
             </el-option>
           </el-select>
@@ -229,28 +286,35 @@ import {
   getDealerStockAdd,
   deleDealerStockList,
   getDictionaries,
+  getProductCategoryList,
+  getAdminWebsitByparent,
+  getAdminUserList,
+  getCustomerPtDetail,
+  getCustomerPtUpdate,
 } from "@/api/basic_data/dealer";
 import { getDealerList } from "@/api/basic_data/dealer";
 
 export default {
   data() {
     return {
+      title: "",
       dialogForm: false,
       addForm: {
-        customerName: "",
         customerId: "",
-        customerNumber: "",
+        oneParentId: "",
+        twoParentId: "",
+        threeParentId: "",
+        serviceId: "",
         mainId: "",
-        mainName: "",
-      },
-      rules: {
-        mainId: [
-          { required: true, message: "请选择存货分类", trigger: "change" },
-        ],
-        customerId: [
-          { required: true, message: "请选择经销商", trigger: "change" },
-        ],
       },
+      // rules: {
+      //   mainId: [
+      //     { required: true, message: "请选择存货分类", trigger: "change" },
+      //   ],
+      //   customerId: [
+      //     { required: true, message: "请选择经销商", trigger: "change" },
+      //   ],
+      // },
 
       currentPage: 1, // 当前页码
       pageSize: 10, // 每页数量
@@ -258,23 +322,83 @@ export default {
 
       searchForm: {
         customerName: "",
-        mainId: "",
-        mainName: "",
       },
       dataList: [], // 列表数据
       listLoading: false, // 列表加载loading
       dealerList: [],
       selectList: [],
+      categoryList: [], //产品大类列表
+      oneList: [], //一级区域数据
+      twoList: [], //二级区域数据
+      threeList: [], //三级区域数据
+      userList: [], //业务员
       ids: [],
     };
   },
   async created() {
     this.getList({ pageNum: 1, pageSize: 10 });
-    this.getDealerDataList({ pageNum: 1, pageSize: 10 });
+    this.getDealerDataList({ pageNum: -1, pageSize: 10 });
     this.getSelectList({ sysDictEnum: "PRODUCT_TYPE" });
+    this.getCategoryList();
+    this.getAdminWebsit(1);
   },
   computed: {},
+  watch: {
+    "addForm.oneParentId": async function (newValue) {
+      if (newValue) {
+        let res = await getAdminWebsitByparent({ parentId: newValue });
+        this.twoList = res.data;
+      }
+    },
+    "addForm.twoParentId": async function (newValue) {
+      if (newValue) {
+        let res = await getAdminWebsitByparent({ parentId: newValue });
+        this.threeList = res.data;
+      }
+    },
+    "addForm.threeParentId": async function (newValue) {
+      if (newValue) {
+        let res = await getAdminUserList({
+          pageNum: 1,
+          pageSize: 10,
+          isCustomer: 0,
+          adminWebsitId: newValue,
+        });
+        this.userList = res.data.records;
+      }
+    },
+  },
   methods: {
+    //编辑
+
+    async editFn(id) {
+      this.title = "编辑";
+      let res = await getCustomerPtDetail({ id });
+      console.log(res);
+      this.addForm.customerId = res.data.customerId;
+      this.addForm.mainId = res.data.mainId;
+      this.addForm.oneParentId = res.data.adminWebsitId1;
+      this.addForm.twoParentId = res.data.adminWebsitId2;
+      this.addForm.threeParentId = res.data.adminWebsitId3;
+      this.addForm.serviceId = res.data.serviceId;
+
+      this.dialogForm = true;
+    },
+    //获取业务员数据
+    async getUserList() {
+      // await getAdminUserList({ pageNum: 1 });
+    },
+    //根据父级查询部门
+    async getAdminWebsit(data) {
+      let res = await getAdminWebsitByparent({ parentId: data });
+      this.oneList = res.data;
+    },
+    //获取产品品类数据
+    async getCategoryList() {
+      let res = await getProductCategoryList();
+      console.log(res);
+      this.categoryList = res.data;
+    },
     // 筛选部分数据或者单个
     hanleSelect(selection) {
       // this.ids = selection.map((k) => {
@@ -293,40 +417,69 @@ export default {
     async deleFn(id) {
       this.ids.push(id);
       let res = this.ids.toString();
-
       await deleDealerStockList({ ids: res });
       this.getList({ pageNum: 1, pageSize: 10 });
       this.$message.success("删除成功");
     },
     addFn() {
+      this.title = "新增";
       this.dialogForm = true;
     },
     async addDataListFn() {
-      await this.$refs.addForm.validate();
-
+      // await this.$refs.addForm.validate();
       // let id = this.dealerList.filter((i) => {
       //   return i.id === this.addForm.customerId;
       // })[0];
       // console.log(id, "id");
       // let res = findElem(this.dealerList, "id", this.addForm.customerId);
       // console.log(11111, res);
-      let res = this.dealerList.filter(
-        (v) => v.id === this.addForm.customerId
-      )[0];
-      console.log(res);
-      this.addForm.customerName = res.name;
-      this.addForm.customerNumber = res.number;
-      let res2 = this.selectList.filter(
-        (v) => v.sysDictId === this.addForm.mainId
-      )[0];
-      console.log(res2);
-      this.addForm.mainName = res2.dictValue;
+      // let res = this.dealerList.filter(
+      //   (v) => v.id === this.addForm.customerId
+      // )[0];
+      // console.log(res);
+      // this.addForm.customerName = res.name;
+      // this.addForm.customerNumber = res.number;
+      // let res2 = this.selectList.filter(
+      //   (v) => v.sysDictId === this.addForm.mainId
+      // )[0];
+      // console.log(res2);
+      // this.addForm.mainName = res2.dictValue;
+      // console.log(this.addForm);
+      // await getDealerStockAdd({ ...this.addForm });
+      // this.$message.success("添加成功");
+      // await this.$refs.addForm.resetFields();
+      // await this.getList({ pageNum: 1, pageSize: 10 });
+
       console.log(this.addForm);
+      let data = this.dealerList.filter((v) => {
+        return v.id === this.addForm.customerId;
+      });
 
-      await getDealerStockAdd({ ...this.addForm });
-      this.$message.success("添加成功");
-      await this.$refs.addForm.resetFields();
-      await this.getList({ pageNum: 1, pageSize: 10 });
+      let data2 = this.categoryList.filter((v) => {
+        return v.productCategoryId == this.addForm.mainId;
+      });
+      let data3 = this.userList.filter((v) => {
+        return v.adminUserId == this.addForm.serviceId;
+      });
+
+      let value = {
+        customerId: this.addForm.customerId,
+        customerName: data[0].name,
+        customerNumber: data[0].number,
+        mainId: this.addForm.mainId,
+        mainName: data2[0].productCategoryName,
+        serviceId: this.addForm.serviceId,
+        serviceName: data3[0].nickName,
+      };
+
+      if (this.title == "编辑") {
+        await getCustomerPtUpdate(value);
+        this.$message.success("编辑成功");
+      } else {
+        await getDealerStockAdd(value);
+        this.$message.success("添加成功");
+      }
+      this.getList({ pageNum: 1, pageSize: 10 });
       this.dialogForm = false;
     },
     //取消
@@ -339,7 +492,6 @@ export default {
       const res = await getDealerList(data);
       this.dealerList = res.data.records;
     },
-
     // 更改每页数量
     handleSizeChange(val) {
       this.pageSize = val;

+ 4 - 4
src/views/basic_data/taker/taker_car.vue

@@ -51,7 +51,7 @@
             type="primary"
             class="textColor"
             slot="reference"
-            >删除</el-button
+            >批量删除</el-button
           >
         </el-popconfirm>
       </div>
@@ -253,12 +253,12 @@ export default {
         ],
         mobile: [
           {
-            required: true,
+            required: false,
             message: "请输入联系电话",
             trigger: "blur",
           },
           {
-            required: true,
+            required: false,
             pattern:
               /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,
             message: "联系电话格式不正确",
@@ -266,7 +266,7 @@ export default {
           },
         ],
         // carType: [{ required: true, message: "车型不能为空", trigger: "blur" }],
-        // volume: [{ required: true, message: "体积不能为空", trigger: "blur" }],
+        volume: [{ required: true, message: "体积不能为空", trigger: "blur" }],
         carBrand: [
           { required: true, message: "车牌号不能为空", trigger: "blur" },
         ],

+ 3 - 4
src/views/basic_data/taker/taker_list.vue

@@ -27,9 +27,9 @@
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :lg="6">
-            <el-form-item label="电话" prop="telephone">
+            <el-form-item label="电话" prop="phoneKeyword">
               <el-input
-                v-model="searchForm.telephone"
+                v-model="searchForm.phoneKeyword"
                 placeholder="请输入电话"
               ></el-input>
             </el-form-item>
@@ -55,7 +55,6 @@
         <el-button type="primary" size="small" @click="exportFn"
           >导出</el-button
         >
-        <el-button type="primary" size="small">打印</el-button>
       </div>
     </div>
     <!-- 列表 -->
@@ -381,7 +380,7 @@ export default {
       searchForm: {
         customerName: "",
         takerName: "",
-        telephone: "",
+        phoneKeyword: "",
       },
       dealerList: [],
       id: "", //重建之前的Id