浏览代码

1. 新增日历价格

MONSTER-ygh 1 月之前
父节点
当前提交
e9ca2f0341

+ 13 - 10
src/api/otaMr/ctrip.js

@@ -35,6 +35,18 @@ export const stockUpdateById = (data) => {
   })
 }
 
+
+
+/** 系统-携程-ota(已推送商品sku查看)  */
+export const getPushListApi = (params) => {
+  return request({
+      url: '/thirdapi/xieche/product/list/push',
+      method: 'get',
+      params: params
+  })
+}
+
+
 /** 系统-携程-ota(日历价格-获取)  */
 export const getCalendarPriceApi = (data) => {
   return request({
@@ -53,16 +65,7 @@ export const setCalendarPriceApi = (data) => {
   })
 }
 
-/** 系统-携程-ota(已推送商品sku查看)  */
-export const getPushListApi = (params) => {
-  return request({
-      url: '/thirdapi/xieche/product/list/push',
-      method: 'get',
-      params: params
-  })
-}
-
-/** 系统-携程-ota(已推送商品sku查看)  */
+/** 系统-携程-ota(日历价格-删除)  */
 export const deleteCalendarPriceApi = (data) => {
   return request({
       url: '/thirdapi/xieche/product/calendar/delete',

+ 38 - 0
src/api/otaMr/meituan.js

@@ -33,4 +33,42 @@ export const stockUpdateById = (data) => {
       method: 'post',
       data: data
   })
+}
+
+
+/** 系统-携程-ota(已推送商品sku查看)  */
+export const getPushListApi = (params) => {
+  return request({
+      url: '/thirdapi/meituan/product/list/push',
+      method: 'get',
+      params: params
+  })
+}
+
+
+/** 系统-携程-ota(日历价格-获取)  */
+export const getCalendarPriceApi = (data) => {
+  return request({
+      url: '/thirdapi/meituan/product/calendar/get',
+      method: 'post',
+      data: data
+  })
+}
+
+/** 系统-携程-ota(日历价格-更新)  */
+export const setCalendarPriceApi = (data) => {
+  return request({
+      url: '/thirdapi/meituan/product/calendar',
+      method: 'post',
+      data: data
+  })
+}
+
+/** 系统-携程-ota(日历价格-删除)  */
+export const deleteCalendarPriceApi = (data) => {
+  return request({
+      url: '/thirdapi/meituan/product/calendar/delete',
+      method: 'delete',
+      data
+  })
 }

+ 38 - 0
src/api/otaMr/tiktok.js

@@ -34,4 +34,42 @@ export const stockUpdateById = (data) => {
       method: 'post',
       data: data
   })
+}
+
+
+/** 系统-携程-ota(已推送商品sku查看)  */
+export const getPushListApi = (params) => {
+  return request({
+      url: '/thirdapi/douyin/product/list/push',
+      method: 'get',
+      params: params
+  })
+}
+
+
+/** 系统-携程-ota(日历价格-获取)  */
+export const getCalendarPriceApi = (data) => {
+  return request({
+      url: '/thirdapi/douyin/product/calendar/get',
+      method: 'post',
+      data: data
+  })
+}
+
+/** 系统-携程-ota(日历价格-更新)  */
+export const setCalendarPriceApi = (data) => {
+  return request({
+      url: '/thirdapi/douyin/product/calendar',
+      method: 'post',
+      data: data
+  })
+}
+
+/** 系统-携程-ota(日历价格-删除)  */
+export const deleteCalendarPriceApi = (data) => {
+  return request({
+      url: '/thirdapi/douyin/product/calendar/delete',
+      method: 'delete',
+      data
+  })
 }

+ 6 - 1
src/views/otaMr/ctrip/dialog/dataEdit.vue

@@ -145,7 +145,12 @@
 </template>
 
 <script>
