Prechádzať zdrojové kódy

修改冲账和结账收款。

许智捷 2 rokov pred
rodič
commit
83c38115ef

+ 333 - 0
src/views/room/advanceOrder.vue

@@ -0,0 +1,333 @@
+<template>
+  <a-card :bordered="false">
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-row :gutter="24">
+          <a-col :span="3">
+            <a-form-item label="">
+              <a-input
+                placeholder="房号/姓名/手机号/单号"
+                v-model="queryParam.keyw"
+              ></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item label="">
+              <a-range-picker
+                  format="YYYY-MM-DD"
+                  :placeholder="['开始日期', '结束日期']"
+                  @change="onChange"
+                  v-model="datetime"
+                  :allowClear="false"
+              />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+                <a-form-item label="">
+                  <a-radio-group v-model="queryParam.bookingStatus" button-style="solid">
+                    <a-radio-button value="0">全部</a-radio-button>
+                    <a-radio-button value="1">预定中</a-radio-button>
+                    <a-radio-button value="2">已入住</a-radio-button>
+                    <a-radio-button value="3">已取消</a-radio-button>
+                    <a-radio-button value="4">已失效</a-radio-button>
+                  </a-radio-group>
+                </a-form-item>
+              </a-col>
+          <a-col :md="6" :sm="8">
+            <span
+              style="float: left; overflow: hidden"
+              class="table-page-search-submitButtons"
+            >
+              <a-button
+                type="primary"
+                @click="searchQuery"
+                icon="search"
+              >查询</a-button
+              >
+              <!-- <a-button
+                type="primary"
+                @click="searchReset"
+                icon="reload"
+                style="margin-left: 8px"
+                >重置</a-button
+              > -->
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 查询区域-END -->
+    <!-- table区域-begin -->
+    <div>
+      <a-table
+        ref="table"
+        size="middle"
+        :scroll="{ x: true }"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="{
+          selectedRowKeys: selectedRowKeys,
+          onChange: onSelectChange,
+        }"
+        class="j-table-force-nowrap"
+        @change="handleTableChange"
+      >
+        <template slot="htmlSlot" slot-scope="text">
+          <div v-html="text"></div>
+        </template>
+        <template slot="imgSlot" slot-scope="text, record">
+          <span
+            v-if="!text"
+            style="font-size: 12px; font-style: italic"
+          >无图片</span
+          >
+          <img
+            v-else
+            :src="getImgView(text)"
+            :preview="record.id"
+            height="25px"
+            alt=""
+            style="max-width: 80px; font-size: 12px; font-style: italic"
+          />
+        </template>
+        <template slot="fileSlot" slot-scope="text">
+          <span
+            v-if="!text"
+            style="font-size: 12px; font-style: italic"
+          >无文件</span
+          >
+          <a-button
+            v-else
+            :ghost="true"
+            type="primary"
+            icon="download"
+            size="small"
+            @click="downloadFile(text)"
+          >
+            下载
+          </a-button>
+        </template>
+
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleInfo(record)">查看</a>
+          <a-divider v-if="queryParam.bookingStatus == 1" type="vertical" />
+          <a
+            v-if="queryParam.bookingStatus == 1"
+            @click="setOrderStatus(record)"
+          >取消订单</a
+          >
+
+          <a-divider type="vertical" v-if="queryParam.bookingStatus == 1" />
+          <a v-if="queryParam.bookingStatus == 1" @click="handleInfo(record)">入住</a>
+        </span>
+      </a-table>
+    </div>
+    <bill-room-info-modal
+      ref="ModalBillRoomInfo"
+      @ok="modalLockRoomFormOk"
+    ></bill-room-info-modal>
+  </a-card>
+</template>
+
+<script>
+import '@/assets/less/TableExpand.less'
+import { mixinDevice } from '@/utils/mixin'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import BillRoomInfoModal from './modules/checkIn/BillRoomInfoModal.vue'
+import { postAction, getAction } from '@/api/manage'
+import moment from 'moment'
+const date = new Date()
+const endDate = new Date(date.setDate(date.getDate() + 1))
+export default {
+  name: 'AdvanceOrder',
+  mixins: [JeecgListMixin, mixinDevice],
+  components: {
+    BillRoomInfoModal
+  },
+  data() {
+    return {
+      description: '预约单',
+      // 表头
+      columns: [
+        {
+          title: '单号',
+          align: 'center',
+          dataIndex: 'orderNo'
+        },
+        {
+          title: '客人/电话',
+          align: 'center',
+          dataIndex: 'customerName',
+          customRender: function (text, record) {
+            return record.customerName + '/' + record.customerPhone
+          }
+        },
+        {
+          title: '客人类型',
+          align: 'center',
+          dataIndex: 'customerType',
+          customRender: function (text) {
+            if (text === 1) {
+              return '散客'
+            } else if (text === 2) {
+              return '会员'
+            } else if (text === 3) {
+              return '协议单位'
+            } else if (text === 4) {
+              return '中介'
+            }
+          }
+        },
+        {
+          title: '入住类型',
+          align: 'center',
+          dataIndex: 'isLiving',
+          customRender: function (text, record) {
+            if (record.livingDayPrices && record.livingDayPrices.length > 0) {
+              return record.livingDayPrices[0].livingType === 1
+                  ? '全天'
+                  : '钟点'
+            }
+            if (record.bookingDayPrices && record.bookingDayPrices.length > 0) {
+              return record.bookingDayPrices[0].livingType === 1
+                  ? '全天'
+                  : '钟点'
+            }
+            return '--'
+          }
+        },
+        {
+          title: '房型',
+          align: 'center',
+          dataIndex: 'layoutName'
+        },
+        {
+          title: '房号',
+          align: 'center',
+          dataIndex: 'roomName',
+          customRender: function (text, record) {
+            return !text ? '排房' : text
+          }
+        },
+        {
+          title: '房价',
+          align: 'center',
+          dataIndex: 'createDate',
+          customRender: function (text, record) {
+            if (record.livingDayPrices && record.livingDayPrices.length > 0) {
+              return record.livingDayPrices[0].price
+            }
+            if (record.bookingDayPrices && record.bookingDayPrices.length > 0) {
+              return record.bookingDayPrices[0].price
+            }
+            return '--'
+          }
+        },
+        // {
+        //   title: "状态",
+        //   align: "center",
+        //   dataIndex: "createDate",
+        // },
+        {
+          title: '预抵时间',
+          align: 'center',
+          dataIndex: 'arrivalTime'
+        },
+        {
+          title: '预离时间',
+          align: 'center',
+          dataIndex: 'dueOutTime'
+        },
+        {
+          title: '金额',
+          align: 'center',
+          dataIndex: 'yuE',
+          customRender: function (text, record) {
+            return record.yuE + '(余)/' + record.yushou + '(预)'
+          }
+        },
+        {
+          title: '操作',
+          dataIndex: 'action',
+          align: 'center',
+          fixed: 'right',
+          width: 165,
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      url: {
+        list: '/business/busRoomBookingOrders/kedan-orders',
+        delete: '/order/cesOrderMessage/delete',
+        deleteBatch: '/order/cesOrderMessage/deleteBatch',
+        exportXlsUrl: '/order/cesOrderMessage/exportXls',
+        importExcelUrl: 'order/cesOrderMessage/importExcel'
+      },
+      dictOptions: {},
+      superFieldList: [],
+      hotelList: [],
+      queryParam: {
+        type: 2,
+        bookingStatus: '0',
+        startTime: moment(new Date()).format('YYYY-MM-DD'),
+        endTime: moment(endDate).format('YYYY-MM-DD')
+      },
+      datetime: [
+        moment(new Date(), 'YYYY-MM-DD'),
+        moment(endDate, 'YYYY-MM-DD')
+      ]
+    }
+  },
+  created() {
+    getAction('/business/busHotel/list', { pageNo: 1, pageSize: 100 }).then(
+        (res) => {
+          if (res.success) {
+            this.hotelList = res.result.records
+          }
+        }
+    )
+  },
+  computed: {
+    importExcelUrl: function () {
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
+    }
+  },
+  methods: {
+    setOrderStatus(record) {
+      postAction('/business/busRoomBookingOrders/set-booking-status', {
+        id: record.id,
+        bookingStatus: 2
+      }).then((res) => {
+        if (res.success) {
+          this.$message.success(res.message)
+          this.loadData()
+        } else {
+          this.$message.warning(res.message)
+        }
+      })
+    },
+    handleInfo(record) {
+      // 预约单
+      this.$router.push({
+        name: 'room-scheduledetail',
+        params: {
+          id: record.orderNo
+        }
+      })
+    },
+    onChange(e, dateString) {
+      // console.log("Selected Time: ", e);
+      // console.log("Formatted Selected Time: ", dateString);
+      this.queryParam.startTime = dateString[0]
+      this.queryParam.endTime = dateString[1]
+    }
+  }
+}
+</script>
+<style scoped>
+@import "~@assets/less/common.less";
+</style>

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

@@ -372,7 +372,7 @@
           </a-descriptions></template
         >
       </div>
-      <div style="width: 50%">
+      <div style="width: 51%">
         <div style="display: flex; justify-content: space-between">
           <h4
             style="
@@ -437,6 +437,16 @@
                 onChange: onSelectChange,
               }"
             >
+              <template #default="{ record }">
+              <a-table-column
+                  title="Selection"
+                  key="selection"
+                  align="center"
+              >
+                <a-checkbox :disabled="record.preferentialStatus === 2" />
+              </a-table-column>
+              <!-- 其他列 -->
+            </template>
               <template slot="subjectType" slot-scope="text, record, index" class="strike_style">
                 <span class="strike_style" v-if="record.returnItem">{{ getSubjectTypeText(text,record) }}</span>
                 <span v-else>{{ getSubjectTypeText(text,record) }}</span>
@@ -506,7 +516,7 @@
             text-align: right;
           "
             >
-              合计消费:{{ feesAmount.toFixed(2) }}
+              合计消费:{{ unsettledAmount.toFixed(2) }}
             </div>
           </a-tab-pane>
           <a-tab-pane tab="已结算" key="2">
@@ -606,7 +616,7 @@
           :scroll="{ y: 160 }"
         >
           <template slot="payType" slot-scope="text, record, index">
-            {{ getPayTypeText(text) }}
+            {{ getPayTypeText(text) }}{{ record.preferentialStatus === 2 ? '结' : '未' }}
           </template>
           <template slot="subjectType" slot-scope="text, record, index">
             {{ getSubjectTypeText(record.subjectType,record) }}
@@ -622,7 +632,7 @@
           合计收款:{{ paymentAmount.toFixed(2) }}
         </div>
       </div>
-      <div style="width: 17%">
+      <div style="width: 16%">
         <h4 style="color: rgba(255, 141, 26, 1); font-weight: 600">财务汇总</h4>
         <a-divider />
         <a-descriptions :column="1">
@@ -1087,12 +1097,15 @@ export default {
       customerSourceList: [],
       warranterList: [],
       key: 0,
+      // 未结算
       feesList: [],
       oldfeesList: [],
       paymentList: [],
       oldpaymentList: [],
+      // 已结算
       paidList: [],
       oldpaidList: [],
+      // 冲账
       strikeList: [],
       oldStrikeList: [],
       payTypeList: [],
@@ -1123,6 +1136,12 @@ export default {
         return total + item.money
       }, 0)
     },
