Bläddra i källkod

Finish Hotfix-zh-15

howie 3 år sedan
förälder
incheckning
e4bb4775f1

+ 9 - 0
src/api/policy_list.js

@@ -34,6 +34,15 @@ export function getConditionList(params) {
   });
 }
 
+//克隆
+export function cloneList(params) {
+  return request({
+    url: "/policy/material/clone",
+    method: "post",
+    params,
+  });
+}
+
 
 //物料列表
 export function getK3List(params) {

+ 10 - 0
src/views/basic_data/material/modify_list.vue

@@ -83,6 +83,7 @@
           </el-popconfirm>
         </div>
         <div class="fr">
+            <ExportButton :exUrl="'/product-upd-price/export'" :exParams="exParams" />
           <!-- <el-button type="primary" size="small">导入</el-button>
           <el-button type="primary" size="small">导出</el-button>
           <el-button type="primary" size="small">打印</el-button> -->
@@ -469,6 +470,15 @@ export default {
     ModifyListApproval,
     ModifyListDetail,
   },
+  computed:{
+    exParams() {
+      return {
+        materialName: this.screenForm.materialName,
+        materialNumber: this.screenForm.materialNumber,
+        startDate:this.screenForm.startDate
+      };
+    },
+  },
   mounted() {
     let params = {
       pageNum: 1,

+ 1 - 1
src/views/engin_deposit/deposit_list.vue

@@ -17,7 +17,7 @@
         >
           <el-row :gutter="20">
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="工程订单编号" prop="refEnginRecordNo">
+              <el-form-item label="工程登录编码" prop="refEnginRecordNo">
                 <el-input
                   v-model="screenForm.refEnginRecordNo"
                   placeholder="请输入"

+ 19 - 1
src/views/sales_policy/policy_list.vue

@@ -220,8 +220,19 @@
                 >作废</el-button
               >
             </el-popconfirm>
+                <el-popconfirm
+              v-if="$checkBtnRole('examine', $route.meta.roles)"
+              style="margin-left: 10px"
+              title="克隆?"
+              @onConfirm="handleClone(scope.row)"
+            >
+                <!--  -->
+              <el-button type="text" size="small" slot="reference"
+                >克隆</el-button
+              >
+            </el-popconfirm>
             <el-popconfirm
-              v-if="scope.row.examineStatus != 'OK'"
+              v-if="scope.row.examineStatus != 'OK' "
               style="margin-left: 10px"
               title="删除吗?"
               @onConfirm="hanleDelete(scope.row.id)"
@@ -329,6 +340,7 @@ import {
   deletePolicy,
   getpolicySubmit,
   toExamine,
+  cloneList
 } from "@/api/policy_list";
 import Minxin from "@/mixin";
 import { downloadFiles, handleImport } from "@/utils/util";
@@ -413,6 +425,12 @@ export default {
         this.isShow = 2;
       });
     },
+    handleClone(row){
+      cloneList({policyId:row.id}).then(res=>{
+        this.$successMsg('克隆成功')
+        this.getList()
+      })
+    },
     getList() {
       this.listLoading = true;
       const params = {

+ 254 - 84
src/views/supply/policy/components/retail_form.vue

@@ -17,7 +17,7 @@
       label-position="right"
     >
       <el-row :gutter="20">
-        <el-col :xs="24" :sm="12" :lg="8" >
+        <el-col :xs="24" :sm="12" :lg="8">
           <el-form-item label="销售政策编号" prop="policyCode">
             <div style="display: flex">
               <el-input
@@ -70,6 +70,7 @@
             <el-select
               v-model="mainForm.k3ServiceName"
               placeholder="选择业务员"
+              @change="handleUser"
               style="width: 100%"
             >
               <el-option
@@ -86,7 +87,7 @@
 
     <div class="main-title">
       <div class="title">货品信息</div>
-      <div >
+      <div>
         <el-select
           v-model="warehouseValue"
           placeholder="请选择发货仓库"
@@ -221,9 +222,11 @@
           show-overflow-tooltip
         >
           <template slot-scope="scope">
+            <!-- (scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) /
+                100  -->
+
             {{
-              (scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) /
-                100 || 0
+               (scope.row.price - scope.row.discAmount)*((scope.row.rebateRate * scope.row.qty) * 100)/100 || 0
             }}
           </template>
         </el-table-column>
@@ -273,7 +276,8 @@
           <template slot-scope="scope">
             <el-select
               size="small"
-              v-model="scope.row.k3ServiceName"
+              v-model="scope.row.serviceName"
+              @change="handleUser2($event,scope.row)"
               placeholder="选择业务员"
               style="width: 100%"
             >
@@ -387,10 +391,7 @@
       </el-table>
     </div>
 
-    <div class="page-footer" style="
-    position: fixed;
-    bottom: 0;
-  ">
+    <div class="page-footer" style="position: fixed; bottom: 0; z-index: 99">
       <div class="footer" :class="classObj">
         <el-button type="primary" @click="clickSubmitForm">保 存</el-button>
         <el-popconfirm
@@ -491,19 +492,23 @@
         </el-form>
         <template v-if="!dataList.length">
           <div v-for="(item, index) in popDataArr" :key="index">
+            <div style="padding: 20px 0">
+              <div v-if="index == 0">限定机型</div>
+              <div v-else>配提机型{{ index }}</div>
+            </div>
             <el-table
+            class="table"
               v-loading="listLoading"
               :data="item"
               ref="singleTable"
               element-loading-text="Loading"
+              max-height="500"
               border
               fit
               highlight-current-row
               @select-all="handleSelectionChange($event, 1, index)"
               @selection-change="handleSelectionChange($event, 1, index)"
               stripe
-              show-summary
-              :summary-method="$getSummaries"
             >
               <el-table-column
                 align="center"
@@ -522,7 +527,13 @@
                   show-overflow-tooltip
                 >
                   <template slot-scope="scope">
-                    <el-input v-model="scope.row.qty" size="small"></el-input>
+                    <el-input
+                      type="number"
+                      v-model.lazy="scope.row.qty"
+                      @blur="blurQty(scope.row.qty, scope.row)"
+                      @input="funQty(scope.row.qty, scope.row, index)"
+                      size="small"
+                    ></el-input>
                   </template>
                 </el-table-column>
                 <el-table-column
@@ -547,8 +558,22 @@
                 >
                 </el-table-column>
               </template>
+              <template #append>
+                <div class="mybox">
+                  <el-row class="mybox-row" type="flex">
+                    <el-col style="width: 55px">合计</el-col>
+                    <el-col></el-col>
+                    <el-col></el-col>
+                    <el-col></el-col>
+                    <el-col>{{ totalArr[index].totalQty }}</el-col>
+                    <el-col>{{ totalArr[index].totalPrice }}</el-col>
+                    <el-col>{{ totalArr[index].totalAmount }}</el-col>
+                  </el-row>
+                </div>
+              </template>
             </el-table>
-            <div style="margin: 10px 0">
+            <!-- <div style="margin: 10px 0">
+                分页
               <el-pagination
                 @size-change="
                   popfun['handleSizeChange' + (index + 1)]($event, index + 1)
@@ -563,7 +588,7 @@
                 :total="poptotal['total' + (index + 1)]"
               >
               </el-pagination>
-            </div>
+            </div> -->
           </div>
 
           <span slot="footer" class="dialog-footer">
@@ -572,18 +597,18 @@
         </template>
         <template v-else>
           <el-table
+           class="table"
             ref="singleTable"
-            v-loading="listLoading"
+            v-loading="listLoading2"
             :data="dataList"
             element-loading-text="Loading"
             border
             fit
+            max-height="500"
             highlight-current-row
             @select-all="handleSelectionChange"
             @selection-change="handleSelectionChange"
             stripe
-                show-summary
-              :summary-method="$getSummaries"
           >
             <el-table-column
               align="center"
@@ -602,7 +627,13 @@
                 show-overflow-tooltip
               >
                 <template slot-scope="scope">
-                  <el-input v-model="scope.row.qty" size="small"></el-input>
+                  <el-input
+                      type="number"
+                      v-model.lazy="scope.row.qty"
+                      @blur="blurQty(scope.row.qty, scope.row)"
+                      @input="funQty(scope.row.qty, scope.row)"
+                      size="small"
+                    ></el-input>
                 </template>
               </el-table-column>
               <el-table-column
@@ -627,8 +658,21 @@
               >
               </el-table-column>
             </template>
+            <template #append>
+                <div class="mybox">
+                    <el-row  class="mybox-row" type="flex" >
+                    <el-col style="width: 55px;" >合计</el-col>
+                    <el-col ></el-col>
+                    <el-col ></el-col>
+                    <el-col ></el-col>
+                    <el-col >{{totalQty}}</el-col>
+                    <el-col >{{totalPrice}}</el-col>
+                    <el-col >{{totalAmount}}</el-col>
+                  </el-row>
+                </div>
+            </template>
           </el-table>
-          <div style="margin: 10px 0">
+          <!-- <div style="margin: 10px 0">
             <el-pagination
               @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
@@ -639,7 +683,7 @@
               :total="total"
             >
             </el-pagination>
-          </div>
+          </div> -->
           <span slot="footer" class="dialog-footer">
             <el-button type="primary" @click="hanlePopData">完成</el-button>
           </span>
@@ -670,8 +714,6 @@ import {
   getPolicyConditionList,
 } from "@/api/supply/policy";
 import { getDictList } from "@/api/common";
-import { findElem } from "@/utils/util";
-import { async } from "q";
 
 export default {
   name: "RetailForm",
@@ -766,11 +808,13 @@ export default {
         },
         {
           prop: "zong",
+          widht: 160,
           lable: "金额",
           jie: true,
         },
       ],
       listLoading: false,
+      listLoading2: false,
       popDataArr: [],
       radioObj: {},
       step: 0,
@@ -787,6 +831,11 @@ export default {
       popfun: {},
       poptotal: {},
       popcun: {},
+      totalQty: 0,
+      totalPrice: 0,
+      totalAmount: 0,
+      totalArr: [],
+      type:1
     };
   },
 
@@ -832,6 +881,7 @@ export default {
         }
       };
     },
