From 8dcbe3d898f6c60ef3226095d994ca8953bf5f6d Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 03 十二月 2024 18:18:37 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/funingyunwei

---
 admin/src/views/contract/components/contractEdit.vue |  137 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 108 insertions(+), 29 deletions(-)

diff --git a/admin/src/views/contract/components/contractEdit.vue b/admin/src/views/contract/components/contractEdit.vue
index d98469e..fd529c4 100644
--- a/admin/src/views/contract/components/contractEdit.vue
+++ b/admin/src/views/contract/components/contractEdit.vue
@@ -1,9 +1,17 @@
 <template>
-  <GlobalWindow width="100%" :title="title" :visible.sync="visible" :confirm-working="isWorking" @close="close"
-    @confirm="confirm">
-    <div class="tabs">
-      <div class="tab" :class="{ active: activeTabs === 0 }" @click="tabsClick(0)">1銆佸熀鏈俊鎭�</div>
-      <div class="tab" :class="{ active: activeTabs === 1 }" @click="tabsClick(1)">2銆佽垂鐢ㄦ潯娆�</div>
+<!--  :text="activeTabs === 0 ? '涓嬩竴姝�' : '鎻愪氦'"-->
+<!--  :backText="activeTabs === 0 ? '杩斿洖' : '涓婁竴姝�'"-->
+  <GlobalWindow
+    width="100%"
+    :title="title"
+    :withFooter="false"
+    :visible.sync="visible"
+    :confirm-working="isWorking"
+    @confirm="confirm"
+    @close="close">
+    <div class="tabs fixed">
+      <div class="tab" :class="{ active: activeTabs === 0 }">1銆佸熀鏈俊鎭�</div>
+      <div class="tab" :class="{ active: activeTabs === 1 }">2銆佽垂鐢ㄦ潯娆�</div>
     </div>
     <div v-show="activeTabs === 0">
       <div class="main">
@@ -25,13 +33,13 @@
                 </el-select>
               </el-form-item>
               <el-form-item label="鍚堝悓绛捐鏃ユ湡" prop="signDate">
-                <el-date-picker type="date" v-model="form.signDate" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
+                <el-date-picker type="date" v-model="form.signDate" value-format="yyyy-MM-dd" :clearable="false" placeholder="璇烽�夋嫨" />
               </el-form-item>
               <el-form-item label="鍚堝悓寮�濮嬫棩鏈�" prop="startDate">
-                <el-date-picker type="date" v-model="form.startDate" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
+                <el-date-picker type="date" v-model="form.startDate" @change="getHouseData" :clearable="false" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
               </el-form-item>
               <el-form-item label="鍚堝悓缁撴潫鏃ユ湡" prop="endDate">
-                <el-date-picker type="date" v-model="form.endDate" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
+                <el-date-picker type="date" v-model="form.endDate" @change="getHouseData" :clearable="false" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
               </el-form-item>
               <el-form-item label="褰掑睘椤圭洰" prop="projectId">
                 <el-select v-model="form.projectId" placeholder="璇烽�夋嫨">
@@ -131,8 +139,8 @@
                     <el-date-picker type="daterange" v-model="item.time" @change="getDate1($event, index)" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
                   </el-form-item>
                   <el-form-item label="鍚堝悓鍗曚环" prop="price">
-                    <el-input placeholder="璇疯緭鍏�" v-model="item.price">
-                      <el-select v-model="item.circleType" slot="append" placeholder="璇烽�夋嫨">
+                    <el-input placeholder="璇疯緭鍏�" v-model="item.price" class="input-with-select">
+                      <el-select v-model="item.circleType" style="width: 150px;" slot="append" placeholder="璇烽�夋嫨">
                         <el-option v-for="(item, index) in unitOps" :key="index" :value="item.value" :label="item.name"></el-option>
                       </el-select>
                     </el-input>