-import { pushById,getCalendarPriceApi,setCalendarPriceApi,getPushListApi,deleteCalendarPriceApi } from "@/api/otaMr/ctrip";
+import { 
+  pushById,
+  getCalendarPriceApi,
+  setCalendarPriceApi,
+  getPushListApi,
+  deleteCalendarPriceApi } from "@/api/otaMr/ctrip";
 import moment from "moment"
 export default {
   name: "dataEdit",

+ 400 - 34
src/views/otaMr/meituan/dialog/dataEdit.vue

@@ -55,18 +55,6 @@
         <el-table-column type="selection" width="55"></el-table-column>
         <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
         <el-table-column label="座位类型" align="center" prop="priceName" />
-        <el-table-column label="销售价" align="center" prop="actualAmount" width="250">
-          <template slot-scope="scope">
-            <span v-if="!isCheck(scope.row)">{{ scope.row.actualAmount }}</span>
-            <el-input-number v-else v-model="scope.row.actualAmount" controls-position="right"></el-input-number>
-          </template>
-        </el-table-column>
-        <el-table-column label="结算价" align="center" prop="originAmount" width="250">
-          <template slot-scope="scope">
-            <span v-if="!isCheck(scope.row)">{{ scope.row.originAmount }}</span>
-            <el-input-number v-else v-model="scope.row.originAmount" controls-position="right"></el-input-number>
-          </template>
-        </el-table-column>
         <el-table-column label="开始时间" align="center" prop="timeStart" />
         <el-table-column label="结束时间" align="center" prop="timeEnd" />
         <el-table-column label="美团排期状态" align="center" prop="status">
@@ -82,20 +70,97 @@
         type="primary"
         @click="submitForm"
         :disabled="!multipleSelection || multipleSelection.length == 0"
-        v-loading.fullscreen.lock="loading"
-        element-loading-text="提交中..."
-        element-loading-spinner="el-icon-loading"
-        element-loading-background="rgba(0, 0, 0, 0.8)"
+        :loading="loading"
       >
         <span v-if="loading">提交中...</span>
         <span v-else>推送已选</span>
       </el-button>
     </span>
+    <!--  选择日期 价格  -->
+    <el-dialog
+      :visible.sync="openCalendar"
+      width="70%"
+      class="text-dia-log-class"
+      append-to-body
+      :close-on-click-modal="false"
+      @close="openPrice = false"
+    >
+      <div class="dialog calendar-dialog" v-loading="calendarLoading">
+        <div>
+          <el-button type="primary" @click="openCalendarPrice()">价格设置</el-button>
+          <el-button type="primary" @click="clearCalendarPrice()">一键清空</el-button>
+        </div>
+        <el-calendar v-model="timeValue">
+          <template
+            slot="dateCell"
+            slot-scope="{date, 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 
+                :key="index"
+                v-for="(item,index) in getPerFormList(data)"
+                >
+                {{ item.title }}:{{ item.money }}
+                </div>
+              </div>
+              
+            </div>
+            
+          </template>
+        </el-calendar>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="openCalendar = false">返回</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 设置价格  -->
+    <el-dialog
+      title="价格设置"
+      :visible.sync="openPrice"
+      width="400px"
+      class="text-dia-log-class"
+      append-to-body
+      :close-on-click-modal="false"
+      @close="openPrice = false"
+    >
+      <div v-loading="priceLoading">
+        <el-form :model="formPrice" ref="formPrice" size="small" :rules="rulesPrice" label-width="100px">
+          <el-form-item label="日期区间">
+            {{ this.timeValueObj.prev +" - "+ this.timeValueObj.next }}
+          </el-form-item>
+          <el-form-item label="市场价" prop="originalAmount">
+            <el-input-number v-model="formPrice.originalAmount" controls-position="right" :min="0"></el-input-number>
+            元
+          </el-form-item>
+          <el-form-item label="销售价" prop="saleAmount">
+            <el-input-number v-model="formPrice.saleAmount" controls-position="right" :min="0"></el-input-number>
+            元
+          </el-form-item>
+          <el-form-item label="结算价" prop="costAmount">
+            <el-input-number v-model="formPrice.costAmount" controls-position="right" :min="0"></el-input-number>
+            元
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="openPrice = false">返回</el-button>
+        <el-button @click="submitFormPrice('formPrice','calendarPrice')">提交</el-button>
+      </span>
+    </el-dialog>
   </el-dialog>
 </template>
 
 <script>
-import { pushById } from "@/api/otaMr/meituan";
+import { 
+  pushById,
+  getCalendarPriceApi,
+  setCalendarPriceApi,
+  getPushListApi,
+  deleteCalendarPriceApi
+ } from "@/api/otaMr/meituan";
+import moment from "moment"
 export default {
   name: "dataEdit",
   dicts: ['tiktok_category','tiktok_scheduling_status'],
@@ -111,7 +176,28 @@ export default {
         poiId: [{ required: true, message: "请输入门店POIID", trigger: ["change","blur"] }],
         categoryId: [{ required: true, message: "请选择商品类目ID", trigger: ["change","blur"] }],
       },
-      multipleSelection: []
+      multipleSelection: [],
+
+      openCalendar: false,
+      timeValue: new Date(),
+      timeValueObj: {
+        prev: null,
+        next: null,
+        hover: null
+      },
+      calendarLoading: false,
+      perFormList: [],
+
+      openPrice: false,
+      priceLoading: false,
+      formPrice: {},
+      rulesPrice: {
+        originalAmount: [{ required: true, message: "请输入市场价", trigger: ["change","blur"] }],
+        saleAmount: [{ required: true, message: "请输入销售价", trigger: ["change","blur"] }],
+        costAmount: [{ required: true, message: "请输入结算价", trigger: ["change","blur"] }],
+      },
+      seatTypeId: null,
+      calendarId: null,
     };
   },
   methods: {
@@ -121,19 +207,15 @@ export default {
      * @param {any} obj
      * @returns {any}
      */
-    openDialog(title, obj, type) {
+    async openDialog(title, obj, type) {
       this.open = true;
+      this.goodsList = []
       this.multipleSelection = []
+      this.timeValueObj = {}
       this.form = JSON.parse(JSON.stringify(obj))
       
-      let list = []
-      obj.sku.forEach((item,index)=>{
-        list.push({
-          ...item,
-          tableId: "id_" + index
-        })
-      })
-      this.goodsList = JSON.parse(JSON.stringify(list))
+      await this.getPushListFun(obj,type)
+
       this.$nextTick(()=>{
         this.goodsList.forEach((item)=>{
           if(item.checkFlag == 1) {
@@ -142,6 +224,49 @@ export default {
         })
         this.$refs["form"].clearValidate()
       })
+    },
+     /**  获取设置的日历价格  */
+     async getPushListFun(obj,type) {
+      try {
+        let res = await getPushListApi({
+          id: obj.id
+        })
+        if(res.code == 200) {
+          let list = []
+          if(type == 'yesPush') {
+            list = res.data
+          }else {
+            if( res.data && res.data.length > 0){
+              obj.sku.forEach((item,index)=>{
+                let obj1 = JSON.parse(JSON.stringify(item))
+                res.data.forEach((item1,index1)=>{
+                  if(item1.id == obj1.id){
+                    obj1 =  JSON.parse(JSON.stringify(item1))
+                  }
+                  
+                })
+                list.push({
+                  ...obj1,
+                  tableId: "id_" + index
+                })
+              })
+              
+              this.goodsList = res.data
+            }else {
+              obj.sku.forEach((item,index)=>{
+                list.push({
+                  ...item,
+                  tableId: "id_" + index
+                })
+              })
+            }
+          }
+          
+          this.goodsList = JSON.parse(JSON.stringify(list))
+        }
+      } catch (error) {
+        this.loading = false
+      }
     },
     /**
      * 保存
@@ -163,14 +288,14 @@ export default {
                 ...item,
                 checkFlag: 1
               })
-              if((!item.actualAmount && item.actualAmount !=0) || (!item.originAmount && item.originAmount !=0)) {
-                flog = true
-              } 
+              // if((!item.actualAmount && item.actualAmount !=0) || (!item.originAmount && item.originAmount !=0)) {
+              //   flog = true
+              // } 
             })
-            if(flog) {
-              this.$message.error("请输入销售价和结算价!!!");
-              return
-            }
+            // if(flog) {
+            //   this.$message.error("请输入销售价和结算价!!!");
+            //   return
+            // }
             this.loading = true;
             const { code } = await pushById({ 
               ...this.form,
@@ -220,6 +345,247 @@ export default {
     handleSelectionChange(val) {
       console.log("选中了====", val)
       this.multipleSelection = val;
+    },
+
+    getPerFormList(data) {
+      let list = []
+      this.perFormList.forEach((item,index)=>{
+        if(item.priceDate && item.priceDate.indexOf(data.day) != -1) {
+          list = [
+            { title: '市场价', money: item.originalAmount + '元'  },
+            { title: '销售价', money: item.saleAmount + '元' },
+            { title: '结算价', money: item.costAmount + '元' },
+          ]
+        }
+      })
+      return list
+    },
+    /**  打开价格设置   */
+    openCalendarPrice(){
+      if( this.timeValueObj.prev && this.timeValueObj.next ) {
+        this.openPrice = true
+        this.formPrice = {}
+        this.$nextTick(()=>{
+          this.$refs.formPrice.clearValidate()
+        })
+      }else {
+        this.$message.error("请选择时间区间!!!");
+      }
+      
+    },  
+    /** 一键清除  */
+    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"),
+            });
+          }
+          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,
+            "seatTypeId": this.seatTypeId,
+            "data": daysList
+          })
+          if(res.code == 200) {
+            this.openPrice = false
+            this.getCalendarPrice()
+          }
+        }else {
+          this.$message.error("请选择时间区间!!!");
+        }
+      } catch (error) {
+        
+      }
+    },
+    submitFormPrice(formName,funName) {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            this[funName]()
+          } else {
+            console.log('error submit!!');
+            return false;
+          }
+        });
+    },
+    openCalendarFun(row){
+      this.seatTypeId = row.seatTypeId
+      this.calendarId = row.id
+      this.getCalendarPrice()
+      
+    },
+    /**  获取设置的日历价格  */
+    async getCalendarPrice() {
+      try {
+        this.timeValueObj = {}
+        let res = await getCalendarPriceApi({
+          "goodsId": this.form.goodsId,
+          "seatTypeId": this.seatTypeId
+        })
+        if(res.code == 200) {
+          this.openCalendar = true
+          this.perFormList = res.data
+        }
+      } catch (error) {
+        
+      }
+    },
+    /**  设置价格  */
+    async calendarPrice(type){
+      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({
+              "id": null,
+              "priceDate":  SDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
+              "originalAmount": this.formPrice.originalAmount,
+              "saleAmount": this.formPrice.saleAmount,
+              "costAmount": this.formPrice.costAmount
+            });
+          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,
+              "costAmount": this.formPrice.costAmount
+            });
+          }
+          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)=>{
+              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.calendarId,
+            "goodsId": this.form.goodsId,
+            "seatTypeId": this.seatTypeId,
+            "data": daysList
+          })
+          if(res.code == 200) {
+            this.openPrice = false
+            this.getCalendarPrice()
+          }
+        }else {
+          this.$message.error("请选择时间区间!!!");
+        }
+      } catch (error) {
+        
+      }
+      
+    },
+
+    /** 选中得时间  */
+    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()
+          if(minTime > maxTime){
+            if(minTime >= newTime && maxTime <= newTime){
+              srt = 'is-select_time'
+            }
+          }else {
+            if(minTime <= newTime && maxTime >= newTime){
+              srt = 'is-select_time'
+            }
+          }
+        }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()
+          if(minTime > maxTime){
+            if(minTime >= newTime && maxTime <= newTime){
+              srt = 'is-select_time_hover'
+            }
+          }else {
+            if(minTime <= newTime && maxTime >= newTime){
+              srt = 'is-select_time_hover'
+            }
+          }
+        }
+      }
+      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 ){
+        this.timeValueObj.next = moment(data.day).format("YYYY-MM-DD")
+      }else if( this.timeValueObj.prev && this.timeValueObj.next ) {
+        this.timeValueObj.prev = moment(data.day).format("YYYY-MM-DD")
+        this.timeValueObj.next = null
+      }
+    },
+    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)
+      }
     }
   },
 };

