ソースを参照

111

Signed-off-by: howie <zhou13413322424hao@outlook.com>
howie 3 年 前
コミット
bc00d73fa3

+ 348 - 213
src/views/supply/policy/components/retail_form.vue

@@ -17,28 +17,28 @@
       label-position="right"
     >
       <el-row :gutter="20">
-        <el-col
-          :xs="24"
-          :sm="12"
-          :lg="8"
-          v-if="!listItem"
-        >
+        <el-col :xs="24" :sm="12" :lg="8" v-if="!listItem">
           <el-form-item label="销售政策编号" prop="policyCode">
-            <div style="display:flex">
-            <el-input
-              v-model="policyId"
-              placeholder="销售政策编号"
-              disabled
-            ></el-input>
-            <el-button style="margin-left:10px"  size="small" @click="handleShow">引用</el-button>
-
+            <div style="display: flex">
+              <el-input
+                v-model="policyId"
+                placeholder="销售政策编号"
+                disabled
+              ></el-input>
+              <el-button
+                style="margin-left: 10px"
+                size="small"
+                @click="handleShow"
+                >引用</el-button
+              >
             </div>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8" v-else>
           <el-form-item label="销售政策编号" prop="policyCode">
             <el-input
-              v-model="mainForm.policyCode"
+              disabled
+              v-model="mainForm.policyId"
               placeholder="销售政策编号"
             ></el-input>
           </el-form-item>
@@ -55,10 +55,19 @@
             </el-date-picker>
           </el-form-item>
         </el-col>
-        <!-- <el-col :xs="24" :sm="12" :lg="8">
-          <el-form-item label="业务员" prop="type">
+
+        <el-col :xs="24" :sm="8" :lg="8">
+          <el-form-item label="备注" prop="remark">
+            <el-input
+              v-model="mainForm.remark"
+              placeholder="请输入备注"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="业务员" prop="k3ServiceName">
             <el-select
-              v-model="mainForm.type"
+              v-model="mainForm.k3ServiceName"
               placeholder="选择业务员"
               style="width: 100%"
             >
@@ -70,14 +79,6 @@
               ></el-option>
             </el-select>
           </el-form-item>
-        </el-col> -->
-        <el-col :xs="24" :sm="8" :lg="8">
-          <el-form-item label="备注" prop="remark">
-            <el-input
-              v-model="mainForm.remark"
-              placeholder="请输入备注"
-            ></el-input>
-          </el-form-item>
         </el-col>
       </el-row>
     </el-form>
@@ -220,8 +221,10 @@
         >
           <template slot-scope="scope">
             {{
-              (scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) /
-                100 || 0
+
+              ((scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) /
+              100)||0
+
             }}
           </template>
         </el-table-column>
@@ -235,13 +238,7 @@
             {{ scope.row.qty * scope.row.discAmount }}
           </template>
         </el-table-column>
-        <!-- <el-table-column
-          align="center"
-          label="已退数量"
-          prop="retiredQty"
-          min-width="100"
-          show-overflow-tooltip
-        ></el-table-column> -->
+
         <el-table-column
           align="center"
           label="现金钱包"
@@ -251,6 +248,7 @@
         >
           <template slot-scope="scope">
             <el-select
+              @change="handleWallets($event, scope.row)"
               v-model="scope.row.customerWalletId"
               placeholder="选择现金钱包"
               clearable
@@ -268,6 +266,29 @@
         </el-table-column>
         <el-table-column
           align="center"
+          label="业务员"
+          prop="retiredQty"
+          min-width="160"
+          show-overflow-tooltip
+        >
+          <template slot-scope="scope">
+            <el-select
+              size="small"
+              v-model="scope.row.k3ServiceName"
+              placeholder="选择业务员"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in scope.row.userList"
+                :key="item.adminUserId"
+                :label="item.nickName"
+                :value="item.adminUserId"
+              ></el-option>
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column
+          align="center"
           label="实付金额"
           prop="qty"
           min-width="100"
