|  | @@ -19,30 +19,6 @@
 | 
	
		
			
				|  |  |      <div class="dialog">
 | 
	
		
			
				|  |  |        <div>
 | 
	
		
			
				|  |  |          <el-form :model="form" ref="form" size="small" :rules="rules" :inline="true" label-width="100px">
 | 
	
		
			
				|  |  | -          <!-- <el-form-item label="门店POIID" prop="poiId">
 | 
	
		
			
				|  |  | -            <el-input
 | 
	
		
			
				|  |  | -              v-model="form.poiId"
 | 
	
		
			
				|  |  | -              placeholder="请输入门店POIID"
 | 
	
		
			
				|  |  | -              clearable
 | 
	
		
			
				|  |  | -              style="width: 240px"
 | 
	
		
			
				|  |  | -              @keyup.enter.native="handleQuery"
 | 
	
		
			
				|  |  | -            />
 | 
	
		
			
				|  |  | -          </el-form-item>
 | 
	
		
			
				|  |  | -          <el-form-item label="商品类目ID" prop="categoryId">
 | 
	
		
			
				|  |  | -            <el-select
 | 
	
		
			
				|  |  | -              v-model="form.categoryId"
 | 
	
		
			
				|  |  | -              placeholder="商品类目ID"
 | 
	
		
			
				|  |  | -              clearable
 | 
	
		
			
				|  |  | -              style="width: 240px"
 | 
	
		
			
				|  |  | -            >
 | 
	
		
			
				|  |  | -              <el-option
 | 
	
		
			
				|  |  | -                v-for="dict in dict.type.tiktok_category"
 | 
	
		
			
				|  |  | -                :key="dict.value"
 | 
	
		
			
				|  |  | -                :label="dict.label"
 | 
	
		
			
				|  |  | -                :value="dict.value"
 | 
	
		
			
				|  |  | -              />
 | 
	
		
			
				|  |  | -            </el-select>
 | 
	
		
			
				|  |  | -          </el-form-item> -->
 | 
	
		
			
				|  |  |          </el-form>
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |        <el-table 
 | 
	
	
		
			
				|  | @@ -68,7 +44,7 @@
 | 
	
		
			
				|  |  |            <el-button
 | 
	
		
			
				|  |  |              size="mini"
 | 
	
		
			
				|  |  |              type="text"
 | 
	
		
			
				|  |  | -            v-if="scope.row.status === 1"
 | 
	
		
			
				|  |  | +            v-if="scope.row.status"
 | 
	
		
			
				|  |  |              @click="openCalendarFun(scope.row)"
 | 
	
		
			
				|  |  |            >日历价格配置</el-button>
 | 
	
		
			
				|  |  |            <!-- <el-button
 | 
	
	
		
			
				|  | @@ -110,7 +86,7 @@
 | 
	
		
			
				|  |  |            <template
 | 
	
		
			
				|  |  |              slot="dateCell"
 | 
	
		
			
				|  |  |              slot-scope="{date, data}">
 | 
	
		
			
				|  |  | -            <div :class="['calendar_box', selectTime(data)]" @mouseover="mouseoverFun(data)" @click="clickTimeFun(data)">
 | 
	
		
			
				|  |  | +            <div :class="['calendar_box', selectTime(data)]" @mouseover="mouseoverFun(data)" @click.stop="clickTimeFun(data)">
 | 
	
		
			
				|  |  |                <span>{{ data.day.split('-').slice(1).join('-') }}</span>
 | 
	
		
			
				|  |  |                <div style="width: 100%; display: flex;flex-wrap: wrap;" >
 | 
	
		
			
				|  |  |                  <div 
 | 
	
	
		
			
				|  | @@ -169,7 +145,7 @@
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | -import { pushById,getCalendarPriceApi,setCalendarPriceApi,getPushListApi } from "@/api/otaMr/ctrip";
 | 
	
		
			
				|  |  | +import { pushById,getCalendarPriceApi,setCalendarPriceApi,getPushListApi,deleteCalendarPriceApi } from "@/api/otaMr/ctrip";
 | 
	
		
			
				|  |  |  import moment from "moment"
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |    name: "dataEdit",
 | 
	
	
		
			
				|  | @@ -438,13 +414,50 @@ export default {
 | 
	
		
			
				|  |  |        
 | 
	
		
			
				|  |  |      },  
 | 
	
		
			
				|  |  |      /** 一键清除  */
 | 
	
		
			
				|  |  | -    clearCalendarPrice() {
 | 
	
		
			
				|  |  | -      this.formPrice = {
 | 
	
		
			
				|  |  | -        originalAmount: 0,
 | 
	
		
			
				|  |  | -        saleAmount: 0,
 | 
	
		
			
				|  |  | -        costAmount: 0
 | 
	
		
			
				|  |  | +    async clearCalendarPrice() {
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        if( this.timeValueObj.prev && this.timeValueObj.next ) {
 | 
	
		
			
				|  |  | +          let minTime = moment(this.timeValueObj.prev).valueOf()
 | 
	
		
			
				|  |  | +          let maxTime = moment(this.timeValueObj.next).valueOf()
 | 
	
		
			
				|  |  | +          let startDate = null
 | 
	
		
			
				|  |  | +          let endDate = null
 | 
	
		
			
				|  |  | +          if(minTime > maxTime){
 | 
	
		
			
				|  |  | +            startDate = this.timeValueObj.next
 | 
	
		
			
				|  |  | +            endDate = this.timeValueObj.prev
 | 
	
		
			
				|  |  | +          }else {
 | 
	
		
			
				|  |  | +            startDate = this.timeValueObj.prev
 | 
	
		
			
				|  |  | +            endDate = this.timeValueObj.next
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          let daysList = [];
 | 
	
		
			
				|  |  | +          let SDate = moment(startDate);
 | 
	
		
			
				|  |  | +          let EDate = moment(endDate);
 | 
	
		
			
				|  |  | +          daysList.push({
 | 
	
		
			
				|  |  | +              "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({
 | 
	
		
			
				|  |  | +              "priceDate": EDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +          let res = await deleteCalendarPriceApi({
 | 
	
		
			
				|  |  | +            "id": this.form.id,
 | 
	
		
			
				|  |  | +            "goodsId": this.form.goodsId,
 | 
	
		
			
				|  |  | +            "seatTypeId": this.seatTypeId,
 | 
	
		
			
				|  |  | +            "data": daysList
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +          if(res.code == 200) {
 | 
	
		
			
				|  |  | +            this.openPrice = false
 | 
	
		
			
				|  |  | +            this.getCalendarPrice()
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +          this.$message.error("请选择时间区间!!!");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      } catch (error) {
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      this.calendarPrice()
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      submitFormPrice(formName,funName) {
 | 
	
		
			
				|  |  |          this.$refs[formName].validate((valid) => {
 | 
	
	
		
			
				|  | @@ -495,6 +508,7 @@ export default {
 | 
	
		
			
				|  |  |            let SDate = moment(startDate);
 | 
	
		
			
				|  |  |            let EDate = moment(endDate);
 | 
	
		
			
				|  |  |            daysList.push({
 | 
	
		
			
				|  |  | +              "id": null,
 | 
	
		
			
				|  |  |                "priceDate":  SDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
 | 
	
		
			
				|  |  |                "originalAmount": this.formPrice.originalAmount,
 | 
	
		
			
				|  |  |                "saleAmount": this.formPrice.saleAmount,
 | 
	
	
		
			
				|  | @@ -502,6 +516,7 @@ export default {
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |            while (SDate.add(1, "days").isBefore(EDate)) { // 注意这里add方法处理后SDate对象已经改变。      
 | 
	
		
			
				|  |  |              daysList.push({
 | 
	
		
			
				|  |  | +              "id": null,
 | 
	
		
			
				|  |  |                "priceDate":  SDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
 | 
	
		
			
				|  |  |                "originalAmount": this.formPrice.originalAmount,
 | 
	
		
			
				|  |  |                "saleAmount": this.formPrice.saleAmount,
 | 
	
	
		
			
				|  | @@ -509,12 +524,20 @@ export default {
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |            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)=>{
 | 
	
		
			
				|  |  | +              if(moment(item.priceDate).format("YYYY-MM-DD") == moment(item1.priceDate).format("YYYY-MM-DD") ) {
 | 
	
		
			
				|  |  | +                daysList[index].id = item1.id
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  |            let res = await setCalendarPriceApi({
 | 
	
		
			
				|  |  |              "id": this.form.id,
 | 
	
		
			
				|  |  |              "goodsId": this.form.goodsId,
 | 
	
	
		
			
				|  | @@ -537,11 +560,15 @@ export default {
 | 
	
		
			
				|  |  |      /** 选中得时间  */
 | 
	
		
			
				|  |  |      selectTime(data) {
 | 
	
		
			
				|  |  |        let srt = ''
 | 
	
		
			
				|  |  | +      let newTime = moment(data.day).startOf('day').valueOf()
 | 
	
		
			
				|  |  | +      let newTime1 = moment().startOf('day').valueOf()
 | 
	
		
			
				|  |  | +      if(newTime < newTime1 ) {
 | 
	
		
			
				|  |  | +        return "disable_time"
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        if( this.timeValueObj ) {
 | 
	
		
			
				|  |  |          if( this.timeValueObj.prev && this.timeValueObj.next ) {
 | 
	
		
			
				|  |  |            let minTime = moment(this.timeValueObj.prev).valueOf()
 | 
	
		
			
				|  |  |            let maxTime = moment(this.timeValueObj.next).valueOf()
 | 
	
		
			
				|  |  | -          let newTime = moment(data.day).valueOf()
 | 
	
		
			
				|  |  |            if(minTime > maxTime){
 | 
	
		
			
				|  |  |              if(minTime >= newTime && maxTime <= newTime){
 | 
	
		
			
				|  |  |                srt = 'is-select_time'
 | 
	
	
		
			
				|  | @@ -554,7 +581,6 @@ export default {
 | 
	
		
			
				|  |  |          }else if( this.timeValueObj.prev && !this.timeValueObj.next && this.timeValueObj.hover ){
 | 
	
		
			
				|  |  |            let minTime = moment(this.timeValueObj.prev).valueOf()
 | 
	
		
			
				|  |  |            let maxTime = moment(this.timeValueObj.hover).valueOf()
 | 
	
		
			
				|  |  | -          let newTime = moment(data.day).valueOf()
 | 
	
		
			
				|  |  |            if(minTime > maxTime){
 | 
	
		
			
				|  |  |              if(minTime >= newTime && maxTime <= newTime){
 | 
	
		
			
				|  |  |                srt = 'is-select_time_hover'
 | 
	
	
		
			
				|  | @@ -569,6 +595,14 @@ export default {
 | 
	
		
			
				|  |  |        return srt
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      clickTimeFun(data) {
 | 
	
		
			
				|  |  | +      let newTime1 = moment(data.day).startOf('day').valueOf()
 | 
	
		
			
				|  |  | +      let newTime = moment().startOf('day').valueOf()
 | 
	
		
			
				|  |  | +      if(newTime1 < newTime ) {
 | 
	
		
			
				|  |  | +        return 
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      if(moment(data.day).format("YYYY-MM") != moment(this.timeValue).format("YYYY-MM") ) {
 | 
	
		
			
				|  |  | +        return
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        if( !this.timeValueObj || !this.timeValueObj.prev ) {
 | 
	
		
			
				|  |  |          this.timeValueObj.prev = moment(data.day).format("YYYY-MM-DD")
 | 
	
		
			
				|  |  |        }else if( this.timeValueObj.prev && !this.timeValueObj.next ){
 | 
	
	
		
			
				|  | @@ -579,6 +613,9 @@ export default {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      mouseoverFun(data) {
 | 
	
		
			
				|  |  | +      if(moment(data.day).format("YYYY-MM") != moment(this.timeValue).format("YYYY-MM") ) {
 | 
	
		
			
				|  |  | +        return
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |        if( this.timeValueObj.prev && !this.timeValueObj.next ){
 | 
	
		
			
				|  |  |          this.timeValueObj.hover = moment(data.day).format("YYYY-MM-DD")
 | 
	
		
			
				|  |  |          this.timeValue = new Date(this.timeValueObj.hover)
 | 
	
	
		
			
				|  | @@ -587,6 +624,7 @@ export default {
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    watch:{
 | 
	
		
			
				|  |  |      timeValue(newValue,oldValue){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  };
 | 
	
	
		
			
				|  | @@ -621,17 +659,22 @@ export default {
 | 
	
		
			
				|  |  |  .calendar-dialog ::v-deep .el-calendar-table .el-calendar-day {
 | 
	
		
			
				|  |  |    padding: none !important;
 | 
	
		
			
				|  |  |    height: auto;
 | 
	
		
			
				|  |  | -  min-height: 86px;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  .calendar_box {
 | 
	
		
			
				|  |  |    width: 100%;
 | 
	
		
			
				|  |  | -  height: 100%;
 | 
	
		
			
				|  |  | +  min-height: 86px;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +.disable_time {
 | 
	
		
			
				|  |  | +  user-select: none;
 | 
	
		
			
				|  |  | +  cursor: not-allowed;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  .is-select_time {
 | 
	
		
			
				|  |  |    background-color: rgba(30,144,255,0.8);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  .is-select_time_hover {
 | 
	
		
			
				|  |  |    background-color: rgba(30,144,255,0.4);
 | 
	
		
			
				|  |  |  }
 |