@@ -173,11 +181,15 @@
             </template>
           </el-table-column>
           <el-table-column prop="planPayDate" label="浠樻鏃�" align="center" show-overflow-tooltip />
-          <el-table-column prop="receivableFee" label="搴旀敹" align="center" show-overflow-tooltip />
+          <el-table-column label="搴旀敹" align="center" show-overflow-tooltip>
+            <template slot-scope="{row}">
+              {{row.receivableFee}}鍏�
+            </template>
+          </el-table-column>
         </el-table>
         <div class="total">
           <span>鎬昏</span>
-          <div>璐圭敤搴旀敹鎬昏锛歿{zlPrice}}锛屾娂閲戝簲鏀舵�昏锛歿{form.zlDeposit}}</div>
+          <div>璐圭敤搴旀敹鎬昏锛歿{zlPrice}}鍏冿紝鎶奸噾搴旀敹鎬昏锛歿{form.zlDeposit}}鍏�</div>
         </div>
       </div>
       <!--   鐗╀笟鏉℃   -->
@@ -211,7 +223,7 @@
                   </el-form-item>
                   <el-form-item label="鍚堝悓鍗曚环" prop="price">
                     <el-input placeholder="璇疯緭鍏�" v-model="item.price">
-                      <el-select v-model="item.circleType" slot="append" placeholder="璇烽�夋嫨">
+                      <el-select v-model="item.circleType" style="width: 150px;" slot="append" placeholder="璇烽�夋嫨">
                         <el-option v-for="(item, index) in unitOps" :key="index" :value="item.value" :label="item.name"></el-option>
                       </el-select>
                     </el-input>
@@ -252,13 +264,24 @@
             </template>
           </el-table-column>
           <el-table-column prop="planPayDate" label="浠樻鏃�" align="center" show-overflow-tooltip />
-          <el-table-column prop="receivableFee" label="搴旀敹" align="center" show-overflow-tooltip />
+          <el-table-column prop="receivableFee" label="搴旀敹" align="center" show-overflow-tooltip>
+            <template slot-scope="{row}">
+              {{row.receivableFee}}鍏�
+            </template>
+          </el-table-column>
         </el-table>
         <div class="total">
           <span>鎬昏</span>
-          <div>璐圭敤搴旀敹鎬昏锛歿{wyPrice}}锛屾娂閲戝簲鏀舵�昏锛歿{form.wyDeposit}}</div>
+          <div>璐圭敤搴旀敹鎬昏锛歿{wyPrice}}鍏冿紝鎶奸噾搴旀敹鎬昏锛歿{form.wyDeposit}}鍏�</div>
         </div>
       </div>
+    </div>
+    <div class="window__footer" style="position: sticky; bottom: 0; left: 0; z-index: 9; background: #ffffff;">
+      <slot name="footer">
+        <el-button @click="confirm" :loading="confirmWorking" type="primary">{{activeTabs === 0 ? '涓嬩竴姝�' : '鎻愪氦'}}</el-button>
+        <slot name="btns" />
+        <el-button @click="close">{{activeTabs === 0 ? '杩斿洖' : '涓婁竴姝�'}}</el-button>
+      </slot>
     </div>
     <!-- 閫夋嫨绉熷 -->
     <MemberSearch ref="MemberSearchRef" @select="getTenant" />
@@ -387,17 +410,47 @@
       this.getUser()
       this.getProject()
       this.getCompany()
-      this.getHouseTree()
       this.visible = true
       this.$nextTick(() => {
+        this.$refs.form.resetFields()
         for (const key in this.form) {
           if (['roomIds', 'fileList', 'wyDate', 'zlDate'].includes(key)) {
             this.form[key] = []
           } else {
-            this.form[key] = target[key]
+            this.form[key] = ''
           }
         }
+        this.form.zlDetailList = [
+          {
+            startDate: '',
+            endDate: '',
+            time: [],
+            price: '',
+            advanceDays: ''
+          }
+        ]
+        this.form.wyDetailList = [
+          {
+            startDate: '',
+            endDate: '',
+            time: [],
+            price: '',
+            advanceDays: ''
+          }
+        ]
+        this.wyList = []
+        this.zlList = []
+        this.form.userId = this.userInfo.id
+        this.form.signDate = this.getDayTime()
+        this.form.startDate = this.getDayTime()
+        this.form.endDate = this.getDayTime(1)
+        this.getHouseTree()
       })
