Przeglądaj źródła

修改冲账,修改收款退款操作

许智捷 2 lat temu
rodzic
commit
0c719b678c

+ 29 - 47
src/views/room/modules/checkIn/BillRoomInfo.vue

@@ -515,11 +515,6 @@
           <a-descriptions-item label="结账应收" v-else>
             {{ (feesAmount - paymentAmount).toFixed(2) }}
           </a-descriptions-item>
-          <a-descriptions-item
-            label="优    惠">
-            <a-input-number v-model="preferentialMoney"></a-input-number>
-            元
-          </a-descriptions-item>
         </a-descriptions>
         <a-button
           v-if="paymentAmount - feesAmount > 0"
@@ -675,9 +670,12 @@ const columns = [
   },
   {
     title: '单价',
-    dataIndex: 'id',
+    dataIndex: 'money',
     // width: 60,
     customRender: function (text, record) {
+      if (record.subjectType === 6 && record.feeGoodVo.originalPrice) {
+        return record.feeGoodVo.originalPrice
+      }
       return record.money
     }
   },
@@ -685,12 +683,21 @@ const columns = [
     title: '优惠价',
     dataIndex: 'money',
     // width: 60,
+    customRender: function (text, record) {
+      if (record.subjectType === 6 && record.feeGoodVo.price) {
+        return record.feeGoodVo.price
+      }
+      return text
+    }
   },
   {
     title: '数量',
     dataIndex: 'feeType',
     width: 60,
-    customRender: function (text) {
+    customRender: function (text, record) {
+      if (record.subjectType === 6 && record.feeGoodVo.num) {
+        return record.feeGoodVo.num
+      }
       return 1
     }
   },
@@ -837,7 +844,6 @@ export default {
       feesList: [],
       oldfeesList: [],
       paymentList: [],
-      preferentialMoney: 0,
       oldpaymentList: [],
       payTypeList: [],
       vipCustomer: {},
@@ -863,28 +869,9 @@ export default {
       }, 0)
     },
     paymentAmount() {
-      // var list = this.paymentList.filter((t) => t.subjectType !== 5);
-      // var amount = list.reduce(function (total, item) {
-      //   return total + item.money;
-      // }, 0);
-
-      // var list2 = this.paymentList.filter((t) => t.subjectType == 5);
-      // var amount2 = list2.reduce(function (total, item) {
-      //   return total + item.money;
-      // }, 0);
-      // var find = this.payTypeList.find(e => e.name === '会员卡')
-      // var amount = this.paymentList.filter(t => t.payType !== find.id).reduce(function (total, item) {
-      //   return total + item.money
-      // }, 0)
-      let amount = 0
-      this.paymentList.forEach(e => {
-        if (e.subjectType === 13) {
-          amount -= e.money
-        } else {
-          amount += e.money
-        }
-      })
-      return amount
+      return this.paymentList.reduce(function (total, item) {
+        return total + item.money
+      }, 0)
     },
     btnSisabled() {
       var index = this.model.livingRoomIds.findLastIndex(
@@ -1529,14 +1516,15 @@ export default {
       this.$refs.modalRefundForm.payTypeList = this.payTypeList
     },
     strikeBalance() {
-      debugger
-      console.log(this.consumSelectedRows)
-      if (this.consumSelectedRows.length === 0) {
-        this.$message.warning('请先选择消费详情中需要冲账的账单')
-        return
-      }
-      this.$refs.modalStrikeBalanceForm.title = '冲账单'
-      this.$refs.modalStrikeBalanceForm.edit(this.consumSelectedRows)
+      console.log(this.model)
+      let map = new Map()
+      this.model.livingRoomIds.forEach(e => {
+        if (e.roomId !== '1') {
+          map.set(e.roomId, e.roomName)
+        }
+      })
+      this.$refs.modalStrikeBalanceForm.edit(this.feesList, map)
+      this.$refs.modalStrikeBalanceForm.title = '冲账'
     },
     enterAccount() {
       let chooseRooms = [this.chooseLivingRoom]
@@ -1554,10 +1542,6 @@ export default {
       )
       var livingRoom = this.model.livingRoomIds[index]
       var livingOrderId = ''
-      if (livingRoom.isMain && livingRoom.roomId !== '1') {
-        this.$message.warning('主房不能单独结账,请选择 全部')
-        return
-      }
       if (livingRoom.roomId != '1') {
         livingOrderId = livingRoom.livingOrder.id
       } else {
@@ -1595,19 +1579,17 @@ export default {
           subjectType: 5,
           feeType: 2,
           bookingOrderId: this.model.orderInfo.id,
-          preferentialMoney: this.preferentialMoney,
           livingOrderId:
               livingRoom.roomId != '1' ? livingRoom.livingOrder.id : '',
           vipCustomerId: livingRoom.livingOrder.vipCustomerId,
           contractTeamId: livingRoom.livingOrder.contractTeamId,
-          contractTeamProtocolId:
-          livingRoom.livingOrder.contractTeamProtocolId,
+          contractTeamProtocolId: livingRoom.livingOrder.contractTeamProtocolId,
           preferentialType: 1,
           couponFirstAmount: 0,
           discount: 9,
-          isRefund: differMoney + this.preferentialMoney > 0
+          isRefund: differMoney > 0
         })
-        if (differMoney - this.preferentialMoney > 0) {
+        if (differMoney > 0) {
           this.$refs.modalPayOrRefundForm.title = '结账收款'
           // this.$refs.modalPayOrRefundForm.isRefund = false
         } else {

+ 15 - 3
src/views/room/modules/checkIn/EnterAccountModel.vue

@@ -127,7 +127,7 @@ export default {
           vipCardId: e.livingOrder.vipCustomerId,
           addAccountList: [{
             payType: '',
-            money: '',
+            money: 0,
             subjectType: 2
           }]
         }
@@ -148,11 +148,19 @@ export default {
       let feeInfoList = []
       this.roomInfos.forEach(e => {
         e.addAccountList.forEach(ele => {
+          console.log(ele.money)
+          if (ele.money === null || ele.money === 0) {
+            return
+          }
           let feeInfo = Object.assign(ele, e)
           delete feeInfo.addAccountList
           feeInfoList.push(feeInfo)
         })
       })
+      if (feeInfoList.length === 0) {
+        this.$message.warning('没有要添加的费用')
+        return
+      }
       postAction('/business/busOrderFee/saveBatch', feeInfoList)
           .then(resp => {
             if (resp.result) {
@@ -168,9 +176,12 @@ export default {
       this.close()
     },
     addEnterAccount() {
+      if (this.payTypeList.length === 0) {
+        return
+      }
       this.roomInfos[this.errIndex].addAccountList.push({
-        payType: '',
-        money: '',
+        payType: this.payTypeList[0].id,
+        money: 0,
         subjectType: 2
       })
     },
@@ -182,6 +193,7 @@ export default {
         if (res.success) {
           this.payTypeList = res.result.records
           if (this.payTypeList && this.payTypeList.length > 0) {
+            this.roomInfos.forEach(e => e.addAccountList[0].payType = this.payTypeList[0].id)
             this.changePayTypeList(this.roomInfos[0])
           }
         }

+ 7 - 5
src/views/room/modules/checkIn/PayOrRefund.vue

@@ -460,11 +460,13 @@ export default {
     edit(record) {
       this.model = Object.assign({}, record)
       this.isRefund = this.model.isRefund
-      if (record.preferentialMoney !== 0 && record.preferentialMoney !== null) {
-        this.model.coupon = true
-        this.model.preferentialType = 2
-        this.model.couponFirstAmount = record.preferentialMoney
-      }
+      // if (record.preferentialMoney !== 0 && record.preferentialMoney !== null) {
+      //   console.log(record.preferentialMoney)
+      //   debugger
+      //   this.model.coupon = true
+      //   this.model.preferentialType = 2
+      //   this.model.couponFirstAmount = record.preferentialMoney
+      // }
       this.getbusRoomPayType()
       if (this.model.vipCustomerId) {
         this.getMemeberCouponList()

+ 5 - 0
src/views/room/modules/checkIn/RefundModal.vue

@@ -156,6 +156,7 @@ export default {
         let refundFee = {
           id: e.id,
           livingOrderId: e.livingOrderId,
+          roomId: e.roomId,
           money: e.prerefund,
           returnFeeId: e.id,
           returnItem: true,
@@ -233,9 +234,12 @@ export default {
         let feeList = []
         let returnFeeList = []
         res.result.forEach(e => {
+          // 如果是退款
           if (e.returnItem === true) {
+            e.money = -e.money;
             returnFeeList.push(e)
           } else {
+            // 如果是收款
             e.returnMoney = 0
             e.prerefund = 0
             var room = this.model.filter(room => room.roomId === e.roomId)
@@ -251,6 +255,7 @@ export default {
         this.allFeeMoney = 0
         this.allReturnFee = 0
         this.feeList.forEach(e => {
+          // 当前收款对象下所有的退款记录
           let returnMoney = returnFeeList.filter(ele => e.id === ele.returnFeeId).reduce((accumulator, ele) => accumulator + ele.money, 0)
           e.returnMoney = returnMoney;
           this.allFeeMoney += e.money;

+ 30 - 17
src/views/room/modules/checkIn/StrikeBalanceModel.vue

@@ -15,12 +15,15 @@
       :pagination="false"
       :scroll="{ y: 160 }"
       rowKey="id">
-      <template slot="subjectType" slot-scope="text">
-        {{ getSubjectTypeText(text) }}
+      <template slot="subjectType" slot-scope="text, record">
+        {{ getSubjectTypeText(text, record) }}
       </template>
       <template slot="money" slot-scope="text, record">
         <a-input-number v-model=record.money @blur="handleBlur()"></a-input-number>
       </template>
+      <template slot="remark" slot-scope="text, record">
+        <a-textarea v-model=record.remark></a-textarea>
+      </template>
     </a-table>
   </j-modal>
 </template>
@@ -29,33 +32,45 @@
 import { postAction } from '@api/manage'
 
 const columns = [
-  // {
-  //     title: "",
-  //     dataIndex: "key",
-  //     width: 20,
-  //   },
+  {
+    title: '房间',
+    dataIndex: 'roomName',
+    width: 30,
+    align: 'center'
+  },
   {
     title: '费项',
     dataIndex: 'subjectType',
-    width: 100,
+    width: 60,
+    align: 'center',
     scopedSlots: { customRender: 'subjectType' }
   },
   {
     title: '日期',
     dataIndex: 'dayTime',
-    width: 100
+    width: 100,
+    align: 'center'
   },
   {
     title: '金额',
     dataIndex: 'oldPrice',
-    width: 60
+    width: 60,
+    align: 'center'
   },
   {
     title: '冲账金额',
     dataIndex: 'money',
     width: 60,
+    align: 'center',
     scopedSlots: { customRender: 'money'}
   },
+  {
+    title: '备注',
+    dataIndex: 'remark',
+    width: 60,
+    align: 'center',
+    scopedSlots: { customRender: 'remark'}
+  },
   ]
 export default {
   name: 'StrikeBalanceModel',
@@ -69,16 +84,17 @@ export default {
       disableSubmit: false,
       showYinshou: true,
       columns: columns,
-      feesList: []
+      feesList: [],
     }
   },
   methods: {
 
-    edit(record) {
+    edit(record, map) {
       this.visible = true
       console.log(record)
       this.feesList = record
       this.feesList.forEach(e => {
+        e.roomName = map.get(e.roomId)
         e.oldPrice = e.money
       })
     },
@@ -108,13 +124,10 @@ export default {
         }
       });
     },
-    submitCallback() {
-
-    },
     handleCancel() {
       this.close()
     },
-    getSubjectTypeText(text) {
+    getSubjectTypeText(text, record) {
       var msg = ''
       if (text === 1) {
         msg = '押金'
@@ -127,7 +140,7 @@ export default {
       } else if (text === 5) {
         msg = '结账收款'
       } else if (text === 6) {
-        msg = '商品'
+        msg = '商品-' + record.feeGoodVo.name
       } else if (text === 7) {
         msg = '点餐'
       } else if (text === 8) {