+ 11 - 3
src/views/otaMr/meituan/index.vue

@@ -35,10 +35,18 @@
               v-if="scope.row.status == 1"
             >日历库存推送</el-button>
           </span> -->
+          <span v-hasPermi="['otaMr:meituan:time']" style="display: inline-block;margin-right: 10px;">
+            <el-button
+              size="mini"
+              type="text"
+              style="margin-left: 10px;"
+              @click="handleUpdate(scope.row,'yesPush')"
+            >价格日历</el-button>
+          </span>
           <el-button
             size="mini"
             type="text"
-            @click="handleUpdate(scope.row,scope.index)"
+            @click="handleUpdate(scope.row,scope.index,'noPush')"
             v-hasPermi="['otaMr:meituan:scheduling']"
           >排期推送</el-button>
         </template>
@@ -148,8 +156,8 @@ export default {
       this.handleQuery();
     },
     /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.$refs["dataEdit"].openDialog("修改数据", row);
+    handleUpdate(row,type) {
+      this.$refs["dataEdit"].openDialog("修改数据", row,type);
     },
 
     /** 删除按钮操作 */

+ 440 - 35
src/views/otaMr/tiktok/dialog/dataEdit.vue

@@ -70,18 +70,6 @@
         <el-table-column type="selection" width="55"></el-table-column>
         <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
         <el-table-column label="座位类型" align="center" prop="priceName" />