+    /* 未结算合计 */
+    unsettledAmount() {
+      return this.feesList.reduce(function (total, item) {
+        return total + item.money
+      }, 0)
+    },
     paidAmount() {
       return this.paidList.reduce(function (total, item) {
         return total + item.money
@@ -1642,10 +1661,16 @@ export default {
       console.log(e)
       this.selectRoomId = e
       if (e == '1') {
+        this.entiretyList = JSON.parse(JSON.stringify(this.entiretyAmount))
         this.feesList = this.oldfeesList
         this.paymentList = this.oldpaymentList
         this.paidList = this.oldpaidList
         this.strikeList = this.oldStrikeList
+        this.strikeList.forEach(item => {
+          let tempindex = this.entiretyList.findIndex(index => index.id == item.returnFeeId)
+          console.log(this.tempindex);
+          this.entiretyList.splice(tempindex+1,0,item)
+        })
       } else {
         this.feesList = this.oldfeesList.filter((t) => t.roomId === e)
         this.paymentList = this.oldpaymentList.filter((t) => t.roomId === e)
@@ -1908,7 +1933,6 @@ export default {
                 //   //   }
                 //   // })
                 // });
-                console.log(this.entiretyList);
                 this.tabChange(this.tabSelectRoomId)
               }
             }

+ 367 - 225
src/views/room/modules/checkIn/FeeForm.vue

@@ -3,62 +3,78 @@
     <j-form-container :disabled="formDisabled">
       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
         <a-row style="display:flex;justify-content:center;">
-          <a-col :span="12">
-            <a-form-model-item label="消费项目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="subjectType">
-              <a-select v-model="model.subjectType" placeholder="消费项目" :allowClear="true">
-                <a-select-option :value="6">商品</a-select-option>
-                <a-select-option :value="10">手工房费</a-select-option>
-                <a-select-option :value="11">水电煤抄表</a-select-option>
-                <a-select-option :value="12">赔偿费</a-select-option>
-              </a-select>
-            </a-form-model-item>
-            <a-col :span="24">
-              <!--                            <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="" v-if="model.subjectType==6">-->
-              <!--                                <a-input-number :disabled="model.subjectType==6" v-model="goodsPrice" placeholder="请输入金额" :min="0"></a-input-number>-->
-              <!--                            </a-form-model-item>-->
-              <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money" v-if="model.subjectType !== 6">
-                <a-input-number v-model="model.money" placeholder="请输入金额" :min="0"></a-input-number>
-              </a-form-model-item>
-            </a-col>
-          </a-col>
-          <div v-if="model.subjectType==6">
-            <a-col :span="10">
-              <a-form-model-item label="" v-model="queryParams.goodTypeId">
-                <a-cascader :options="stockTypeList " @change="stockTypeChange" :field-names="{ label: 'name', value: 'id', children: 'children' }" style="width: 80%" placeholder="商品类别" />
-              </a-form-model-item>
-            </a-col>
-            <a-col :span="9">
-              <a-form-model-item>
-                <a-input v-model="queryParams.name" style="width: 80%" placeholder="名称" />
-              </a-form-model-item>
-            </a-col>
-            <a-col :span="3">
-              <a-form-model-item>
-                <a-button @click="loadData" type="primary">搜索</a-button>
-              </a-form-model-item>
-            </a-col>
-          </div>
         </a-row>
-        <!-- <a-row>
-                <a-col :span="24">
-                    <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money">
-                        <a-input-number v-model="model.money" placeholder="请输入金额" :min="0"></a-input-number>
+
+        <a-row v-if="model.subjectType===6">
+            <a-col :span="10">
+              <a-row style="height: 30px">
+                <a-form-model ref="form" :model="model" :rules="validatorRules">
+                  <a-col :span="9">
+                    <a-form-model-item>
+                      <a-input v-model="queryParams.name" style="width: 80%" placeholder="名称" />
                     </a-form-model-item>
+                  </a-col>
+                  <a-col :span="3">
+                    <a-form-model-item>
+                      <a-button @click="loadData" type="primary">搜索</a-button>
+                    </a-form-model-item>
+                  </a-col>
+                </a-form-model>
+              </a-row>
+              <a-row>
+                <a-col :span="8">
+                  <a-tree
+                      showIcon
+                      :replaceFields="{ children: 'children', title: 'name', key: 'id' }"
+                      :treeData="barTree"
+                  >
+                    <div slot="title" slot-scope="item"
+                         style="display: flex;align-items: center;height: 100%;overflow: hidden;">
+                      <a-button style="font-size: 12px; padding-left: 0px" type="link" @click="chooseBar(item)">{{ item.name }}</a-button>
+                    </div>
+                  </a-tree>
                 </a-col>
-            </a-row> -->
-        <a-row v-if="model.subjectType === 6">
-          <a-table :columns="columns" @change="pageChange" :dataSource="dataSource" :pagination="ipagination" :scroll="{ y: 500 }" style="margin-top:10px;">
-            <template slot="sellingPrice" slot-scope="text, record">
-              <a-input-number v-model="record.sellingPrice" :min="0"></a-input-number>
-            </template>
-            <template slot="number" slot-scope="text, record">
-              <a-input-number :max="record.inventory" v-model="record.number" @change="changeNumber" :min="0"></a-input-number>
-            </template>
-            <template slot="inventorySlot" slot-scope="text,record">
-              {{ record.inventory - record.number }}
-            </template>
-          </a-table>
-        </a-row>
+                <a-col :span="16">
+                  <a-table :columns="columns" :customRow="handleRowClick" :dataSource="dataSource" :pagination="false" :scroll="{ y: 500 }" style="margin-top:10px; overflow-y: scroll">
+<!--                    <template slot="sellingPrice" slot-scope="text, record">-->
+<!--                      <a-input-number v-model="record.sellingPrice" :min="0"></a-input-number>-->
+<!--                    </template>-->
+<!--                    <template slot="number" slot-scope="text, record">-->
+<!--                      <a-input-number :max="record.inventory" v-model="record.number" @change="changeNumber" :min="0"></a-input-number>-->
+<!--                    </template>-->
+                    <template slot="inventorySlot" slot-scope="text,record">
+                      {{ record.inventory - record.number }}
+                    </template>
+                  </a-table>
+                </a-col>
+              </a-row>
+            </a-col>
+            <a-col :span="14">
+              <a-row>
+                <a-table :columns="chooseColumns" :dataSource="chooseGoodsList" :pagination="false" :scroll="{ y: 500 }" style="margin-top:10px; overflow-y: scroll">
+                  <template #footer>
+                    <span style="font-size: 15px;margin-left: 350px; margin-right: 10px;">{{ '合计:' + moneyAmount.toFixed(2) + ' 元' }}</span>&nbsp; &nbsp;
+                  </template>
+                  <template slot="sellingPrice" slot-scope="text, record">
+                    <a-input-number v-model="record.sellingPrice" :min="0"></a-input-number>
+                  </template>
+                  <template slot="number" slot-scope="text, record">
+                    <a-input-number :max="record.inventory" v-model="record.number" @change="changeNumber" :min="0" :disabled="record.id == null"></a-input-number>
+                  </template>
+                  <template slot="inventorySlot" slot-scope="text,record">
+                    {{ record.inventory - record.number }}
+                  </template>
+                  <span slot="action" slot-scope="text, record" >
+                    <a @click="deleteFee(record)">删除</a>
+                </span>
+                </a-table>
+                <a-col :span="24" style="text-align: end">
+                  <a-checkbox default-checked>打印消费账单</a-checkbox>
+                </a-col>
+              </a-row>
+            </a-col>
+          </a-row>
+
         <a-row v-if="model.subjectType===11">
 <!--          水表:上期读数:(自动带入上期读数,初始须提前设置,可修改):(可填)本期用量:(=本期-上期) 单价:(提前设置好的) 本期应缴:(根据用量和单价自动计算)-->
           <a-col :span="2">
@@ -156,6 +172,29 @@
       </a-form-model>
 
     </j-form-container>
+    <j-modal
+       :width="300"
+       :visible="addFeeVisible"
+       @ok="addFee"
+       @cancel="addFeeVisible = !addFeeVisible"
+    >
+      <a-form-model>
+        <a-col>
+          <a-form-model-item
+              :labelCol="{ xs: { span: 24 }, sm: { span: 8 }}"
+              :wrapperCol="{xs: { span: 24 },sm: { span: 14 }}"
+              label="费项"
+              style="padding-top: 10px; padding-bottom: 0px">
+            <a-input v-model="addFeeModel.remark" :disabled="this.barId != 13"></a-input>
+          </a-form-model-item>
+        </a-col>
+        <a-col>
+          <a-form-model-item :labelCol="{ xs: { span: 24 }, sm: { span: 8 }}" :wrapperCol="{xs: { span: 24 },sm: { span: 14 }}" label="金额">
+            <a-input-number v-model="addFeeModel.feeMoney" style="width: 100%"></a-input-number>
+          </a-form-model-item>
+        </a-col>
+      </a-form-model>
+    </j-modal>
   </a-spin>
 </template>
 
@@ -164,16 +203,10 @@ import {
     httpAction,
     getAction
 } from '@/api/manage'
-import {
-    validateDuplicateValue
-} from '@/utils/util'
-
-import {
-    JeecgListMixin
-} from '@/mixins/JeecgListMixin'
+import FeeGoodsForm from '@views/room/modules/checkIn/FeeGoodsForm'
 export default {
     name: 'BusMemberCardForm',
-    components: {},
+    components: { FeeGoodsForm },
     props: {
         // 表单禁用
         disabled: {
@@ -184,52 +217,91 @@ export default {
     },
     data() {
         return {
+          addFeeVisible: false,
+          addFeeModel: {
+            subjectType: null,
+            feeMoney: null,
+            remark: null,
+          },
+          barTree: [
+            {
+              id: 6,
+              name: '商品'
+            },
+            {
+              id: 10,
+              name: '手工房费'
+            },
+            {
+              id: 12,
+              name: '赔偿费'
+            },
+            {
+              id: 13,
+              name: '其他'
+            }
+          ],
+          barId: 6,
           dataSource: [],
+          chooseGoodsList: [],
           columns: [
-                {
-                    title: '名称',
-                    align: 'center',
-                    dataIndex: 'name'
-                },
-                {
-                    title: '售价',
-                    align: 'center',
-                    dataIndex: 'sellingPrice',
-                    scopedSlots: {
-                        customRender: 'sellingPrice'
-                    }
-                },
-                {
-                    title: '数量',
-                    align: 'center',
-                    dataIndex: 'number',
-                    width: '80',
-                    scopedSlots: {
-                        customRender: 'number'
-                    }
-                },
-                {
-                    title: '剩余库存',
-                    align: 'center',
-                    dataIndex: 'inventory',
-                    width: '80',
-                    scopedSlots: {
-                        customRender: 'inventorySlot'
-                    }
-                }
-            ],
-          ipagination: {
-            current: 1,
-            pageSize: 10,
-            pageSizeOptions: ['10', '20', '30'],
-            showTotal: (total, range) => {
-              return range[0] + "-" + range[1] + " 共" + total + "条"
-          },
-          showQuickJumper: true,
-          showSizeChanger: true,
-          total: 0
-          },
-          stockTypeList: [],
+            {
+              title: '名称',
+              align: 'center',
+              dataIndex: 'name'
+            },
+            {
+              title: '售价',
+              align: 'center',
+              dataIndex: 'sellingPrice',
+            },
+            {
+              title: '库存',
+              align: 'center',
+              dataIndex: 'inventory',
+              width: '80',
+              scopedSlots: {
+                customRender: 'inventorySlot'
+              }
+            }
+          ],
+          chooseColumns: [
+            {
+              title: '名称',
+              align: 'center',
+              dataIndex: 'name'
+            },
+            {
+              title: '售价',
+              align: 'center',
+              dataIndex: 'sellingPrice',
+              scopedSlots: {
+                customRender: 'sellingPrice'
+              }
+            },
+            {
+              title: '数量',
+              align: 'center',
+              dataIndex: 'number',
+              scopedSlots: {
+                customRender: 'number'
+              }
+            },
+            {
+              title: '金额',
+              align: 'center',
+              customRender: function (text, record) {
+                return record.sellingPrice * record.number
+              }
+            },
+            {
+              title: '操作',
+              dataIndex: 'action',
+              key: 'action',
+              align: 'center',
+              scopedSlots: { customRender: 'action' }
+            }
+          ],
           model: {
                 payType: 1,
                 livingOrderId: '',
@@ -238,55 +310,55 @@ export default {
                 subjectType: 6,
                 vipCustomerId: null
             },
-            markerMemberCard: {},
-            queryParams: {},
-            labelCol: {
-                xs: {
-                    span: 24
-                },
-                sm: {
-                    span: 5
-                }
-            },
-            wrapperCol: {
-                xs: {
-                    span: 24
-                },
-                sm: {
-                    span: 16
-                }
-            },
-            confirmLoading: false,
-            validatorRules: {
-                subjectType: [{
-                    required: true,
-                    message: '请输入消费项目!'
-                }],
-                money: [{
-                    required: true,
-                    message: '请输入金额!'
-                }]
-            },
-            url: {
-                list: '/rooms/cesGoods/kf-goods-list',
-                edit: '/business/busMemberCard/edit',
-                queryById: '/business/busMemberCard/queryById'
-            },
-            gradeList: [],
-            paymentMethodList: [],
-            staffList: [],
-            customerList: [],
-            oldcustomerList: []
+          markerMemberCard: {},
+          queryParams: {},
+          labelCol: {
+              xs: {
+                  span: 24
+              },
+              sm: {
+                  span: 5
+              }
+          },
+          wrapperCol: {
+              xs: {
+                  span: 24
+              },
+              sm: {
+                  span: 16
+              }
+          },
+          confirmLoading: false,
+          validatorRules: {
+              subjectType: [{
+                  required: true,
+                  message: '请输入消费项目!'
+              }],
+              money: [{
+                  required: true,
+                  message: '请输入金额!'
+              }]
+          },
+          url: {
+              list: '/rooms/cesGoods/kf-goods-list',
+              edit: '/business/busMemberCard/edit',
+              queryById: '/business/busMemberCard/queryById'
+          },
+          gradeList: [],
+          paymentMethodList: [],
+          staffList: [],
+          customerList: [],
+          oldcustomerList: []
         }
     },
     computed: {
-        formDisabled() {
-            return this.disabled
-        },
-        goodsPrice() {
-            let money = this.dataSource.reduce((pre, cur) => pre + cur.sellingPrice * (cur.number || 0), 0)
-            return money
-        }
+      formDisabled() {
+          return this.disabled
+      },
+      moneyAmount() {
+            let money = this.chooseGoodsList.reduce((pre, cur) => pre + cur.sellingPrice * (cur.number || 0), 0)
+            return money == null ? 0 : money
+      }
     },
     created() {
         var _info = JSON.parse(localStorage.getItem('storeInfo'))
@@ -300,7 +372,94 @@ export default {
 
     },
     methods: {
-        changeNumber() {
+      chooseBar(item) {
+        this.barId = item.id
+        if (item.id === 6) {
+          this.queryParams.goodTypeId = null
+          this.loadData()
+          return
+        } else if (item.id === 10 || item.id === 12 || item.id === 13) {
+          this.addFeeModel.remark = this.getSubjectTypeText(item.id)
+          this.addFeeVisible = true
+          return
+        }
+        this.queryParams.goodTypeId = item.id
+        this.loadData()
+      },
+      addFee() {
+        let obj = {
+          sellingPrice: this.addFeeModel.feeMoney,
+          number: 1,
+          remark: this.addFeeModel.remark,
+          name: this.addFeeModel.remark,
+          subjectType: this.barId
+        }
+        this.chooseGoodsList.push(obj)
+        this.addFeeVisible = false
+      },
+      deleteFee(record) {
+        let index = this.chooseGoodsList.findIndex(e => e === record)
+        if (index !== -1) {
+          this.chooseGoodsList.splice(index, 1)
+          if (record.id != null) {
+            record.inventory = record.inventory + record.number
+          }
+        }
+      },
+      getSubjectTypeText(text, record) {
+        var msg = ''
+        if (text == 1) {
+          msg = '押金'
+          //
+          if (record.remark != null && record.remark != '') {
+            msg = record.remark
+          }
+        } else if (text == 2) {
+          msg = '预收房费'
+        } else if (text == 3) {
+          msg = '每日房费'
+        } else if (text == 4) {
+          msg = '优惠金额'
+        } else if (text == 5) {
+          msg = '结账收款'
+        } else if (text == 6) {
+          msg = '商品-' + record.feeGoodVo.name
+        } else if (text == 7) {
+          msg = '点餐-' + record.feeGoodVo.name
+        } else if (text == 8) {
+          msg = '夜审房费'
+        } else if (text == 9) {
+          msg = '会议室'
+        } else if (text == 10) {
+          msg = '手工房费'
+        } else if (text == 11) {
+          msg = '水电煤抄表'
+        } else if (text == 12) {
+          msg = '赔偿费'
+        } else if (text == 13 && record != null) {
+          msg = record.remark
+        }
+        return msg
+      },
+
+      handleRowClick(row) {
+        return {
+          on: {
+            dblclick: () => {
+              if (row.inventory - row.number <= 0) {
+                this.$message.warning('库存不足')
+                return
+              }
+              row.number++
+              if (!this.chooseGoodsList.some(e => e === row)) {
+                this.chooseGoodsList.push(row)
+              }
+            }
+          }
+        }
+      },
+
+      changeNumber() {
             console.log(this.dataSource)
         },
         handleSearch(value) {
@@ -360,7 +519,8 @@ export default {
               return
             }
             this.stockTypeList = res.result
-            console.log(this.stockTypeList)
+            this.$set(this.barTree[0], 'children', this.stockTypeList)
+            this.$forceUpdate()
           })
         },
         stockTypeChange(e) {
@@ -375,6 +535,7 @@ export default {
         edit(record) {
             this.model = Object.assign({}, record)
             this.visible = true
+          debugger
             this.loadData()
         },
         submitForm() {
@@ -382,7 +543,7 @@ export default {
             // 触发表单验证
             this.$refs.form.validate((valid) => {
                 if (valid) {
-                    if (this.dataSource.every(ele => ele.number == 0) && this.model.subjectType == 6) {
+                    if (this.chooseGoodsList.every(ele => ele.number == 0) && this.model.subjectType == 6) {
                         this.$message.warning('请至少选择一件商品')
                         return
                     }
@@ -390,33 +551,27 @@ export default {
                     var orders = []
                     let feeGood = {}
 
-                    if (this.model.subjectType === 6) {
-                        that.dataSource.forEach(ele => {
-                        if (ele.number > 0) {
-                            feeGood = {
-                                goodsId: ele.id,
-                                num: ele.number,
-                                price: ele.sellingPrice
-                            }
-                            orders.push({
-                              money: ele.sellingPrice * (ele.number || 0),
-                              subjectType: this.model.subjectType,
-                              feeGoodVo: feeGood
+                    that.chooseGoodsList.forEach(ele => {
+                      if (ele.id != null) {
+                          feeGood = {
+                              goodsId: ele.id,
+                              num: ele.number,
+                              price: ele.sellingPrice
+                          }
+                          orders.push({
+                            money: ele.sellingPrice * (ele.number || 0),
+                            subjectType: 6,
+                            feeGoodVo: feeGood
                           })
-                            }
+                      } else {
+                        orders.push({
+                          money: ele.sellingPrice,
+                          subjectType: ele.subjectType,
+                          remark: ele.remark
                         })
-                        that.model.money = that.goodsPrice
-                    } else {
-                      if (this.model.money == null || this.model.money === 0) {
-                        that.confirmLoading = false
-                        this.$message.warning('请输入金额')
-                        return
                       }
-                      orders.push({
-                        money: this.model.money,
-                        subjectType: this.model.subjectType
-                      })
-                    }
+                    })
+                  console.log(orders)
                     this.model.orders = orders
                     httpAction('/business/busRoomBookingOrders/set-living-order-fee?livingOrderId=' + this.model.livingOrderId, orders, 'post')
                         .then((res) => {
@@ -433,54 +588,41 @@ export default {
                 }
             })
         },
-        loadData(arg) {
-            if (this.url.list == 2) {
-                return
-            }
-            if (!this.url.list) {
-                this.$message.error('请设置url.list属性!')
-                return
-            }
-            // 加载数据 若传入参数1则加载第一页的内容
-            if (arg === 1) {
-                this.ipagination.current = 1
-            }
-            let params = {
-              pageSize: this.ipagination.pageSize,
-              pageNo: this.ipagination.current,
-              name: this.queryParams.name,
-              goodType: this.queryParams.goodTypeId
-            }
-            this.loading = true
-            getAction(this.url.list, params).then((res) => {
-                if (res.success) {
-                    // update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
-                    let arr = []
-                    arr = res.result.records || res.result
-                    arr.forEach(ele => {
-                        ele.number = 0
-                    })
-                    this.dataSource = JSON.parse(JSON.stringify(arr))
-                    if (res.result.total) {
-                        this.ipagination.total = res.result.total
-                    } else {
-                        this.ipagination.total = 0
-                    }
-                    this.getMarkerMemberByCarId()
-                  this.loading = false
-                    // update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
-                } else {
-                    this.$message.warning(res.message)
-                }
-            }).finally(() => {
-                this.loading = false
+      loadData(arg) {
+        if (this.url.list == 2) {
+          return
+        }
+        if (!this.url.list) {
+          this.$message.error('请设置url.list属性!')
+          return
+        }
+        let params = {
+          pageSize: 9999,
+          pageNo: 1,
+          name: this.queryParams.name,
+          goodType: this.queryParams.goodTypeId
+        }
+        this.loading = true
+        getAction(this.url.list, params).then((res) => {
+          if (res.success) {
+            // update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+            let arr = []
+            arr = res.result.records || res.result
+            arr.forEach(ele => {
+              ele.number = 0
             })
-        },
-        pageChange(page) {
-          console.log(page)
-          this.ipagination = page
-          this.loadData()
-        },
+            this.dataSource = JSON.parse(JSON.stringify(arr))
+            this.getMarkerMemberByCarId()
+            this.loading = false
+            // update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
+          } else {
+            this.$message.warning(res.message)
+          }
+        }).finally(() => {
+          this.loading = false
+        })
+      },
+
     }
 }
 </script>

+ 1 - 1
src/views/room/modules/checkIn/FeeModal.vue

@@ -23,7 +23,7 @@
     data () {
       return {
         title:'',
-        width:800,
+        width:1100,
         visible: false,
         disableSubmit: false,
         livingOrderId:''

+ 212 - 217
src/views/room/modules/checkIn/PayOrRefund.vue

@@ -13,14 +13,7 @@
           </a-col> -->
           <div class="crad_style">
             <a-col :span="8" class="refund_style" v-show="showYinshou">
-              <!-- <a-form-model-item
-                :label="&quot;结账应&quot; + (model.money < 0 ? &quot;退&quot; : &quot;收&quot;)"
-                :labelCol="labelCol"
-                :wrapperCol="wrapperCol"
-                prop="money"
-              > -->
-              <!--  {{ Math.abs(model.money.toFixed(2)) }}元 -->
-              <span>{{ &quot;应&quot; + (model.money < 0 ? &quot;退&quot; : &quot;收&quot;) }}: {{ realityAmount }}元</span>
+              <span>{{ '应' + (model.money < 0 ? '退' : '收') }}: {{ realityAmount.toFixed(2) }}元</span>
               <!-- </a-form-model-item> -->
             </a-col>
             <a-col :span="16">
@@ -29,39 +22,38 @@
                 :labelCol="labelCol"
                 :wrapperCol="wrapperCol"
               >
-
-                {{ model.collection.toFixed(2) }}元
+                {{ model.collection != null ?model.collection.toFixed(2) : 0}}元
               </a-form-model-item>
               <a-form-model-item
                 label="消费金额"
                 :labelCol="labelCol"
                 :wrapperCol="wrapperCol"
               >
-                {{ model.consumption.toFixed(2) }}元
+                {{ model.consumption != null ? model.consumption.toFixed(2) : 0}}元
                 <a-switch v-model="model.coupon" />优惠
-                <a-radio-group v-if='model.coupon' v-model="model.preferentialType">
+                <a-radio-group v-if="model.coupon" v-model="model.preferentialType">
                   <a-radio :value="1"> 抹零 </a-radio>
                   <a-radio :value="2"> 减现 </a-radio>
                   <a-radio :value="3"> 打折 </a-radio>
                 </a-radio-group>
                 <template
-                    v-if="model.preferentialType === 3"
-                  >打<a-input-number
-                    style="width: 50px"
-                    v-model="model.discount"
-                    :min="1"
-                    :max="99"
-                  ></a-input-number
-                  >折
-                  </template>
-                  <template v-if="model.preferentialType == 2">
-                    优惠金额: <a-input-number
-                    style="width: 100px"
+                  v-if="model.preferentialType === 3"
+                >打<a-input-number
+                  style="width: 60px"
+                  v-model="model.discount"
+                  :min="1"
+                  :max="99"
+                ></a-input-number
+                >折
+                </template>
+                <template v-if="model.preferentialType == 2">
+                  优惠金额: <a-input-number
+                    style="width: 80px"
                     :min="0"
                     v-model="model.couponFirstAmount"
                     placeholder="请输入优惠金额"
-                    ></a-input-number
-                    >元
+                  ></a-input-number
+                  >元
                 <!-- <a-form-model-item
                   label="优惠金额"
                   :labelCol="labelCol"
@@ -70,41 +62,41 @@
                 >
 
                 </a-form-model-item> -->
-              </template>
+                </template>
               </a-form-model-item>
               <!-- <a-col :span="24" v-if="model.preferentialType == 2"> -->
 
               <a-form-model-item
-                  label="优惠券"
-                  :labelCol="labelCol"
-                  :wrapperCol="wrapperCol"
-                  prop="refund"
-                  v-if='model.coupon'
+                label="优惠券"
+                :labelCol="labelCol"
+                :wrapperCol="wrapperCol"
+                prop="refund"
+                v-if="model.coupon"
+              >
+                <a-select
+                  v-if="model.couponCard"
+                  v-model="model.couponId"
+                  style="width: 200px"
+                  placeholder="优惠券"
+                  :allowClear="true"
                 >
-                  <a-select
-                    v-if="model.couponCard"
-                    v-model="model.couponId"
-                    style="width: 200px"
-                    placeholder="优惠券"
-                    :allowClear="true"
+                  <a-select-option
+                    :value="couponItem.id"
+                    v-for="couponItem in memeberCouponList"
+                    :key="couponItem.id"
+                  >{{ couponItem.couponsName }}</a-select-option
                   >
-                    <a-select-option
-                      :value="couponItem.id"
-                      v-for="couponItem in memeberCouponList"
-                      :key="couponItem.id"
-                    >{{ couponItem.couponsName }}</a-select-option
-                    >
-                  </a-select>
-                  <a-switch v-model="model.couponCard" />使用优惠券
-                </a-form-model-item>
-                <a-form-model-item
-                v-if='model.coupon'
-                  label="惠后金额"
-                  :labelCol="labelCol"
-                  :wrapperCol="wrapperCol"
-                >
-                  {{ couponAmount }}元
-                </a-form-model-item>
+                </a-select>
+                <a-switch v-model="model.couponCard" />使用优惠券
+              </a-form-model-item>
+              <a-form-model-item
+                v-if="model.coupon"
+                label="惠后金额"
+                :labelCol="labelCol"
+                :wrapperCol="wrapperCol"
+              >
+                {{ couponAmount.toFixed(2) }}元
+              </a-form-model-item>
               <!-- </a-col> -->
 
               <template v-if="model.coupon">
@@ -139,7 +131,7 @@
 
               </a-col>
               </a-col> -->
-            </template>
+              </template>
             <!-- <a-form-model-item
                 :label="&quot;实&quot; + (this.isRefund ? &quot;退&quot; : &quot;收&quot;) + &quot;金额&quot;"
                 :labelCol="labelCol"
@@ -152,23 +144,20 @@
 
             </a-col> -->
 
-
-
-
             <!-- <a-col :span="24">-->
 
             </a-col>
           </div>
-         <div class="presentation_style" v-if="model.money > 0">应收金额=消费合计/惠后金额-已收合计</div>
-          <a-col :span="14" class="receipt_style" v-if="model.money > 0">
+          <div class="presentation_style" v-if="!isRefund">应收金额=消费合计/惠后金额-已收合计</div>
+          <a-col :span="14" class="receipt_style" v-if="!isRefund">
             <a-form-model-item
-              :label="(this.isRefund ? &quot;退&quot; : &quot;&quot;) + &quot;款金额&quot;"
+              label="收款金额"
               :labelCol="labelCol"
               :wrapperCol="wrapperCol"
             >
               <div v-for="(item, index) in payList" :key="index">
                 <a-row type="flex" :key="index">
-                  <a-col :span="6">
+                  <a-col :span="9">
                     <a-input-number
                       style="width: 100px"
                       v-model="item.money"
@@ -233,20 +222,16 @@
               </div>
             </a-form-model-item>
           </a-col>
-          <a-col :span="14" class="settle_style" v-if="model.money > 0">
-            <a-form-model-item
-              :label="&quot;实&quot; + (this.isRefund ? &quot;退&quot; : &quot;收&quot;) + &quot;合计&quot;"
-              :labelCol="labelCol"
-              :wrapperCol="wrapperCol"
-            >
-              {{ Math.abs(sumAmount.toFixed(2)) }}元
-            </a-form-model-item>
-          </a-col>
-          <div class="presentation_style_two" v-if="model.money < 0">退款:
+          <div class="presentation_style_two" v-if="isRefund">退款:
             <a-button danger type="link" @click="addCustomRefund">新增自定义退款</a-button>
           </div>
-          <a-col :span="24" v-if="model.money < 0">
-            <a-table :columns="columns" :data-source="feeList" bordered>
+          <!--退款表格-->
+          <a-col :span="24" v-if="isRefund">
+            <a-table :columns="columns" :data-source="combineFeeList" bordered :pagination="false" :scroll="{ y: 250 }" >
+              <template #footer>
+                <span style="font-size: 15px;margin-left: 410px; margin-right: 10px">{{ '退款合计:' + Math.abs(sumAmount) + ' 元' }}</span>&nbsp; &nbsp;
+                <span style="font-size: 15px"> {{ '还应退:' + (realityAmount - Math.abs(sumAmount)).toFixed(2) + ' 元' }}</span>
+              </template>
               <template slot="payType" slot-scope="text, record, index">
                 {{ getPayTypeText(text) }}
               </template>
@@ -262,7 +247,7 @@
                 </a-select>
               </template>
               <template slot="prerefund" slot-scope="text, record, index">
-                <a-input-number :min="0" :max="record.money - record.returnMoney" v-model="record.prerefund" :default-value="0"></a-input-number>
+                <a-input-number :min="0" :max="record.money - record.returnMoney" v-model="record.prerefund" style="width: 80%"></a-input-number>
               </template>
               <template slot="operation" slot-scope="text, record, index">
                 <!-- <a-popconfirm
@@ -280,16 +265,16 @@
                 <span v-else>{{ record.returnMoney }}</span> -->
               </template>
             </a-table>
-            <a-col :span="7" class="settle_style" v-if="model.money < 0">
+          </a-col>
+          <a-col :span="20" class="settle_style" v-if="!isRefund">
             <a-form-model-item
-              :label="&quot;实&quot; + (this.isRefund ? &quot;退&quot; : &quot;收&quot;) + &quot;合计&quot;"
               :labelCol="labelCol"
               :wrapperCol="wrapperCol"
             >
-              {{ Math.abs(sumAmount.toFixed(2)) }}元
+              <span style="font-size: 18px;margin-left: 20px; margin-right: 20px">{{ '实收合计:' + Math.abs(sumAmount) + ' 元' }}</span>
+              <span style="font-size: 18px"> {{ '还差' + (realityAmount - Math.abs(sumAmount)).toFixed(2) + ' 元' }}</span>
             </a-form-model-item>
           </a-col>
-          </a-col>
           <a-col :span="24" style="text-align: end">
             <a-checkbox default-checked>打印结账单</a-checkbox>
             <a-checkbox default-checked>打印发票二维码</a-checkbox>
@@ -301,9 +286,10 @@
 </template>
 
 <script>
-import { httpAction, getAction,postAction } from '@/api/manage'
+import { httpAction, getAction, postAction } from '@/api/manage'
 import { validateDuplicateValue } from '@/utils/util'
 import moment from 'moment/moment'
+import { isNumber } from 'xe-utils/methods'
 export default {
   name: 'PayOrRefund',
   components: {},
@@ -323,6 +309,8 @@ export default {
   data() {
     return {
       feeList: [],
+      originalFeeList: [],
+      combineFeeList: [],
       isRefund: false,
       model: {
         coupon: false,
@@ -335,11 +323,11 @@ export default {
       },
       labelCol: {
         xs: { span: 24 },
-        sm: { span: 5 }
+        sm: { span: 4 }
       },
       wrapperCol: {
         xs: { span: 24 },
-        sm: { span: 16 }
+        sm: { span: 20 }
       },
       confirmLoading: false,
       validatorRules: {
@@ -381,14 +369,17 @@ export default {
       allFeeMoney: 0,
       allReturnFee: 0,
       columns: [
+
         {
-          title: '收款时间',
-          dataIndex: 'createTime',
-          width: '25%',
+          // title: '序号',
+          key: 'key',
+          align: 'center',
+          customRender: (text, record, index) => `${index + 1}`// 此处为重点
         },
         {
-          title: '收款金额(元)',
+          title: '可退金额(元)',
           dataIndex: 'id',
+          align: 'center',
           width: '15%',
           customRender: function (text, record) {
             return record.money
@@ -397,26 +388,31 @@ export default {
         {
           title: '退款方式',
           dataIndex: 'payType',
+          align: 'center',
           // width: '40%',
           scopedSlots: { customRender: 'payType' }
         },
         {
           title: '退款金额(元)',
           dataIndex: 'prerefund',
+          align: 'center',
           scopedSlots: { customRender: 'prerefund' }
         },
         {
           title: '已退金额(元)',
-          dataIndex: 'returnMoney',
-          scopedSlots: { customRender: 'returnMoney' }
+          align: 'center',
+          customRender: function (text, record) {
+            return record.prerefund
+          }
         },
         {
           title: '操作',
-          width: '100px',
-          scopedSlots: { customRender: 'operation' },
+          // width: '150px',
+          align: 'center',
+          scopedSlots: { customRender: 'operation' }
           // dataIndex: 'operation',
-        },
-      ],
+        }
+      ]
 //       [
 //   {
 //     title: '房间号',
@@ -486,26 +482,25 @@ export default {
       return this.disabled
     },
     sumAmount() {
-      console.log(this.isRefund);
+      console.log(this.isRefund)
       if (this.isRefund) {
-        var sum = this.feeList.reduce(function (total, item) {
-          console.log(item);
-          if ('prerefund' in item) {
+        let sum = this.combineFeeList.reduce(function (total, item) {
+          console.log(item)
+          if (item && item.prerefund != null) {
             return total + item.prerefund
           } else {
-            return total + 0
+            return total
           }
-
         }, 0)
-        console.log(sum);
-        return sum
+        console.log(sum,'sum1')
+        return sum == null ? 0 : sum
       } else {
-        var sum = this.payList.reduce(function (total, item) {
-          return total + item.money
+        let sum = this.payList.reduce(function (total, item) {
+          return total + Number(item.money)
         }, 0)
-        return sum
+        console.log(sum,'sum2')
+        return sum == null ? 0 : sum
       }
-
     },
     // sumAmount() {
     //   var sum = this.payList.reduce(function (total, item) {
@@ -527,24 +522,23 @@ export default {
             sum = parseFloat(
               ((this.model.consumption * this.model.discount) / 100).toFixed(2)
             )
-          } else if(this.model.discount == 10){
+          } else if (this.model.discount == 10) {
             sum = parseFloat(
               ((this.model.consumption * this.model.discount) / 10).toFixed(2)
             )
-          } else if (this.model.discount < 10){
+          } else if (this.model.discount < 10) {
             sum = parseFloat(
               ((this.model.consumption * this.model.discount) / 10).toFixed(2)
             )
           }
-
         }
       } else {
-        sum = this.model.consumption
+        sum = this.model.consumption == null ? 0 : this.model.consumption
       }
-      return sum.toFixed(2)
+      return sum
     },
     realityAmount() {
-      console.log(this.model);
+      console.log(this.model)
       // 实际要收的钱,为负表示要退的钱
       let relMoney = this.couponAmount - this.model.collection
       this.isRefund = relMoney < 0
@@ -564,7 +558,7 @@ export default {
         this.payList[0].money = result
       }
       this.copyRealityAmount = result
-      return result.toFixed(2)
+      return result == null ? 0 : result
     }
   },
   created() {
@@ -590,7 +584,7 @@ export default {
         pageSize: 99999,
         pageNo: 1
       }).then((res) => {
-        console.log(res);
+        console.log(res)
         if (res.success) {
           this.payTypeList = res.result.records
           if (this.payTypeList && this.payTypeList.length > 0) {
@@ -618,8 +612,6 @@ export default {
                 this.payTypeList[index].delFlag = 99
               }
             }
-            this.$set(this.model, 'payType', this.payTypeList[0].id)
-
             this.payList = [
               {
                 money: this.realityAmount,
@@ -628,6 +620,7 @@ export default {
                 isDanwei: false
               }
             ]
+            console.log(this.payList,'payliet')
           }
         }
       })
@@ -754,10 +747,12 @@ export default {
             return
           }
           if (this.realityAmount != this.sumAmount) {
+            console.log(this.realityAmount)
+            console.log(this.sumAmount)
             that.$message.warning('实收金额和实收合计必须相等')
             return
           }
-          console.log(this.model);
+          console.log(this.model)
           // return
           var obj = {}
           var fees = []
@@ -801,25 +796,41 @@ export default {
           //     preferentialMoney: this.model.preferentialMoney
           //   })
           // })
-          console.log(this.feeList);
-          console.log(this.realityAmount);
-          console.log(this.sumAmount);
+
           let tempbreak = false
-          this.feeList.forEach(index => {
+          this.combineFeeList.forEach(index => {
             if (index.payType == null && this.isRefund) {
               this.$message.warning('请选择自定义退款退款方式')
               tempbreak = true
-              return
             }
           })
           if (tempbreak) {
             return
           }
-          // return
+          // 退款
           if (this.isRefund) {
-            this.feeList.forEach((item) => {
-              // let remark =
-              // let money = -money
+            let originalFeeList = JSON.parse(JSON.stringify(this.originalFeeList))
+            let isCustomFees = []
+            this.combineFeeList.forEach(e => {
+              if (e.isCustom) {
+                isCustomFees.push(e)
+                return
+              }
+              // 将组合退款上的退款金额,按支付方式摊到各个收款单
+              let prerefund = e.prerefund
+              originalFeeList.forEach(ele => {
+                if (prerefund > ele.money) {
+                  ele.prerefund = ele.money
+                  prerefund -= ele.money
+                } else {
+                  ele.prerefund = prerefund
+                  prerefund = 0
+                }
+              })
+            })
+            // 添加自定义收款
+            originalFeeList.push(...isCustomFees)
+            originalFeeList.forEach((item) => {
               fees.push({
                 feeType: this.model.feeType,
                 money: -item.prerefund,
@@ -890,116 +901,100 @@ export default {
     refundRequest() {
       let returnFeeList = []
       // let feeList = []
-      console.log(this.model);
+      console.log(this.model)
       let livingOrderIds = this.model.livingOrderId
-      console.log(livingOrderIds);
+      console.log(livingOrderIds)
       if (this.model.money < 0) {
-        postAction('/business/busOrderFee/refundList', livingOrderIds
-        // pageNo: 1,
-        // pageSize: 99,
-        // conditions: 900,
-        // mobile: this.model.vipCustomerId
-      ).then((res) => {
-        if (res.success) {
-          this.feeList = res.result
-        }
-
-        let templist = this.feeList
-        templist.forEach(e => {
-          if (e.returnItem == true) {
-            e.money = -e.money;
-            returnFeeList.push(e)
-          }
-        })
-        // console.log(templist);
-        // console.log(returnFeeList);
-
-        templist.forEach(e => {
-          let returnMoney = returnFeeList.filter(ele => e.id === ele.returnFeeId).reduce((accumulator, ele) => accumulator + ele.money, 0)
-          e.returnMoney = returnMoney;
-        })
-        templist.forEach(cust => [
-          // let tempfeelist = returnFeeList.filter(curr => {curr.returnFeeId == cust.id})
-          // let tempfeelist = returnFeeList.filter(function(item, index, array) {
-          //   return curr.returnFeeId == cust.id
-          // })
-          // console.log(tempfeelist);
-          returnFeeList.forEach(curr => {
-            if (cust.returnFeeId == curr.returnFeeId) {
-              let tempindex = templist.findIndex(temp => temp == cust)
-              templist.splice(tempindex,1)
+        postAction('/business/busOrderFee/refundList', livingOrderIds).then((res) => {
+          // 过滤掉退款单
+          this.originalFeeList = res.result.filter(e => !e.returnItem)
+          this.originalFeeList.forEach(e => {
+            let returnMoney = res.result.filter(ele => e.id === ele.returnFeeId).reduce((accumulator, ele) => accumulator + ele.money, 0)
+            e.money = e.money - returnMoney
+          })
+          console.log(res.result.filter(e => e.returnItem))
+          console.log(this.originalFeeList, 'originalFeeList')
+          let originalFeeListCopy = JSON.parse(JSON.stringify(this.originalFeeList))
+          originalFeeListCopy.forEach(e => {
+            if (this.combineFeeList.length === 0) {
+              this.combineFeeList.push(e)
+              return
+            }
+            let find = this.combineFeeList.find(ele => ele.payType != null && e.payType === ele.payType)
+            if (find != null) {
+              find.money += e.money
+            } else {
+              this.combineFeeList.push(e)
             }
           })
-        ])
+          console.log(this.combineFeeList, '9999999999999')
 
-        console.log(returnFeeList);
-        // templist.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)
-        //     // e.roomName = room[0].roomName
-        //     // this.$set(e, 'refundType', e.payType)
-        //     // let payTypeList = JSON.parse(JSON.stringify(this.payTypeList));
-        //     // console.log(room[0].livingOrder.vipCustomerId)
-        //     // console.log(room[0].livingOrder.contractTeamId)
-        //     // console.log(vipIndex)
-        //     // console.log(danweiIndex)
-        //     // this.$set(payTypeList[vipIndex], 'disable', room[0].livingOrder.vipCustomerId == null || room[0].livingOrder.vipCustomerId === '')
-        //     // this.$set(payTypeList[danweiIndex], 'disable', room[0].livingOrder.contractTeamId == null)
-        //     // this.$set(e, 'payTypeList', payTypeList)
-        //     // feeList.push(e)
-        //   }
-        // })
-        // this.feeList = feeList
-        // 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;
-        //   this.allReturnFee += returnMoney;
-        //   // console.log(returnMoney);
-        // })
-        // console.log(this.feeList);
-        // console.log(this.templist);
-        // this.feeList.forEach(index => {
-        //   templist.forEach(item => {
-        //     if (index.id == item.returnFeeId) {
-        //       let tempindex = this.feeList.findIndex(item)
-        //       this.feeList.slice(tempindex,1)
-        //     }
-        //   })
-        // })
+          // templist.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)
+          //     // e.roomName = room[0].roomName
+          //     // this.$set(e, 'refundType', e.payType)
+          //     // let payTypeList = JSON.parse(JSON.stringify(this.payTypeList));
+          //     // console.log(room[0].livingOrder.vipCustomerId)
+          //     // console.log(room[0].livingOrder.contractTeamId)
+          //     // console.log(vipIndex)
+          //     // console.log(danweiIndex)
+          //     // this.$set(payTypeList[vipIndex], 'disable', room[0].livingOrder.vipCustomerId == null || room[0].livingOrder.vipCustomerId === '')
+          //     // this.$set(payTypeList[danweiIndex], 'disable', room[0].livingOrder.contractTeamId == null)
+          //     // this.$set(e, 'payTypeList', payTypeList)
+          //     // feeList.push(e)
+          //   }
+          // })
+          // this.feeList = feeList
+          // 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;
+          //   this.allReturnFee += returnMoney;
+          //   // console.log(returnMoney);
+          // })
+          // console.log(this.feeList);
+          // console.log(this.templist);
+          // this.feeList.forEach(index => {
+          //   templist.forEach(item => {
+          //     if (index.id == item.returnFeeId) {
+          //       let tempindex = this.feeList.findIndex(item)
+          //       this.feeList.slice(tempindex,1)
+          //     }
+          //   })
+          // })
 
-        // this.feeList.forEach(item => {
+          // this.feeList.forEach(item => {
 
-        // })
-      })
+          // })
+        })
       }
-
     },
     // 新增自定义退款
     addCustomRefund() {
-      this.feeList.push({
+      this.combineFeeList.push({
         createTime: '自定义退款',
         payType: null,
         prerefund: 0,
-        // pullDown: false
+        // 是自定义的
+        isCustom: true
       })
-      console.log(this.feeList);
     },
     // 减少自定义退款
     reduceCustomization(val) {
-      console.log(val);
-      let tempindex = this.feeList.findIndex(index => index == val)
-      this.feeList.splice(tempindex,1)
-    },
+      console.log(val)
+      let tempindex = this.combineFeeList.findIndex(index => index == val)
+      this.combineFeeList.splice(tempindex, 1)
+    }
   }
 }
 </script>

+ 1 - 1
src/views/room/modules/checkIn/PayOrRefundModal.vue

@@ -28,7 +28,7 @@ export default {
   data() {
     return {
       title: "",
-      width: 1300,
+      width: 1000,
       visible: false,
       disableSubmit: false,
       showYinshou: true,

+ 3 - 3
src/views/room/modules/checkIn/Payment.vue

@@ -140,7 +140,7 @@
                       v-if="index == payList.length - 1"
                       type="plus-circle"
                       class="dynamic-delete-button"
-                      @click="puls()" />
+                      @click="plus()" />
                     <a-icon
                       v-if="payList.length > 1"
                       type="minus-circle"
@@ -391,7 +391,7 @@ export default {
         }
       })
     },
-    puls() {
+    plus() {
       var sum = this.payList.reduce(function (total, item) {
         return total + item.money
       }, 0)
@@ -517,7 +517,7 @@ export default {
           var fees = []
           console.log(this.model)
           console.log(this.model.subjectType)
-          
+
           if (this.model.coupon) {
             fees.push({
               feeType: this.model.feeType,

+ 4 - 2
src/views/room/modules/checkIn/StrikeBalanceModel.vue

@@ -18,7 +18,8 @@
       :columns="columns"
       :data-source="feesList"
       :pagination="false"
-      :scroll="{ y: 160 }"
+      :scroll="{ y: 400 }"
+      style="height: 430px"
       rowKey="id">
       <template slot="subjectType" slot-scope="text, record">
         {{ getSubjectTypeText(text, record) }}
@@ -35,7 +36,8 @@
       :columns="columnstwo"
       :data-source="productList"
       :pagination="false"
-      :scroll="{ y: 160 }"
+      :scroll="{ y: 400 }"
+      style="height: 430px"
       rowKey="id">
       <template slot="subjectType" slot-scope="text, record">
         {{ getSubjectTypeText(text, record) }}

+ 8 - 0
src/views/settings/roomSettings.vue

@@ -72,6 +72,14 @@
                 </span>
         <meal-coupon-list></meal-coupon-list>
       </a-tab-pane>
+
+      <a-tab-pane key="11">
+                <span slot="tab">
+                    <a-icon type="file"/>
+                    长租
+                </span>
+        <long-rent-scheme></long-rent-scheme>
+      </a-tab-pane>
     </a-tabs>
   </a-card>
 </template>