| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- <template>
- <j-modal
- :title="title"
- :width="width"
- :visible="visible"
- switchFullscreen
- @ok="handleOk"
- :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
- @cancel="handleCancel"
- cancelText="关闭"
- >
- <a-radio-group v-model="tebdata" style="margin-bottom: 16px">
- <a-radio-button value="small">金额冲账</a-radio-button>
- <a-radio-button value="default">商品冲账</a-radio-button>
- </a-radio-group>
- <a-table
- v-if="tebdata == 'small'"
- :columns="columns"
- :data-source="feesList"
- :pagination="false"
- :scroll="{ y: 160 }"
- rowKey="id">
- <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()" :min="0"></a-input-number>
- </template>
- <template slot="remark" slot-scope="text, record">
- <a-textarea v-model=record.remark></a-textarea>
- </template>
- </a-table>
- <a-table
- v-if="tebdata == 'default'"
- :columns="columnstwo"
- :data-source="productList"
- :pagination="false"
- :scroll="{ y: 160 }"
- rowKey="id">
- <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()" :min="0"></a-input-number> -->
- {{ record.money }}
- </template>
- <template slot="num" slot-scope="text, record">
- <a-input-number v-model='record.num' :min="1" :max="record.feeGoodVo.num"></a-input-number>
- <!-- {{ record.money }} -->
- </template>
-
- <template slot="remark" slot-scope="text, record">
- <a-textarea v-model=record.remark></a-textarea>
- </template>
- </a-table>
- </j-modal>
- </template>
- <script>
- import { postAction } from '@api/manage'
- const columns = [
- {
- title: '房间',
- dataIndex: 'roomName',
- width: 30,
- align: 'center'
- },
- {
- title: '费项',
- dataIndex: 'subjectType',
- width: 60,
- align: 'center',
- scopedSlots: { customRender: 'subjectType' }
- },
- {
- title: '日期',
- dataIndex: 'dayTime',
- width: 100,
- align: 'center'
- },
- {
- title: '金额',
- dataIndex: 'oldPrice',
- width: 60,
- align: 'center'
- },
- {
- title: '冲账金额',
- dataIndex: 'money',
- width: 60,
- align: 'center',
- scopedSlots: { customRender: 'money'}
- },
- {
- title: '备注',
- dataIndex: 'remark',
- width: 60,
- align: 'center',
- scopedSlots: { customRender: 'remark'}
- },
- ]
- const columnstwo = [
- {
- title: '房间',
- dataIndex: 'roomName',
- width: 30,
- align: 'center'
- },
- {
- title: '费项',
- dataIndex: 'subjectType',
- width: 60,
- align: 'center',
- scopedSlots: { customRender: 'subjectType' }
- },
- {
- title: '日期',
- dataIndex: 'dayTime',
- width: 100,
- align: 'center'
- },
- {
- title: '金额',
- dataIndex: 'oldPrice',
- width: 60,
- align: 'center'
- },
- {
- title: '数量',
- // dataIndex: 'oldPrice',
- width: 60,
- align: 'center',
- customRender: function (text, record) {
- return record.feeGoodVo.num
- }
- },
- {
- title: '冲账数量',
- dataIndex: 'num',
- width: 60,
- align: 'center',
- scopedSlots: { customRender: 'num'},
- customRender: function (text, record) {
- return record.feeGoodVo.num
- }
- },
- {
- title: '冲账金额',
- dataIndex: 'money',
- width: 60,
- align: 'center',
- scopedSlots: { customRender: 'money'}
- },
- {
- title: '备注',
- dataIndex: 'remark',
- width: 60,
- align: 'center',
- scopedSlots: { customRender: 'remark'}
- },
- ]
- export default {
- name: 'StrikeBalanceModel',
- components: {
- },
- data() {
- return {
- title: '',
- width: 800,
- visible: false,
- disableSubmit: false,
- showYinshou: true,
- columns: columns,
- columnstwo: columnstwo,
- feesList: [],
- tebdata: 'small',
- // 商品
- productList:[]
- }
- },
- methods: {
- edit(record, map) {
- this.visible = true
- console.log(record)
- record.forEach(index => {
- if (index.feeGoodVo == null) {
- this.feesList.push(index)
- } else if (index.feeGoodVo !== null) [
- this.productList.push(index)
- ]
- })
- console.log(this.feesList);
- console.log(this.productList);
- // this.feesList = record
- this.feesList.forEach(e => {
- e.roomName = map.get(e.roomId)
- e.oldPrice = e.money
- })
- this.productList.forEach(e => {
- e.roomName = map.get(e.roomId)
- e.oldPrice = e.money
- })
- },
- close() {
- this.$emit('close')
- this.visible = false
- },
- handleOk() {
- // console.log(111);
- let fees = []
- if (this.feesList.some(e => e.money > e.oldPrice || e.money < 0)) {
- this.$message.warning('冲账金额不能超过原金额,且不能小于0')
- return
- } else {
- this.feesList.forEach(e => {
- // 一条消费可能有多次冲账,所以传入后端的money是冲账的负数差值
- if (e.oldPrice - e.money > 0) {
- let param = Object.assign({}, e)
- param.money = -param.money
- // param.money = param.money - param.oldPrice
- fees.push(param)
- }
- })
- }
- if (fees.length === 0) {
- return
- }
- console.log(fees);
- postAction('/business/busOrderFee/strike-balance', fees).then(resp => {
- if (resp.result === true) {
- this.$message.success('冲账成功')
- this.$emit('ok')
- this.visible = false
- } else {
- this.$message.warning('冲账失败')
- }
- });
- },
- handleCancel() {
- this.close()
- },
- getSubjectTypeText(text, record) {
- var msg = ''
- if (text === 1) {
- msg = '押金'
- } 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 = '点餐'
- } 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) {
- msg = '退单结账'
- }
- return msg
- },
- handleBlur() {
- this.$forceUpdate()
- }
- }
- }
- </script>
|