-        <el-table-column label="销售价" align="center" prop="actualAmount" width="250">
-          <template slot-scope="scope">
-            <span v-if="!isCheck(scope.row)">{{ scope.row.actualAmount }}</span>
-            <el-input-number v-else v-model="scope.row.actualAmount" controls-position="right"></el-input-number>
-          </template>
-        </el-table-column>
-        <el-table-column label="划线价" align="center" prop="originAmount" width="250">
-          <template slot-scope="scope">
-            <span v-if="!isCheck(scope.row)">{{ scope.row.originAmount }}</span>
-            <el-input-number v-else v-model="scope.row.originAmount" controls-position="right"></el-input-number>
-          </template>
-        </el-table-column>
         <el-table-column label="开始时间" align="center" prop="timeStart" />
         <el-table-column label="结束时间" align="center" prop="timeEnd" />
         <el-table-column label="抖音排期状态" align="center" prop="status">
@@ -89,6 +77,21 @@
             <dict-tag :options="dict.type.tiktok_scheduling_status" :value="scope.row.status"/>
           </template>
         </el-table-column>
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          <template slot-scope="scope">
+            <el-button
+              size="mini"
+              type="text"
+              v-if="scope.row.status"
+              @click="openCalendarFun(scope.row)"
+            >日历价格配置</el-button>
+            <!-- <el-button
+              size="mini"
+              type="text"
+              @click="submitForm1(scope.row)"
+            >{{ scope.row.status == 1  ? '下架':'上架' }}</el-button> -->
+          </template>
+        </el-table-column>
       </el-table>
     </div>
     <span slot="footer" class="dialog-footer">