@@ -357,7 +378,9 @@
               @click="(dialogVisible = true), (cid = scope.row.id)"
               >修改</el-button
             > -->
-            <el-button type="text" @click="deleteItem(scope.$index,scope.row.id)"
+            <el-button
+              type="text"
+              @click="deleteItem(scope.$index, scope.row.id)"
               >删除</el-button
             >
           </template>
@@ -431,7 +454,7 @@
                   ></el-option>
                 </el-select> </el-form-item
             ></el-col>
-            <el-col :xs="24" :sm="6" :lg="6">
+            <!-- <el-col :xs="24" :sm="6" :lg="6">
               <el-form-item label="条件">
                 <el-select
                   v-model="screenForm.factorId"
@@ -448,7 +471,7 @@
                   ></el-option>
                 </el-select>
               </el-form-item>
-            </el-col>
+            </el-col> -->
             <el-col :xs="24" :sm="6" :lg="6">
               <el-form-item label="销售类型">
                 <el-select
@@ -457,6 +480,8 @@
                   placeholder="选择销售类型"
                   style="width: 100%"
                 >
+                <el-option  :label="默认" :value="''"></el-option>
+
                   <el-option
                     v-for="item in ztypeList"
                     :key="item.id"
@@ -467,7 +492,7 @@
               </el-form-item>
             </el-col>
 
-            <el-col :xs="24" :sm="6" :lg="6" class="tr">
+            <el-col :xs="24" :sm="12" :lg="12" class="tr">
               <el-button
                 type="primary"
                 size="small"
@@ -478,96 +503,89 @@
           </el-row>
         </el-form>
         <template v-if="!dataList.length">
-          <el-row :gutter="20" style="margin: 10px 0">
-            {{ cusIndex > 0 ? "选择配提机型" : "选择限定机型" }}
-            {{ "(" + pop + ")" }}
-          </el-row>
-          <el-table
-            v-loading="listLoading"
-            :data="popDataArr[cusIndex]"
-            element-loading-text="Loading"
-            border
-            fit
-            highlight-current-row
-            @select-all="handleSelectionChange"
-            @selection-change="handleSelectionChange"
-            stripe
-          >
-            <el-table-column
-              align="center"
-              type="selection"
-              :selectable="selectable"
-              width="55"
+          <div v-for="(item, index) in popDataArr" :key="index">
+            <el-table
+              v-loading="listLoading"
+              :data="item"
+              ref="singleTable"
+              element-loading-text="Loading"
+              border
+              fit
+              highlight-current-row
+              @select-all="handleSelectionChange($event, 1, index)"
+              @selection-change="handleSelectionChange($event, 1, index)"
+              stripe
             >
-            </el-table-column>
-            <template v-for="col in columns">
-              <el-table-column
-                v-if="col.num"
-                align="center"
-                :label="col.lable"
-                :prop="col.prop"
-                :min-width="col.widht"
-                show-overflow-tooltip
-              >
-                <template slot-scope="scope">
-                  <el-input v-model="scope.row.qty" size="small"></el-input>
-                </template>
-              </el-table-column>
               <el-table-column
-                v-else-if="col.jie"
                 align="center"
-                :label="col.lable"
-                :prop="col.prop"
-                :min-width="col.widht"
-                show-overflow-tooltip
+                type="selection"
+                :selectable="selectable"
+                width="55"
               >
-                <template slot-scope="scope">
-                  {{ scope.row.qty * scope.row.price || 0 }}
-                </template>
               </el-table-column>
