howie hace 3 años
padre
commit
d5c83ddc6e
Se han modificado 1 ficheros con 17 adiciones y 11 borrados
  1. 17 11
      src/views/supply/policy/components/retail_form2.vue

+ 17 - 11
src/views/supply/policy/components/retail_form2.vue

@@ -354,7 +354,7 @@
               @click="(dialogVisible = true), (cid = scope.row.id)"
               >修改</el-button
             > -->
-            <el-button type="text" @click="deleteItem(scope.$index)"
+            <el-button type="text" @click="deleteItem(scope.$index,scope.row.id)"
               >删除</el-button
             >
           </template>
@@ -1092,10 +1092,7 @@ 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;
                 }
@@ -1110,7 +1107,10 @@ export default {
 
     handleShow() {
       this.isShowDialog = true;
-      this.getPolicyList();
+      if (!this.goodsList.length) {
+          this.getPolicyList();
+      }
+
     },
     // 获取钱包列表
     getWalletList() {
@@ -1284,13 +1284,20 @@ export default {
       this.radio = "";
       this.dataList = [];
       this.popDataArr = [];
-      this.screenForm.policyId = "";
-      this.screenForm.saleTypeCode = "";
+      // this.screenForm.policyId = "";
+      // this.screenForm.saleTypeCode = "";
     },
     // 删除产品
-    deleteItem(index) {
+    deleteItem(index,id) {
       this.goodsList.splice(index, 1);
-      console.log(this.multipleData);
+      // this.dataList
+      if (this.newDataList.length) {
+         this.newDataList.splice(index, 1);
+      }
+      if (!this.goodsList.length) {
+          this.disabled = false
+      }
+
       // this.popDataArr.splice(index,1)
     },
     // 修改返利钱包
@@ -1350,8 +1357,7 @@ export default {
           //   ].dictValue;
           let params = {
             theTime: this.mainForm.date,
-            mainId: this.mainForm.type,
-            mainName: "",
+
             remark: this.mainForm.remark,
             type: 2, // 1:普通零售单,2:政策零售单
             retailOrderItemList: this.goodsList,