@@ -97,26 +100,104 @@
         type="primary"
         @click="submitForm"
         :disabled="!multipleSelection || multipleSelection.length == 0"
-        v-loading.fullscreen.lock="loading"
-        element-loading-text="提交中..."
-        element-loading-spinner="el-icon-loading"
-        element-loading-background="rgba(0, 0, 0, 0.8)"
+        :loading="loading"
       >
         <span v-if="loading">提交中...</span>
         <span v-else>推送已选</span>
       </el-button>
     </span>
+
+    <!--  选择日期 价格  -->
+    <el-dialog
+      :visible.sync="openCalendar"
+      width="70%"
+      class="text-dia-log-class"
+      append-to-body
+      :close-on-click-modal="false"
+      @close="openPrice = false"
+    >
+      <div class="dialog calendar-dialog" v-loading="calendarLoading">
+        <div>
+          <el-button type="primary" @click="openCalendarPrice()">价格设置</el-button>
+          <el-button type="primary" @click="clearCalendarPrice()">一键清空</el-button>
+        </div>
+        <el-calendar v-model="timeValue">
+          <template
+            slot="dateCell"
+            slot-scope="{date, 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 
+                :key="index"
+                v-for="(item,index) in getPerFormList(data)"
+                >
+                {{ item.title }}:{{ item.money }}
+                </div>
+              </div>
+              
+            </div>
+            
+          </template>
+        </el-calendar>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="openCalendar = false">返回</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 设置价格  -->
+    <el-dialog
+      title="价格设置"
+      :visible.sync="openPrice"
+      width="400px"
+      class="text-dia-log-class"
+      append-to-body
+      :close-on-click-modal="false"
+      @close="openPrice = false"
+    >
+      <div v-loading="priceLoading">
+        <el-form :model="formPrice" ref="formPrice" size="small" :rules="rulesPrice" label-width="100px">
+          <el-form-item label="日期区间">
+            {{ this.timeValueObj.prev +" - "+ this.timeValueObj.next }}
+          </el-form-item>
+          <el-form-item label="市场价" prop="originalAmount">
+            <el-input-number v-model="formPrice.originalAmount" controls-position="right" :min="0"></el-input-number>
+            元
+          </el-form-item>
+          <el-form-item label="销售价" prop="saleAmount">
+            <el-input-number v-model="formPrice.saleAmount" controls-position="right" :min="0"></el-input-number>
+            元
+          </el-form-item>
+          <el-form-item label="结算价" prop="costAmount">
+            <el-input-number v-model="formPrice.costAmount" controls-position="right" :min="0"></el-input-number>
+            元
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="openPrice = false">返回</el-button>
+        <el-button @click="submitFormPrice('formPrice','calendarPrice')">提交</el-button>
+      </span>
+    </el-dialog>
   </el-dialog>
 </template>
 
 <script>