-              <el-table-column
-                v-else
-                align="center"
-                :label="col.lable"
-                :prop="col.prop"
-                :min-width="col.widht"
-                show-overflow-tooltip
+              <template v-for="col in columns">
+                <el-table-column
+                  v-if="col.num"
+                  align="center"
+                  :label="col.lable"
+                  :prop="col.prop"
+                  :min-width="col.widht"
+                  show-overflow-tooltip
+                >
+                  <template slot-scope="scope">
+                    <el-input v-model="scope.row.qty" size="small"></el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  v-else-if="col.jie"
+                  align="center"
+                  :label="col.lable"
+                  :prop="col.prop"
+                  :min-width="col.widht"
+                  show-overflow-tooltip
+                >
+                  <template slot-scope="scope">
+                    {{ scope.row.qty * scope.row.price || 0 }}
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  v-else
+                  align="center"
+                  :label="col.lable"
+                  :prop="col.prop"
+                  :min-width="col.widht"
+                  show-overflow-tooltip
+                >
+                </el-table-column>
+              </template>
+            </el-table>
+            <div style="margin: 10px 0">
+              <el-pagination
+                @size-change="
+                  popfun['handleSizeChange' + (index + 1)]($event, index + 1)
+                "
+                @current-change="
+                  popfun['handleCurrentChange' + (index + 1)]($event, index + 1)
+                "
+                :current-page="popcun['cun' + (index + 1)]"
+                :page-sizes="[10]"
+                :page-size="10"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="poptotal['total' + (index + 1)]"
               >
-              </el-table-column>
-            </template>
-          </el-table>
-          <div style="margin: 10px 0">
-            <el-pagination
-              @size-change="handleSizeChange"
-              @current-change="handleCurrentChange"
-              :current-page="currentPage"
-              :page-sizes="[10]"
-              :page-size="10"
-              layout="total, sizes, prev, pager, next, jumper"
-              :total="total"
-            >
-            </el-pagination>
+              </el-pagination>
+            </div>
+          </div>
+          <div v-if="factor.length">
+            引用销售政策说明:{{ factor.length ? factor[0].name : "" }}
           </div>
           <span slot="footer" class="dialog-footer">
-            <el-button type="primary" v-if="cusIndex > 0" @click="handleShang"
-              >上一步</el-button
-            >
-            <el-button
-              type="primary"
-              @click="handleCondition"
-              v-if="popArr.length != cusIndex + 1"
-              >下一步</el-button
-            >
-            <el-button
-              type="primary"
-              @click="hanlePopData"
-              v-if="popArr.length == cusIndex + 1"
-              >完成</el-button
-            >
+            <el-button type="primary" @click="hanlePopData">完成</el-button>
           </span>
         </template>
         <template v-else>
           <el-table
+            ref="singleTable"
             v-loading="listLoading"
             :data="dataList"
             element-loading-text="Loading"
@@ -664,6 +682,7 @@ import {
 } from "@/api/supply/policy";
 import { getDictList } from "@/api/common";
 import { findElem } from "@/utils/util";