+    },
+    getHouseData () {
+      if (this.form.startDate && this.form.endDate) {
+        this.getHouseTree()
+      }
     },
     changeType (e) {
       if (e === 0 || e === 2) {
@@ -406,11 +459,24 @@
         this.cactiveTabs = 1
       }
     },
+    getDayTime (num) {
+      const today = new Date();
+      const year = today.getFullYear();
+      const month = today.getMonth() + 1; // 鏈堜唤鏄粠 0 寮�濮嬬殑锛屽洜姝ら渶瑕佸姞 1
+      const day = today.getDate();
+      if (!num) {
+        return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
+      } else {
+        return `${year + 1}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
+      }
+    },
     confirm () {
-      this.$refs.form.validate((valid) => {
-        if (!valid) {
-          return
-        }
+      if (this.activeTabs === 0) {
+        this.$refs.form.validate((valid) => {
+          if (!valid) return
+          this.activeTabs = 1
+        })
+      } else if (this.activeTabs === 1) {
         if (this.form.type === 0) {
           this.$refs.paramCostRef.validate((valid1) => {
             if (!valid1) {
@@ -438,7 +504,7 @@
             this.submit()
           })
         }
-      })
+      }
     },
     submit () {
       // 璋冪敤鏂板缓鎺ュ彛
@@ -471,7 +537,10 @@
       this.form.roomIds = arr.filter(item => item !== undefined);
     },
     getHouseTree () {
-      tree({})
+      tree({
+        startDate: this.form.startDate,
+        endDate: this.form.endDate
+      })
         .then(res => {
           res.forEach(item => {
             item.disabled = true
@@ -490,30 +559,30 @@
       }
     },
     generateZL () {
-      getBillList({ ...this.form })
+      getBillList({ ...this.form, billType: 0 })
         .then(res => {
           let zlPrice = 0
           let arr = []
           res.forEach(item => {
             if (item.costType === 0) {
               zlPrice += item.receivableFee
-              arr.push(item)
             }
+            arr.push(item)
           })
           this.zlPrice = zlPrice
           this.zlList = arr
         })
     },
     generateWY () {
-      getBillList({ ...this.form })
+      getBillList({ ...this.form, billType: 1 })
         .then(res => {
           let zlPrice = 0
           let arr = []
           res.forEach(item => {
             if (item.costType === 1) {
               zlPrice += item.receivableFee
-              arr.push(item)
             }
+            arr.push(item)
           })
           this.wyPrice = zlPrice
           this.wyList = arr
@@ -582,6 +651,7 @@
       companyList({ type: 2 })
         .then(res => {
           this.comparyList = res
+          this.form.companyId = res[0].id
         })
     },
     tabsClick (val) {
@@ -631,7 +701,11 @@
       this.form.fileList.push({ ...item, fileurl: item.imgaddr, name: item.originname, userName: this.userInfo.realname, createTime: this.getDay() })
     },
     close () {
-      this.$emit('close')
+      if (this.activeTabs === 0) {
+        this.$emit('close')
+      } else {
+        this.activeTabs = 0
+      }
     }
   }
 }
@@ -639,7 +713,12 @@
 
 <style lang="scss" scoped>
 @import '@/assets/style/variables.scss';
-
+.fixed {
+  background: #ffffff;
+  position: sticky;
+  top: 0;
+  left: 0;
+}
 .tabs {
   border-bottom: 1px solid #DFE2E8;
   display: flex;

--
Gitblit v1.9.3