-import { pushById } from "@/api/otaMr/tiktok";
+import { 
+  pushById,
+  getCalendarPriceApi,
+  setCalendarPriceApi,
+  getPushListApi,
+  deleteCalendarPriceApi
+ } from "@/api/otaMr/tiktok";
+ import moment from "moment"
 export default {
   name: "dataEdit",
   dicts: ['tiktok_category','tiktok_scheduling_status','tiktok_showChannel'],
   data() {
     return {
-      title: "编辑",
+      title: "排期推送设置",
       model: "EDIT",
       open: false,
       loading: false,
@@ -127,7 +208,28 @@ export default {
         categoryId: [{ required: true, message: "请选择商品类目ID", trigger: ["change","blur"] }],
         showChannel: [{ required: true, message: "请选择投放渠道", trigger: ["change","blur"] }]
       },
-      multipleSelection: []
+      multipleSelection: [],
+
+      openCalendar: false,
+      timeValue: new Date(),
+      timeValueObj: {
+        prev: null,
+        next: null,
+        hover: null
+      },
+      calendarLoading: false,
+      perFormList: [],
+
+      openPrice: false,
+      priceLoading: false,
+      formPrice: {},
+      rulesPrice: {
+        originalAmount: [{ required: true, message: "请输入市场价", trigger: ["change","blur"] }],
+        saleAmount: [{ required: true, message: "请输入销售价", trigger: ["change","blur"] }],
+        costAmount: [{ required: true, message: "请输入结算价", trigger: ["change","blur"] }],
+      },
+      seatTypeId: null,
+      calendarId: null,
     };
   },
   methods: {
@@ -137,22 +239,18 @@ export default {
      * @param {any} obj
      * @returns {any}
      */
-    openDialog(title, obj, type) {
+     async openDialog(title, obj, type) {
       this.open = true;
+      tthis.goodsList = []
       this.multipleSelection = []
+      this.timeValueObj = {}
       if(obj.showChannel || obj.showChannel === 0) {
         obj.showChannel = obj.showChannel.toString()
       }
       this.form = JSON.parse(JSON.stringify(obj))
       
-      let list = []
-      obj.sku.forEach((item,index)=>{
-        list.push({
-          ...item,
-          tableId: "id_" + index
-        })
-      })
-      this.goodsList = JSON.parse(JSON.stringify(list))
+      await this.getPushListFun(obj,type)
+
       this.$nextTick(()=>{
         this.goodsList.forEach((item)=>{
           if(item.checkFlag == 1) {
@@ -162,6 +260,49 @@ export default {
         this.$refs["form"].clearValidate()
       })
     },
+    /**  获取设置的日历价格  */
+    async getPushListFun(obj,type) {
+      try {
+        let res = await getPushListApi({
+          id: obj.id
+        })
+        if(res.code == 200) {
+          let list = []
+          if(type == 'yesPush') {
+            list = res.data
+          }else {
+            if( res.data && res.data.length > 0){
+              obj.sku.forEach((item,index)=>{
+                let obj1 = JSON.parse(JSON.stringify(item))
+                res.data.forEach((item1,index1)=>{
+                  if(item1.id == obj1.id){
+                    obj1 =  JSON.parse(JSON.stringify(item1))
+                  }
+                  
+                })
+                list.push({
+                  ...obj1,
+                  tableId: "id_" + index
+                })
+              })
+              
+              this.goodsList = res.data
+            }else {
+              obj.sku.forEach((item,index)=>{
+                list.push({
+                  ...item,
+                  tableId: "id_" + index
+                })
+              })
+            }
+          }
+          
+          this.goodsList = JSON.parse(JSON.stringify(list))
+        }
+      } catch (error) {
+        this.loading = false
+      }
+    },
     /**
      * 保存
      * @date 2023-11-22
@@ -182,14 +323,14 @@ export default {
                 ...item,
                 checkFlag: 1
               })
-              if((!item.actualAmount && item.actualAmount !=0) || (!item.originAmount && item.originAmount !=0)) {
-                flog = true
-              } 
+              // if((!item.actualAmount && item.actualAmount !=0) || (!item.originAmount && item.originAmount !=0)) {
+              //   flog = true
+              // } 
             })
-            if(flog) {
-              this.$message.error("请输入销售价和结算价!!!");
-              return
-            }
+            // if(flog) {
+            //   this.$message.error("请输入销售价和结算价!!!");
+            //   return
+            // }
             this.loading = true;
             const { code } = await pushById({ 
               ...this.form,
@@ -239,6 +380,247 @@ export default {
     handleSelectionChange(val) {
       console.log("选中了====", val)
       this.multipleSelection = val;
+    },
+
+    getPerFormList(data) {
+      let list = []
+      this.perFormList.forEach((item,index)=>{
+        if(item.priceDate && item.priceDate.indexOf(data.day) != -1) {
+          list = [
+            { title: '市场价', money: item.originalAmount + '元'  },
+            { title: '销售价', money: item.saleAmount + '元' },
+            { title: '结算价', money: item.costAmount + '元' },
+          ]
+        }
+      })
+      return list
+    },
+    /**  打开价格设置   */
+    openCalendarPrice(){
+      if( this.timeValueObj.prev && this.timeValueObj.next ) {
+        this.openPrice = true
+        this.formPrice = {}
+        this.$nextTick(()=>{
+          this.$refs.formPrice.clearValidate()
+        })
+      }else {
+        this.$message.error("请选择时间区间!!!");
+      }
+      
+    },  
+    /** 一键清除  */
+    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"),
+            });
+          }
+          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,
+            "seatTypeId": this.seatTypeId,
+            "data": daysList
+          })
+          if(res.code == 200) {
+            this.openPrice = false
+            this.getCalendarPrice()
+          }
+        }else {
+          this.$message.error("请选择时间区间!!!");
+        }
+      } catch (error) {
+        
+      }
+    },
+    submitFormPrice(formName,funName) {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            this[funName]()
+          } else {
+            console.log('error submit!!');
+            return false;
+          }
+        });
+    },
+    openCalendarFun(row){
+      this.seatTypeId = row.seatTypeId
+      this.calendarId = row.id
+      this.getCalendarPrice()
+      
+    },
+    /**  获取设置的日历价格  */
+    async getCalendarPrice() {
+      try {
+        this.timeValueObj = {}
+        let res = await getCalendarPriceApi({
+          "goodsId": this.form.goodsId,
+          "seatTypeId": this.seatTypeId
+        })
+        if(res.code == 200) {
+          this.openCalendar = true
+          this.perFormList = res.data
+        }
+      } catch (error) {
+        
+      }
+    },
+    /**  设置价格  */
+    async calendarPrice(type){
+      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({
+              "id": null,
+              "priceDate":  SDate.startOf('day').format("YYYY-MM-DD HH:mm:ss"),
+              "originalAmount": this.formPrice.originalAmount,
+              "saleAmount": this.formPrice.saleAmount,
+              "costAmount": this.formPrice.costAmount
+            });
+          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,
+              "costAmount": this.formPrice.costAmount
+            });
+          }
+          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)=>{
+              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.calendarId,
+            "goodsId": this.form.goodsId,
+            "seatTypeId": this.seatTypeId,
+            "data": daysList
+          })
+          if(res.code == 200) {
+            this.openPrice = false
+            this.getCalendarPrice()
+          }
+        }else {
+          this.$message.error("请选择时间区间!!!");
+        }
+      } catch (error) {
+        
+      }
+      
+    },
+
+    /** 选中得时间  */
+    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()
+          if(minTime > maxTime){
+            if(minTime >= newTime && maxTime <= newTime){
+              srt = 'is-select_time'
+            }
+          }else {
+            if(minTime <= newTime && maxTime >= newTime){
+              srt = 'is-select_time'
+            }
+          }
+        }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()
+          if(minTime > maxTime){
+            if(minTime >= newTime && maxTime <= newTime){
+              srt = 'is-select_time_hover'
+            }
+          }else {
+            if(minTime <= newTime && maxTime >= newTime){
+              srt = 'is-select_time_hover'
+            }
+          }
+        }
+      }
+      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 ){
+        this.timeValueObj.next = moment(data.day).format("YYYY-MM-DD")
+      }else if( this.timeValueObj.prev && this.timeValueObj.next ) {
+        this.timeValueObj.prev = moment(data.day).format("YYYY-MM-DD")
+        this.timeValueObj.next = null
+      }
+    },
+    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)
+      }
     }
   },
 };
