|
|
@@ -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=""结账应" + (model.money < 0 ? "退" : "收")"
|
|
|
- :labelCol="labelCol"
|
|
|
- :wrapperCol="wrapperCol"
|
|
|
- prop="money"
|
|
|
- > -->
|
|
|
- <!-- {{ Math.abs(model.money.toFixed(2)) }}元 -->
|
|
|
- <span>{{ "应" + (model.money < 0 ? "退" : "收") }}: {{ 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=""实" + (this.isRefund ? "退" : "收") + "金额""
|
|
|
: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 ? "退" : "收") + "款金额""
|
|
|
+ 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=""实" + (this.isRefund ? "退" : "收") + "合计""
|
|
|
- :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>
|
|
|
+ <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=""实" + (this.isRefund ? "退" : "收") + "合计""
|
|
|
: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>
|