+
     // pickerOptions({ $props }) {
     //   return {
     //     disabledDate: (time) => {
@@ -839,11 +889,6 @@ export default {
     //     },
     //   };
     // },
-      wZong(){
-        return (val,oval)=>{
-            console.log(744);
-        }
-      }
   },
 
   created() {
@@ -856,8 +901,41 @@ export default {
       this.getDetail();
     }
   },
-  beforeUpdate() {},
+
   methods: {
+    blurQty(e, row) {
+      if (!e) {
+        this.$set(row, "qty", 1);
+      }
+    },
+    funQty(qty, row, index) {
+      if (row.fang) {
+        if (this.type==1) {
+          this.$set(this.totalArr, index, {
+            totalQty: 0,
+            totalPrice: 0,
+            totalAmount: 0,
+          });
+          for (let j = 0; j < this.multipleSelections[index].length; j++) {
+            this.multipleSelections[index][j].fang = true;
+            this.totalArr[index].totalQty += +qty || 1;
+            this.totalArr[index].totalPrice +=
+              +this.multipleSelections[index][j].price;
+            this.totalArr[index].totalAmount +=
+              +this.multipleSelections[index][j].price * (+qty || 1);
+          }
+        } else {
+
+          this.totalQty = this.totalPrice = this.totalAmount = 0;
+          for (let i = 0; i < this.multipleSelection.length; i++) {
+            this.totalQty += +qty || 1;
+            this.totalPrice += +this.multipleSelection[i].price;
+            this.totalAmount +=
+              +this.multipleSelection[i].price * (+qty || 1);
+          }
+        }
+      }
+    },
     getUserList() {
       getUserList({
         pageNum: 1,
@@ -872,6 +950,21 @@ export default {
         // // consloe(this.userList,'122');
       });
     },
+    handleUser(e){
+      const user=  this.userList.filter(k=>{
+        return k.adminUserId == e
+       })[0]
+       this.mainForm.k3ServiceId = user.adminUserId
+       this.mainForm.k3ServiceName = user.nickName
+    },
+    handleUser2(e,row){
+        const user=  this.userList.filter(k=>{
+        return k.adminUserId == e
+       })[0]
+       this.$set(row,'serviceId',user.adminUserId)
+      this.$set(row,'serviceName', user.nickName)
+
+    },
     // 返回列表
     goBack() {
       this.$emit("backListFormDetail");
@@ -888,9 +981,7 @@ export default {
     },
     // 选择销售政策获取政策条件列表
     async handlePolicy(e) {
-
-
-
+      this.totalArr = [];
       this.multipleSelections = [];
       this.dataList = [];
       this.popDataArr = [];
@@ -922,7 +1013,6 @@ export default {
         }
       } else {
         // LIMIT 限量
-
         this.getMaterialTypeList("sProvision");
       }
     },
@@ -971,14 +1061,14 @@ export default {
     },
     // 获取某一个比例下的数据 ,查询popType 当前 this.cusIndex+1
     async getConditionList(policyConditionId, popType, fang) {
+      this.listLoading = true;
       const { data } = await getConditionList({
         pageNum: this.currentPage,
-        pageSize: 10,
+        pageSize: -1,
         policyConditionId,
         popType,
       });
 
-
       if (!fang) {
         this.poptotal["total" + popType] = data.total;
         this.popcun["cun" + popType] = 1;
@@ -999,13 +1089,14 @@ export default {
         for (let p = 0; p < this.goodsList.length; p++) {
           for (let q = 0; q < datas.length; q++) {
             if (this.goodsList[p].id == datas[q].id) {
-              this.$set(datas[q],'disabled',true)
+              this.$set(datas[q], "disabled", true);
             }
           }
         }
       }
       for (let i = 0; i < data.records.length; i++) {
         data.records[i].qty = 1;
+        data.records[i].policyMaterialId = data.records[i].id
         this.$set(
           data.records[i],
           "zong",
@@ -1027,52 +1118,60 @@ export default {
       } else {
         this.popDataArr.push(datas);
       }
-
+      this.totalArr.push({
+        totalQty: 0,
+        totalPrice: 0,
+        totalAmount: 0,
+      });
+      // this.$set(this.totalArr,[...this.totalArr])
+      this.listLoading = false;
       // consloe(this.popDataArr);
     },
-     // 获取政策列表
+    // 获取政策列表
     getMaterialTypeList(val) {
+      this.listLoading2 = true;
       getMaterialTypeList({
         pageNum: 1,
-        pageSize: 10,
+        pageSize: -1,
         policyId: this.screenForm.policyId,
         saleTypeCode: this.screenForm.saleTypeCode,
         [val]: true,
       }).then((res) => {
+        this.dataList = res.data.records;
 
-           this.dataList = res.data.records;
-            if (this.listItem) {
-
-          for (let i = 0; i < this.dataList.length; i++) {
-           for (let j = 0; j < this.goodsList.length; j++) {
-              console.log(8888);
-              if (this.dataList[i].id==this.goodsList[j].id) {
-                    this.$set(this.dataList[i],'disabled',true)
-                }
+        if (this.listItem) {
 
-           }
+          for (let i = 0; i < this.goodsList .length; i++) {
+            for (let j = 0; j <this.dataList.length; j++) {
 
+              if (this.dataList[j].id == this.goodsList[i].policyMaterialId) {
+                     console.log(8888);
+                this.$set(this.dataList[i], "disabled", true);
+              }
+            }
           }
         }
 
         for (let i = 0; i < res.data.records.length; i++) {
-          res.data.records[i].qty = 1;
-           this.$set(
-          res.data.records[i],
-          "zong",
-          res.data.records[i].qty * res.data.records[i].price
+          this.$set(
+            res.data.records[i],
+            "qty",
+            1
           );
           res.data.records[i].sums1 = ["price", "qty", "zong"];
           res.data.records[i].userList = this.userList;
+           res.data.records[i].policyMaterialId = res.data.records[i].id
           for (let j = 0; j < this.newDataList.length; j++) {
+
             if (this.newDataList[j].id == res.data.records[i].id) {
-              res.data.records[i].disabled = false;
 
+               res.data.records[i].disabled = false;
             }
           }
         }
-       this.dataList = res.data.records;
+        this.dataList = res.data.records;
         this.total = res.data.total;
+        this.listLoading2 = false;
         this.popDataArr = [];
         this.popArr = [];
         // // consloe(this.dataList, "kkkk");
@@ -1130,14 +1229,42 @@ export default {
       // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
       // 如果没有返回值则默认返回false(全部无法选中)
     },
-
     // 条件数据多选
     handleSelectionChange(val, type, index) {
+
       if (type == 1) {
+        this.type=1
         this.$set(this.multipleSelections, index, val);
+        this.$set(this.totalArr, index, {
+          totalQty: 0,
+          totalPrice: 0,
+          totalAmount: 0,
+        });
+
+        for (let j = 0; j < this.multipleSelections[index].length; j++) {
+          this.multipleSelections[index][j].fang = true;
+          this.totalArr[index].totalQty +=
+            +this.multipleSelections[index][j].qty;
+          this.totalArr[index].totalPrice +=
+            +this.multipleSelections[index][j].price;
+          this.totalArr[index].totalAmount +=
+            +this.multipleSelections[index][j].price *
+            +this.multipleSelections[index][j].qty;
+        }
+
         // consloe(this.multipleSelections);
       } else {
+        this.type=2
         this.multipleSelection = val;
+        this.totalQty = this.totalPrice = this.totalAmount = 0;
+        for (let i = 0; i < this.multipleSelection.length; i++) {
+           this.multipleSelection[i].fang = true;
+          this.totalQty += +this.multipleSelection[i].qty;
+          this.totalPrice += +this.multipleSelection[i].price;
+          this.totalAmount +=
+            +this.multipleSelection[i].price *
+            +this.multipleSelection[i].qty;
+        }
       }
     },
     hanlePopData() {
@@ -1168,18 +1295,21 @@ export default {
 
         if (this.goodsList.length && this.goodsList[0].wallets.length) {
           this.mainForm.k3ServiceName =
-            this.goodsList[0].wallets[0].serviceId || "";
+            this.goodsList[0].wallets[0].k3ServiceName || "";
           this.mainForm.k3ServiceId =
             this.goodsList[0].wallets[0].serviceId || "";
         }
-
+        // if (this.goodsList.length>4) {
+        //     this.newGoodsList = this.goodsList
+        //     this.newGoodsList.length = 4
+        // }
         this.cusIndex = 0;
         this.total = 0;
         this.popDataArr = [];
         this.multipleData = [];
         this.multipleSelection = [];
         this.policyId = this.screenForm.policyId;
-
+        this.totalQty = this.totalPrice = this.totalAmount = 0;
         this.isShowDialog = false;
         this.$refs.singleTable.clearSelection();
 
@@ -1200,7 +1330,7 @@ export default {
 
         if (this.goodsList.length && this.goodsList[0].wallets.length) {
           this.mainForm.k3ServiceName =
-            this.goodsList[0].wallets[0].serviceId || "";
+            this.goodsList[0].wallets[0].k3ServiceName || "";
           this.mainForm.k3ServiceId =
             this.goodsList[0].wallets[0].serviceId || "";
         }
@@ -1215,7 +1345,7 @@ export default {
         this.multipleData = [];
         this.multipleSelection = [];
         this.policyId = this.screenForm.policyId;
-
+        this.totalQty = this.totalPrice = this.totalAmount = 0;
         this.isShowDialog = false;
         this.$refs.singleTable.forEach((k) => {
           k.clearSelection();
@@ -1228,29 +1358,47 @@ export default {
     },
     // 获取详情
     getDetail() {
-      getDetail({ id: this.listItem.id }).then((res) => {
+
+       getUserList({
+        pageNum: 1,
+        pageSize: -1,
+        adminWebsitId: "",
+        isCustomer: 0,
+        roleId: "",
+        status: true,
+        userName: "",
+          }).then((res) => {
+        this.userList = res.data.records;
+
+      getDetail({ id: this.listItem.id }).then(res=>{
         let data = res.data;
         this.mainForm.date = data.theTime;
         this.mainForm.type = data.mainId;
         this.mainForm.remark = data.remark;
         this.mainForm.policyId = data.policyId;
         this.policyId = data.policyId;
-        this.mainForm.k3ServiceName = data.k3ServiceId;
-        this.mainForm.k3ServiceId = data.k3ServiceId;
+        this.mainForm.k3ServiceName =data.k3ServiceName;
+        this.mainForm.k3ServiceId = data.k3ServiceId ;
+
         data.retailOrderItemList.forEach((item) => {
           item.status1 = "";
           item.status2 = "";
+
+         this.$set(item, "userList", this.userList);
           item.wallets.forEach((k) => {
             if (k.customerWalletId === data.customerWalletId) {
               this.$set(item, "serviceId", k.serviceId);
-              this.$set(item, "serviceName", k.serviceId);
+              this.$set(item, "serviceName", k.serviceName);
             }
           });
 
-          this.$set(item, "userList", this.userList);
+
         });
+        console.log(data.retailOrderItemList);
         this.goodsList = data.retailOrderItemList;
-      });
+     })
+
+         });
     },
     // 获取销售政策
     getPolicyList() {
@@ -1260,11 +1408,10 @@ export default {
         status: true,
       }).then((res) => {
         if (this.policyId) {
-          this.screenForm.policyId = this.policyId
-          this.disabled = true
-
-        }else{
-           this.screenForm.policyId = res.data.records[0].code;
+          this.screenForm.policyId = this.policyId;
+          this.disabled = true;
+        } else {
+          this.screenForm.policyId = res.data.records[0].code;
         }
 
         this.policyList = res.data.records;
@@ -1304,20 +1451,20 @@ export default {
         policyId: this.screenForm.policyId,
         saleTypeCode: this.screenForm.saleTypeCode,
       }).then((res) => {
-        console.log(res.data.records,'7777');
+
         for (let i = 0; i < res.data.records.length; i++) {
-          res.data.records[i].qty = 1;
+
           this.$set(
-          res.data.records[i],
-          "zong",
-          res.data.records[i].qty * res.data.records[i].price
+            res.data.records[i],
+            "qty",
+            1
           );
           res.data.records[i].sums2 = ["price", "qty", "zong"];
           res.data.records[i].userList = this.userList;
-
         }
 
         this.dataList = res.data.records;
+
         this.total = res.data.total;
       });
     },
@@ -1325,9 +1472,9 @@ export default {
     // 打开引用
     handleShow() {
       this.isShowDialog = true;
-      if (!this.dataList.length) {
+
         this.getPolicyList();
-      }
+
     },
     // 获取钱包列表
     getWalletList() {
@@ -1498,6 +1645,7 @@ export default {
       this.getConditionList(this.policyConditionId, this.cusIndex + 1);
     },
     handleClose() {
+      this.totalQty = this.totalPrice = this.totalAmount = 0;
       // this.dataList = [];
       // this.popDataArr = [];
       // this.screenForm.policyId = "";
@@ -1507,12 +1655,12 @@ export default {
     deleteItem(index, id) {
       this.goodsList.splice(index, 1);
       // this.dataList
-      if (this.newDataList.length) {
         this.newDataList.splice(index, 1);
-      }
-      if (!this.goodsList.length) {
+       if (!this.goodsList.length) {
         this.disabled = false;
-      }
+        this.policyId = ''
+        this.mainForm.policyId = ''
+       }
 
       // this.popDataArr.splice(index,1)
     },
@@ -1579,7 +1727,9 @@ export default {
             type: 2, // 1:普通零售单,2:政策零售单
             retailOrderItemList: this.goodsList,
             policyId: this.policyId,
+
           };
+        console.log(params);
           if (this.listItem) {
             params.id = this.listItem.id;
             editData(params).then((res) => {
@@ -1609,7 +1759,26 @@ export default {
 .detail-container {
   width: 100%;
   height: 100%;
+  ::v-deep .el-table__append-wrapper{
+    overflow: initial;
+  }
+}
+.table{
+  background-color: rgb(237 237 237);
+}
+.mybox {
+  padding: 20px 0;
+
+  div:first-child {
+    flex: 0 0 55px;
+  }
+  div {
+    flex: 1 0 160px;
+    text-align: center;
+  }
 }
+
+
 .main-title {
   display: flex;
   justify-content: space-between;
@@ -1647,4 +1816,5 @@ export default {
   text-overflow: ellipsis;
   white-space: nowrap;
 }
+
 </style>

+ 1 - 1
src/views/supply/policy/policy_list.vue

@@ -326,7 +326,7 @@
             <el-table-column
               align="center"
               label="业务员"
-              prop="serviceName"
+              prop="k3ServiceName"
               min-width="100"
               show-overflow-tooltip
             ></el-table-column>