@@ -270,4 +652,27 @@ export default {
     cursor: pointer;
   }
 }
+
+.calendar-dialog ::v-deep .el-calendar-table .el-calendar-day {
+  padding: none !important;
+  height: auto;
+}
+
+.calendar_box {
+  width: 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);
+}
 </style>

+ 11 - 3
src/views/otaMr/tiktok/index.vue

@@ -72,10 +72,18 @@
               v-if="scope.row.status == 1"
             >日历库存推送</el-button>
           </span>
+          <span v-hasPermi="['otaMr:tiktok:time']" style="display: inline-block;margin-right: 10px;">
+            <el-button
+              size="mini"
+              type="text"
+              style="margin-left: 10px;"
+              @click="handleUpdate(scope.row,'yesPush')"
+            >价格日历</el-button>
+          </span>
           <el-button
             size="mini"
             type="text"
-            @click="handleUpdate(scope.row,scope.index)"
+            @click="handleUpdate(scope.row,scope.index,'noPush')"
             v-hasPermi="['otaMr:tiktok:scheduling']"
           >排期推送</el-button>
         </template>
@@ -186,8 +194,8 @@ export default {
       this.handleQuery();
     },
     /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.$refs["dataEdit"].openDialog("修改数据", row);
+    handleUpdate(row,type) {
+      this.$refs["dataEdit"].openDialog("修改数据", row,type);
     },
 
     /** 删除按钮操作 */

