Browse Source

op增加复选框

yuanrf 1 year ago
parent
commit
2f5c9660b7
1 changed files with 16 additions and 19 deletions
  1. 16 19
      src/components/OP/CarTouristGuideGrounContent.vue

+ 16 - 19
src/components/OP/CarTouristGuideGrounContent.vue

@@ -231,7 +231,7 @@ export default {
             unitsArr: [],
             checkItems: ["车费", "导游费", "客户午餐费用", "导游景点费", "导游小费", "接送机费", "其他费用", "司机工资", "司机小费", "司机餐补", "车超时费", "导游餐补", "导游房补", "导游交通", "客户早餐费用", "客户晚餐费用", "景点门票费", "饮料/零食/水果", "住补费用", "翻译费"],
             checkList: [],
-            sourceList: []
+            sourceList: [],
         }
     },
     methods: {
@@ -261,7 +261,7 @@ export default {
                         }
                     }
 
-                    that.ContentList = res.data.data.carTouristGuides;
+                    //that.ContentList = res.data.data.carTouristGuides;
                     that.sourceList = res.data.data.carTouristGuides;
                     that.payment = res.data.data.payment;
 
@@ -286,6 +286,7 @@ export default {
                     }
 
                     that.checkList = res.data.data.checkedItem;
+                    that.checkBoxChange();
 
                     that.loading = false;
                     //that.OpCarTouristGuideGroundContenById()
@@ -384,10 +385,12 @@ export default {
                     var that = this
                     that.$refs.OPContenData.validate((valid) => {
                         if (valid) {
-                            that.OPContenData.diId = that.diId
-                            that.OPContenData.cTGGRId = that.id
-                            that.OPContenData.currency = that.currency
-                            that.OPContenData.CreateUserId = that.userId
+                            that.OPContenData.diId = that.diId;
+                            that.OPContenData.cTGGRId = that.id;
+                            that.OPContenData.currency = that.currency;
+                            that.OPContenData.CreateUserId = that.userId;
+                            that.OPContenData.selectCheck = that.checkList;
+                            that.OPContenData.OPContentList = [];
                             that.ContentList.forEach(function (item) {
                                 that.OPContenData.OPContentList.push({
                                     id: item.id,
@@ -446,22 +449,16 @@ export default {
 
             this.countCost = countCost
         },
-        checkBoxChange(value) {
-            console.log(value.length, this.checkList.length);
-            var index = 0
-
-            if (value.length > this.checkList.length) {
-                for (var item = 0; item < this.sourceList.length; item++) {
-                    if (value[value.length - 1] == this.sourceList.sidName) {
-                        index = item
+        checkBoxChange() {
+            this.ContentList = [];
+            for (var soure = 0; soure < this.sourceList.length; soure++) {
+                for (var item = 0; item < this.checkList.length; item++) {
+                    if (this.sourceList[soure].sidName == this.checkList[item]) {
+                        this.ContentList.push(this.sourceList[soure]);
                     }
                 }
-
-                this.ContentList.splice(index, this.sourceList[index])
-
-            } else {
-                this.ContentList = value
             }
+            this.PriceChange();
         }
     },