+import { async } from "q";
 
 export default {
   name: "RetailForm",
@@ -700,6 +719,8 @@ export default {
         policyCode: "",
         policyRemark: "",
         policyId: "",
+        k3ServiceId: "",
+        k3ServiceName: "",
       },
       // mainFormRules: {
       //   type: [{ required: true, message: "请选择品类", trigger: "change" }],
@@ -767,16 +788,22 @@ export default {
       policyId: "",
       policyConditionId: "",
       multipleSelection: [],
+      multipleSelections: [],
       multipleData: [],
       disabled: false,
       cid: "",
-      newDataList:[],
-      userList:[]
+      newDataList: [],
+      userList: [],
+      fang: false,
+      popfun: {},
+      poptotal: {},
+      popcun: {},
     };
   },
 
   computed: {
     sidebar() {
+      console.log(11145454);
       return this.$store.state.app.sidebar;
     },
     classObj() {
@@ -787,7 +814,7 @@ export default {
     },
     comxjWalletList() {
       return (c) => {
-        console.log(c, "现金钱包");
+        // // consloe(c, "现金钱包");
         const walle = [];
         const ovalVall = c == undefined || !c.length ? [] : c;
         for (let i = 0; i < this.xjWalletList.length; i++) {
@@ -830,41 +857,74 @@ export default {
     this.getWalletList();
     this.getWarehouseList();
     this.getTypeList();
-    this.getUserList()
+    this.getUserList();
     if (this.listItem) {
       this.getDetail();
     }
   },
   beforeUpdate() {},
   methods: {
-    getUserList(){
+    getUserList() {
       getUserList({
-        pageNum:1,
-        pageSize:-1,
-        adminWebsitId:'',
-        isCustomer:0,
-        roleId:'',
-        status:true,
-        userName:''
-      }).then(res=>{
-        this.userList = res.data.records
-          console.log(this.userList,'122');
-      })
+        pageNum: 1,
+        pageSize: -1,
+        adminWebsitId: "",
+        isCustomer: 0,
+        roleId: "",
+        status: true,
+        userName: "",
+      }).then((res) => {
+        this.userList = res.data.records;
+        // // consloe(this.userList,'122');
+      });
     },
     // 返回列表
     goBack() {
       this.$emit("backListFormDetail");
     },
+
+    handleWallets(e, row) {
+      const service = row.wallets.filter((k) => {
+        return e == k.customerWalletId;
+      })[0];
+      if (service.serviceId) {
+        this.$set(this.mainForm, "k3ServiceId", service.serviceId);
+        this.$set(this.mainForm, "k3ServiceName", service.serviceId);
+      }
+    },
     // 选择销售政策获取政策条件列表
-    handlePolicy(e) {
-      this.factor = [];
+    async handlePolicy(e) {
+      this.multipleSelections = [];
+      this.dataList = [];
       this.popDataArr = [];
-      this.total = 0;
-      this.screenForm.factorId = "";
-      // 选择销售政策PolidcyId改变获取条件列表
-      getPolicyConditionList({ policyId: e }).then((res) => {
-        this.factor = res.data;
-      });
+      this.screenForm.saleTypeCode = "";
+      let type = this.policyList.filter((k) => {
+        return k.code === e;
+      })[0].type;
+      if (type == "PROVISION") {
+        // PROVISION 配提
+        //   选择销售政策PolidcyId改变获取条件列表
+        const { data } = await getPolicyConditionList({ policyId: e });
+
+        this.factor = data;
+        this.pop = data[0].pop;
+        this.popArr = data[0].pop.split(":");
+
+        if (this.policyId) {
+          this.screenForm.policyId = this.policyId;
+        } else {
+          this.screenForm.policyId = data[0].policyId;
+          this.policyConditionId = data[0].id;
+        }
+
+        for (let i = 0; i < this.popArr.length; i++) {
+          await this.getConditionList(this.policyConditionId, i + 1);
+        }
+      } else {
+        // LIMIT 限量
+
+        this.getMaterialTypeList("sProvision");
+      }
     },
     hendleEdit(val, index) {
       this.dialogVisible = false;
@@ -888,7 +948,7 @@ export default {
       const data = this.factor.filter((k) => {
         return k.id == e;
       })[0];
-      console.log(data, "kkkk");
+      // // consloe(data, "kkkk");
       this.pop = data.pop;
       this.popArr = data.pop.split(":");
 
@@ -896,52 +956,65 @@ export default {
       this.policyConditionId = data.id;
     },
     //引用销售政策搜索
-    handlePolicyTypeList() {
-      if (this.screenForm.factorId && this.screenForm.factorId) {
-        this.getConditionList(this.policyConditionId, this.cusIndex + 1);
-        this.dataList = []
+    async handlePolicyTypeList() {
+      if (this.popArr.length) {
+        this.popDataArr = [];
+        this.dataList = [];
+
+        for (let i = 0; i < this.popArr.length; i++) {
+          await this.getConditionList(this.policyConditionId, i + 1, true);
+        }
       } else {
         // sProvision = true
         this.getMaterialTypeList("sProvision");
-
       }
     },
     // 获取某一个比例下的数据 ,查询popType 当前 this.cusIndex+1
-    getConditionList(policyConditionId, popType) {
-      getConditionList({
+    async getConditionList(policyConditionId, popType, fang) {
+      const { data } = await getConditionList({
         pageNum: this.currentPage,
-        pageSize: this.pageSize,
+        pageSize: 10,
         policyConditionId,
         popType,
-      }).then((res) => {
-        const datas = res.data.records;
-        this.total = res.data.total;
-
-        if (this.goodsList.length) {
-          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) {
-                datas[q].disabled = true;
-              }
+      });
+      if (!fang) {
+        this.poptotal["total" + popType] = data.total;
+        this.popcun["cun" + popType] = 1;
+        this.popfun["handleSizeChange" + popType] = (val, index) => {
+          this.popcun["cun" + index] = val;
+          this.currentPage = 1;
+          this.getConditionList(this.policyConditionId, index, true);
+        };
+        this.popfun["handleCurrentChange" + popType] = (val, index) => {
+          this.popcun["cun" + index] = val;
+          this.getConditionList(this.policyConditionId, index, true);
+        };
+      }
+      const datas = data.records;
+      // this.total = data.total;
+      if (this.goodsList.length) {
+        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) {
+              datas[q].disabled = true;
             }
           }
         }
-        for (let i = 0; i < res.data.records.length; i++) {
-          res.data.records[i].qty = 1;
-        }
-        if (this.popDataArr.length) {
-          this.popDataArr.splice(this.cusIndex, 1);
-        }
-        if (this.cusIndex == 0) {
-          this.popDataArr = [];
-        }
+      }
+      for (let i = 0; i < data.records.length; i++) {
+        data.records[i].qty = 1;
+        // this.$set(data.records[i],'userList',this.userList)
+      }
+      if (fang) {
+        this.popDataArr[popType] = datas;
+      } else {
+        this.popDataArr.push(datas);
+      }
 
-        this.popDataArr = [...this.popDataArr, datas];
-      });
+      // consloe(this.popDataArr);
     },
     // 下一步获取某个政策条件比例数据
     handleCondition() {
-
       if (this.multipleSelection.length) {
         this.cusIndex += 1;
         this.disabled = true;
@@ -950,18 +1023,15 @@ export default {
       } else {
         this.$errorMsg("请选择");
       }
-       console.log(this.cusIndex,'下');
+      // // consloe(this.cusIndex,'下');
     },
-       // 上一步
+    // 上一步
     handleShang() {
-
       this.cusIndex == 0 ? (this.disabled = false) : "";
       this.multipleData.splice(this.cusIndex, 1);
-
-          this.popDataArr.splice(this.cusIndex, 1);
-
+      this.popDataArr.splice(this.cusIndex, 1);
       this.cusIndex -= 1;
-       console.log(this.cusIndex,'上');
+      // // consloe(this.cusIndex,'上');
     },
     /**
      * 根据条件禁用行复选框
@@ -979,7 +1049,7 @@ export default {
       // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
       // 如果没有返回值则默认返回false(全部无法选中)
     },
-   /**
+    /**
      * 根据条件禁用行复选框
      * 函数返回值为false则禁用选择(反之亦然)
      * @param {Object} row - 行数据
@@ -996,17 +1066,19 @@ export default {
       // 如果没有返回值则默认返回false(全部无法选中)
     },
 
-
     // 条件数据多选
-    handleSelectionChange(val) {
-      this.multipleSelection = val;
-      console.log(this.multipleSelection);
+    handleSelectionChange(val, type, index) {
+      if (type == 1) {
+        this.$set(this.multipleSelections, index, val);
+        // consloe(this.multipleSelections);
+      } else {
+        this.multipleSelection = val;
+      }
     },
     hanlePopData() {
       this.multipleData.push(this.multipleSelection);
       if (this.multipleData.length && this.multipleSelection.length) {
         let arrData = [];
-        console.log(this.multipleData, "datga");
         for (let i = 0; i < this.multipleData.length; i++) {
           arrData = [...arrData, ...this.multipleData[i]];
         }
@@ -1015,22 +1087,73 @@ export default {
         } else {
           this.goodsList = arrData;
         }
+
+        if (this.dataList.length) {
+          for (let u = 0; u < this.goodsList.length; u++) {
+            this.goodsList[u].disabled = true;
+          }
+          this.newDataList = this.multipleSelection;
+          this.disabled = true;
+        }
         this.goodsList.forEach((item) => {
           this.$set(item, "status1", "");
           this.$set(item, "status2", "");
+          this.$set(item, "userList", this.userList);
         });
+
+          if (this.goodsList.length &&  this.goodsList[0].wallets.length ) {
+              this.mainForm.k3ServiceName = this.goodsList[0].wallets[0].serviceId || '';
+             this.mainForm.k3ServiceId = this.goodsList[0].wallets[0].serviceId || '';
+          }
+
         this.cusIndex = 0;
         this.total = 0;
         this.popDataArr = [];
-        if ( this.dataList.length) {
-              this.newDataList = this.multipleSelection
-              this.dataList = []
-              this.disabled = true
+        this.multipleData = [];
+        this.multipleSelection = [];
+        this.policyId = this.screenForm.policyId;
+
+        this.isShowDialog = false;
+        this.$refs.singleTable.clearSelection();
+
+        // consloe(this.goodsList, "kkkk");
+      } else if (this.multipleSelections.length) {
+        let arrData = [];
+        for (let i = 0; i < this.multipleSelections.length; i++) {
+          for (let j = 0; j < this.multipleSelections[i].length; j++) {
+            this.multipleSelections[i][j].disabled = true;
+            arrData = [...arrData, this.multipleSelections[i][j]];
+          }
+        }
+        if (this.goodsList.length) {
+          this.goodsList = [...this.goodsList, ...arrData];
+        } else {
+          this.goodsList = arrData;
         }
 
+         if (this.goodsList.length &&  this.goodsList[0].wallets.length ) {
+              this.mainForm.k3ServiceName = this.goodsList[0].wallets[0].serviceId || '';
+             this.mainForm.k3ServiceId = this.goodsList[0].wallets[0].serviceId || '';
+          }
+
+        this.goodsList.forEach((item) => {
+          this.$set(item, "status1", "");
+          this.$set(item, "status2", "");
+          this.$set(item, "userList", this.userList);
+        });
+        this.disabled = true;
+        // this.popDataArr = [];
         this.multipleData = [];
+        this.multipleSelection = [];
         this.policyId = this.screenForm.policyId;
+
         this.isShowDialog = false;
+        this.$refs.singleTable.forEach((k) => {
+          k.clearSelection();
+        });
+
+
+        // this.$refs.singleTable.clearSelection();
       } else {
         this.$errorMsg("请选择");
       }
@@ -1042,9 +1165,20 @@ export default {
         this.mainForm.date = data.theTime;
         this.mainForm.type = data.mainId;
         this.mainForm.remark = data.remark;
+        this.mainForm.policyId = data.policyId;
+        this.mainForm.k3ServiceName = data.k3ServiceId;
+        this.mainForm.k3ServiceId = data.k3ServiceId;
         data.retailOrderItemList.forEach((item) => {
           item.status1 = "";
           item.status2 = "";
+          item.wallets.forEach((k) => {
+            if (k.customerWalletId === data.customerWalletId) {
+              this.$set(item, "serviceId", k.serviceId);
+              this.$set(item, "serviceName", k.serviceId);
+            }
+          });
+
+          this.$set(item, "userList", this.userList);
         });
         this.goodsList = data.retailOrderItemList;
       });
@@ -1057,9 +1191,10 @@ export default {
         status: true,
       }).then((res) => {
         this.screenForm.policyId = res.data.records[0].code;
-        this.handlePolicy(this.screenForm.policyId);
         this.policyList = res.data.records;
-        console.log(this.policyList, "policyList");
+        if (this.policyList.length) {
+          this.handlePolicy(this.screenForm.policyId);
+        }
       });
     },
     // 获取销售类型
@@ -1073,7 +1208,7 @@ export default {
       };
       typeList(params).then((res) => {
         this.ztypeList = res.data.records;
-        console.log(this.ztypeList, "type1111");
+        // // consloe(this.ztypeList, "type1111");
       });
     },
     // 获取仓库列表
@@ -1095,10 +1230,11 @@ export default {
       }).then((res) => {
         for (let i = 0; i < res.data.records.length; i++) {
           res.data.records[i].qty = 1;
+          data.records[i].userList = this.userList;
         }
+
         this.dataList = res.data.records;
         this.total = res.data.total;
-        console.log(this.dataList, "kkkk");
       });
     },
     // 获取政策列表
@@ -1112,25 +1248,25 @@ export default {
       }).then((res) => {
         for (let i = 0; i < res.data.records.length; i++) {
           res.data.records[i].qty = 1;
-            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;
-                }
-
+          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;
             }
+          }
         }
         this.dataList = res.data.records;
         this.total = res.data.total;
-        console.log(this.dataList, "kkkk");
+        this.popDataArr = [];
+        this.popArr = [];
+        // // consloe(this.dataList, "kkkk");
       });
     },
-
+    // 打开引用
     handleShow() {
       this.isShowDialog = true;
-      if (!this.goodsList.length) {
-          this.getPolicyList();
+      if (!this.dataList.length) {
+        this.getPolicyList();
       }
-
     },
     // 获取钱包列表
     getWalletList() {
@@ -1242,6 +1378,7 @@ export default {
     // 关闭 弹窗
     closeDialog() {
       this.isShowDialog = false;
+      this.popDataArr = [];
     },
 
     // 删除
@@ -1300,22 +1437,20 @@ export default {
       this.getConditionList(this.policyConditionId, this.cusIndex + 1);
     },
     handleClose() {
-      this.cusIndex = 0;
-      this.radio = "";
-      this.dataList = [];
-      this.popDataArr = [];
+      // this.dataList = [];
+      // this.popDataArr = [];
       // this.screenForm.policyId = "";
       // this.screenForm.saleTypeCode = "";
     },
     // 删除产品
-    deleteItem(index,id) {
+    deleteItem(index, id) {
       this.goodsList.splice(index, 1);
       // this.dataList
       if (this.newDataList.length) {
-         this.newDataList.splice(index, 1);
+        this.newDataList.splice(index, 1);
       }
       if (!this.goodsList.length) {
-          this.disabled = false
+        this.disabled = false;
       }
 
       // this.popDataArr.splice(index,1)
@@ -1352,7 +1487,7 @@ export default {
           this.goodsList.forEach((item, index) => {
             item.status1 = res.data[index].allStockNum;
             item.status2 = res.data[index].stockNum;
-            console.log(item.status1, item.status2);
+            // // consloe(item.status1, item.status2);
           });
         }
       });
@@ -1377,7 +1512,8 @@ export default {
           //   ].dictValue;
           let params = {
             theTime: this.mainForm.date,
-
+            k3ServiceId:this.mainForm.k3ServiceId,
+            k3ServiceName:this.mainForm.k3ServiceName,
             remark: this.mainForm.remark,
             type: 2, // 1:普通零售单,2:政策零售单
             retailOrderItemList: this.goodsList,
@@ -1392,7 +1528,6 @@ export default {
             });
           } else {
             addData(params).then((res) => {
-              console.log(5585);
               this.$successMsg("添加成功");
               this.goBack();
               this.$parent.getList();

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

@@ -496,7 +496,7 @@ import {
   submitCancel,
 } from "@/api/supply/policy";
 import RetailDetail from "./components/retail_detail";
-import RetailForm from "./components/retail_form2";
+import RetailForm from "./components/retail_form";
 import RetailExamine from "./components/retail_examine";
 import RetailReturn from "./components/retail_return";
 import EditDateDialog from "@/components/Common/edit-date-dialog";