+ 30 - 1
src/views/windowTicketSales/ticketingSales.vue

@@ -860,8 +860,17 @@ import LockSeat from './model/lockSeat.vue'
             this.isLcokShow = false
             this.seatId = null
         },
-        /**  座位得样式  */
+        /**  
+         * 座位得样式 
+         * 
+         * occupyStatus: 为null表示未占用,0-锁定 1-占用
+         * status: 状态:0-初始(该状态下不C端显示) 1-可用 2-不可用
+         * channelType: 
+         *  */
         showSearStyle(item1,item) {
+            if(item.channelType && item.channelType != 'window') {
+                return 'seat_channel_type'
+            }
             let srt = ''
             srt = 
             item1.key == 'my_column'?'seat-item-class-column':
@@ -1035,6 +1044,26 @@ import LockSeat from './model/lockSeat.vue'
       transform-origin: 50% 0;
       transform: scale(var(--scaleNum));
       box-sizing: border-box;
+      .seat_channel_type {
+        user-select: none;
+      }
+      .seat_channel_type:after {
+        content:"";
+        display:block;
+        position:absolute;
+        top:0;
+        left:0;
+        width:100%;
+        height:100%;
+        background-color:rgba(0,0,0,0.3);
+        z-index:-1;
+        background-image: url('../../assets/jinxuan_1.png');
+        background-size: 50% 50%;
+        background-position: 50% 50%;
+        background-repeat: no-repeat;
+        z-index: 99;
+      }
+
       .disabled-class{
         background-color: #ffffff;
         border: none !important;