Browse Source

房间设置-销售目标设置(统计未处理)

WIN-B904R0U0NNS\Administrator 2 years ago
parent
commit
c15b562f35
1 changed files with 59 additions and 9 deletions
  1. 59 9
      src/views/settings/components/roomModules/marketObjectiveList.vue

+ 59 - 9
src/views/settings/components/roomModules/marketObjectiveList.vue

@@ -66,7 +66,7 @@
           <div v-html="text"></div>
         </template>
           <template slot="turnoverSlot" slot-scope="text,record">
-              <a-input-number style="width: 70%" :min="0" :step="1" :precision="2"/>
+              <a-input-number v-model="record.turnover"  style="width: 70%" :min="0" :step="1" :precision="2"/>
           </template>
           <template slot="rentalRateSlot" slot-scope="text,record">
 <!--              <a-input-number :min="0" :step="1" :precision="2"-->
@@ -76,7 +76,7 @@
 <!--              </a-input-number>-->
 <!--              <a-input addon-after="%" />-->
               <a-input-group compact>
-                  <a-input-number style="width: 60%" :min="0" :step="1" :precision="2"/>
+                  <a-input-number v-model="record.rentalRate" style="width: 60%" :min="0" :step="1" :precision="2"/>
                   <a-input disabled value="%" style="width: 40px;"/>
               </a-input-group>
 <!--              <div style="display: flex;flex-direction: row">-->
@@ -89,13 +89,13 @@
 <!--              </div>-->
           </template>
           <template slot="roomPriceSlot" slot-scope="text,record">
-              <a-input-number style="width: 70%" :min="0" :step="1" :precision="2"/>
+              <a-input-number v-model="record.roomPrice" style="width: 70%" :min="0" :step="1" :precision="2"/>
           </template>
           <template slot="revperSlot" slot-scope="text,record">
-              <a-input-number style="width: 70%" :min="0" :step="1" :precision="2"/>
+              <a-input-number v-model="record.revper" style="width: 70%" :min="0" :step="1" :precision="2"/>
           </template>
           <template slot="nightSlot" slot-scope="text,record">
-              <a-input-number style="width: 70%" :min="0" :step="1" :precision="2"/>
+              <a-input-number v-model="record.night" style="width: 70%" :min="0" :step="1" :precision="2"/>
           </template>
       </a-table>
     </div>
@@ -110,6 +110,7 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import moment from "moment";
+  import { httpAction, getAction } from '@/api/manage'
   // import BusMarketObjectiveModal from './modules/BusMarketObjectiveModal'
 
   export default {
@@ -166,11 +167,12 @@
                   deleteBatch: "/business/busMarketObjective/deleteBatch",
                   exportXlsUrl: "/business/busMarketObjective/exportXls",
                   importExcelUrl: "business/busMarketObjective/importExcel",
-
+                  batchAddOrUpdate: "/business/busMarketObjective/batchAddOrUpdate",
               },
               dictOptions: {},
               superFieldList: [],
-              yearShowOne: false
+              yearShowOne: false,
+              hotelId:''
           }
       },
       beforeCreate() {
@@ -181,6 +183,18 @@
           this.queryParam.year = moment(new Date().getFullYear(),'YYYY')
           //new Date().getFullYear();//
       },
+      mounted(){
+          console.log(this.dataSource)
+          // this.$nextTick(() => {
+          //     console.log(this.$refs.table.dataSource)
+          // })
+          var info = JSON.parse(localStorage.getItem("storeInfo"));
+          this.hotelId = info.id;
+      },
+      updated () {
+          // this.handleAddStatistics()
+          console.log(this.dataSource)
+      },
       computed: {
           importExcelUrl: function () {
               return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
@@ -215,9 +229,45 @@
               this.queryParam.year = moment(new Date(value)).format('YYYY');
               this.yearShowOne = false;
           },
+          handleAddStatistics() {
+              console.log(this.$refs.table.dataSource)
+              const { count, dataSource } = this.$refs.table;
+              const newData = {
+                  key: count,
+                  month: '合计',
+                  turnover: '0.00',
+                  rentalRate: '0.00',
+                  roomPrice: '0.00',
+                  revper: '0.00',
+                  night: '0.00',
+              };
+              this.$refs.table.dataSource = [...dataSource, newData];
+              // this.$refs.table.count = count + 1;
+          },
           submitData() {
-              console.log(888888)
-              console.log(this)
+              var _dataSource = this.$refs.table.dataSource
+              _dataSource.forEach(t=>{
+                  t.hotelId = this.hotelId
+              })
+              var data = JSON.stringify(_dataSource)
+              console.log(data)
+              const that = this;
+              that.confirmLoading = true;
+              httpAction(this.url.batchAddOrUpdate, _dataSource, 'POST').then((res) => {
+                  if (res.success) {
+                      that.$message.success(res.message);
+                      that.$emit('ok');
+
+                      if(that.queryParam.year._isAMomentObject){
+                          that.queryParam.year = that.queryParam.year.format('YYYY')
+                      }
+                      that.loadData();
+                  } else {
+                      that.$message.warning(res.message);
+                  }
+              }).finally(() => {
+                  that.confirmLoading = false;
+              })
           }
       }
   }