Browse Source

1. 优化

MONSTER-ygh 1 month ago
parent
commit
bcc4ddbbf5
1 changed files with 8 additions and 4 deletions
  1. 8 4
      src/views/otaMr/ctrip/dialog/dataEdit.vue

+ 8 - 4
src/views/otaMr/ctrip/dialog/dataEdit.vue

@@ -433,16 +433,18 @@ export default {
           let SDate = moment(startDate);
           let EDate = moment(endDate);
           daysList.push({
-              "priceDate":  SDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
-            });
+            "priceDate":  SDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
+          });
           while (SDate.add(1, "days").isBefore(EDate)) { // 注意这里add方法处理后SDate对象已经改变。      
             daysList.push({
               "priceDate":  SDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
             });
           }
-          daysList.push({
+          if(this.timeValueObj.next != this.timeValueObj.prev){
+            daysList.push({
               "priceDate": EDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
             });
+          }
           let res = await deleteCalendarPriceApi({
             "id": this.form.id,
             "goodsId": this.form.goodsId,
@@ -526,13 +528,15 @@ export default {
               "costAmount": this.formPrice.costAmount
             });
           }
-          daysList.push({
+          if(this.timeValueObj.next != this.timeValueObj.prev){
+            daysList.push({
              "id": null,
               "priceDate": EDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
               "originalAmount": this.formPrice.originalAmount,
               "saleAmount": this.formPrice.saleAmount,
               "costAmount": this.formPrice.costAmount
             });
+          }
           console.log("daysList===",daysList)
           daysList.forEach((item,index)=>{
             this.perFormList.forEach((item1,index1)=>{