| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962 |
- <template>
- <a-spin :spinning="confirmLoading">
- <j-form-container :disabled="formDisabled">
- <a-form-model
- ref="form"
- :model="model"
- :rules="validatorRules"
- slot="detail"
- >
- <a-row>
- <!-- <a-col :span="12">
- </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"
- > -->
- <span>{{ "应" + (model.money < 0 ? "退" : "收") }}: {{ Math.abs(model.money.toFixed(2)) }}元</span>
- <!-- </a-form-model-item> -->
- </a-col>
- <a-col :span="16">
- <a-form-model-item
- label="收款金额"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- >
-
- {{ model.collection.toFixed(2) }}元
- </a-form-model-item>
- <a-form-model-item
- label="消费金额"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- >
- {{ model.consumption.toFixed(2) }}元
- <a-switch v-model="model.coupon" />优惠
- <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="9"
- ></a-input-number
- >折
- </template>
- </a-form-model-item>
- <!-- <a-col :span="24" v-if="model.preferentialType == 2"> -->
- <div v-if="model.preferentialType == 2">
- <a-form-model-item
- label="优惠金额"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="couponFirstAmount"
- >
- <a-input-number
- style="width: 100px"
- :min="0"
- v-model="model.couponFirstAmount"
- placeholder="请输入优惠金额"
- ></a-input-number
- >元
- </a-form-model-item>
- </div>
- <a-form-model-item
- label="优惠券"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="refund"
- >
- <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>
- <a-switch v-model="model.couponCard" />使用优惠券
- </a-form-model-item>
- <a-form-model-item
- label="惠后金额"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- >
- {{ couponAmount.toFixed(2) }}元
- </a-form-model-item>
- <!-- </a-col> -->
-
- <template v-if="model.coupon">
- <!-- <a-col :span="24">
- <a-form-model-item
- label="优惠方式"
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- prop="refund"
- >
- <a-radio-group 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="9"
- ></a-input-number
- >折
- </template>
- </a-form-model-item>
- </a-col> -->
-
- <!-- <a-col :span="24">
-
- <a-col :span="24">
-
- </a-col>
- </a-col> -->
- </template>
- <!-- <a-form-model-item
- :label=""实" + (this.isRefund ? "退" : "收") + "金额""
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- >
- {{ realityAmount.toFixed(2) }}元
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
-
- </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">
- <a-form-model-item
- :label="(this.isRefund ? "退" : "收") + "款金额""
- :labelCol="labelCol"
- :wrapperCol="wrapperCol"
- >
- <div v-for="(item, index) in payList" :key="index">
- <a-row type="flex" :key="index">
- <a-col :span="6">
- <a-input-number
- style="width: 100px"
- v-model="item.money"
- :min="0"
- ></a-input-number>
- </a-col>
- <a-col :span="6">
- <a-select
- v-model="item.payType"
- @change="(event) => onChange(event, item)"
- >
- <a-select-option
- :value="item2.id"
- v-for="item2 in payTypeList"
- :key="item2.id"
- :disabled="item2.delFlag == 99"
- >
- {{ item2.name }}
- </a-select-option>
- </a-select></a-col
- >
- <a-col :span="6">
- <a-icon
- v-if="index == payList.length - 1"
- type="plus-circle"
- class="dynamic-delete-button"
- @click="puls()" />
- <a-icon
- v-if="payList.length > 1"
- type="minus-circle"
- style="color: #f56c6c"
- class="dynamic-delete-button"
- @click="() => remove(index)"
- /></a-col>
- </a-row>
- <a-row type="flex" v-if="item.isVipMemmber">
- <a-col :span="12"> 姓名:{{ memberCard.name }} </a-col>
- <a-col :span="12"> 卡号:{{ memberCard.cardNo }} </a-col>
- <a-col :span="12">
- 会员级别: {{ memberCard.gradeName }}</a-col
- >
- <a-col :span="12"> 余额:{{ memberCard.balance }} </a-col>
- <a-col :span="12"> 积分:{{ memberCard.integral }} </a-col>
- <!-- <a-col :span="12"> 本次扣后剩余: </a-col>
- <a-col :span="12"> 本次新增积分: </a-col> -->
- </a-row>
- <a-row type="flex" v-if="item.isDanwei">
- <a-col :span="12">
- 协议单位:{{ agreementUnitData.customerName }}
- </a-col>
- <a-col :span="12">
- 签约开始日期:{{ danwei.signTime }}
- </a-col>
- <a-col :span="12">
- 签约结束日期: {{ danwei.effective }}</a-col
- >
- <a-col :span="12">
- 可用额度:{{ agreementUnitData.balance || 0 }}
- </a-col>
- </a-row>
- </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>
- <a-col :span="24" v-if="model.money < 0">
- <a-table :columns="columns" :data-source="feeList" bordered>
- <template slot="payType" slot-scope="text, record, index">
- {{ getPayTypeText(text) }}
- </template>
- <template slot="subjectType" slot-scope="text, record, index">
- {{ getSubjectTypeText(text,record) }}
- </template>
- <template slot="roomId" slot-scope="text, record, index">
- {{ getRoomName(text) }}
- </template>
- <template slot="payType" slot-scope="text, record, index">
- <a-select style="width: 100px" v-model="record.payType">
- <a-select-option v-for="(item, key) in payTypeList" :key="key" :value="item.id" :disabled="item.disable">{{ item.name }}</a-select-option>
- </a-select>
- </template>
- <template slot="prerefund" slot-scope="text, record, index">
- <a-input-number :max="record.money - record.returnMoney" v-model="record.prerefund"></a-input-number>
- </template>
- </a-table>
- </a-col>
- <a-col :span="24" style="text-align: end">
- <a-checkbox default-checked>打印结账单</a-checkbox>
- <a-checkbox default-checked>打印发票二维码</a-checkbox>
- </a-col>
- </a-row>
- </a-form-model>
- </j-form-container>
- </a-spin>
- </template>
- <script>
- import { httpAction, getAction,postAction } from '@/api/manage'
- import { validateDuplicateValue } from '@/utils/util'
- import moment from 'moment/moment'
- export default {
- name: 'PayOrRefund',
- components: {},
- props: {
- // 表单禁用
- disabled: {
- type: Boolean,
- default: false,
- required: false
- },
- showYinshou: {
- type: Boolean,
- default: true,
- required: false
- }
- },
- data() {
- return {
- feeList: [],
- isRefund: false,
- model: {
- coupon: false,
- discount: 1,
- couponCard: false,
- couponType: 1,
- couponFirstAmount: 0,
- billAmount: 0,
- selectedFeeIds: []
- },
- labelCol: {
- xs: { span: 24 },
- sm: { span: 5 }
- },
- wrapperCol: {
- xs: { span: 24 },
- sm: { span: 16 }
- },
- confirmLoading: false,
- validatorRules: {
- mobile: [
- {
- required: true,
- pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
- message: '请输入手机号!'
- }
- ],
- cardNo: [{ required: true, message: '请输入会员卡号!' }],
- gradeId: [{ required: true, message: '请输入等级类型!' }],
- payType: [{ required: true, message: '请输入付款类型!' }],
- paymentMethod: [{ required: true, message: '请输入付款方式!' }],
- customerName: [{ required: true, message: '请输入会员姓名!' }],
- sex: [{ required: true, message: '请输入性别!' }],
- certificateType: [{ required: true, message: '请输入证件类型!' }],
- validity: [{ required: true, message: '请输入有效期!' }]
- },
- url: {
- add: '/business/busRoomBookingOrders/booking-to-live',
- edit: '/business/busMemberCard/edit',
- queryById: '/business/busMemberCard/queryById'
- },
- gradeList: [],
- paymentMethodList: [],
- staffList: [],
- customerList: [],
- oldcustomerList: [],
- payTypeList: [],
- memberCard: {},
- danwei: {},
- isVipMemmber: false,
- isDanwei: false,
- payList: [],
- memeberCouponList: [],
- agreementUnitData: {},
- copyRealityAmount: '', // 原本值
- allFeeMoney: 0,
- allReturnFee: 0,
- columns: [
- {
- title: '收款时间',
- dataIndex: 'createTime',
- width: '25%',
- },
- {
- title: '收款金额(元)',
- dataIndex: 'id',
- width: '15%',
- customRender: function (text, record) {
- return record.money
- }
- },
- {
- title: '退款方式',
- dataIndex: 'payType',
- // width: '40%',
- scopedSlots: { customRender: 'payType' }
- },
- {
- title: '退款金额(元)',
- dataIndex: 'prerefund',
- scopedSlots: { customRender: 'prerefund' }
- },
- {
- title: '已退金额(元)',
- dataIndex: 'returnMoney',
- },
- ],
- // [
- // {
- // title: '房间号',
- // dataIndex: 'roomName',
- // width: 80,
- // align: 'center',
- // // scopedSlots: { customRender: 'roomId' }
- // },
- // {
- // title: '支付类型',
- // dataIndex: 'payType',
- // align: 'center',
- // width: 80,
- // scopedSlots: { customRender: 'payType' }
- // },
- // {
- // title: '费项',
- // dataIndex: 'subjectType',
- // align: 'center',
- // width: 100,
- // scopedSlots: { customRender: 'subjectType' }
- // },
- // {
- // title: '入账日期',
- // dataIndex: 'dayTime',
- // align: 'center',
- // width: 110,
- // customRender: function (text, record) {
- // return record.createTime.substring(0, 10)
- // }
- // },
- // {
- // title: '支付金额',
- // dataIndex: 'id',
- // align: 'center',
- // width: 90,
- // customRender: function (text, record) {
- // return record.money
- // }
- // },
- // {
- // title: '退款方式',
- // // dataIndex: 'id',
- // align: 'center',
- // width: 130,
- // scopedSlots: { customRender: 'refundType' }
- // },
- // {
- // title: '本次退款',
- // dataIndex: 'prerefund',
- // align: 'center',
- // scopedSlots: { customRender: 'prerefund' }
- // },
- // {
- // title: '已退款',
- // align: 'center',
- // dataIndex: 'returnMoney',
- // }
- // ]
- }
- },
- computed: {
- formDisabled() {
- return this.disabled
- },
- sumAmount() {
- var sum = this.payList.reduce(function (total, item) {
- return total + item.money
- }, 0)
- return sum
- },
- couponAmount() {
- var sum = 0
- if (this.model.coupon) {
- if (this.model.preferentialType == 1) {
- sum = Math.floor(this.model.consumption)
- } else if (this.model.preferentialType == 2) {
- sum = this.model.consumption - (this.model.couponFirstAmount || 0)
- } else if (this.model.preferentialType == 3) {
- sum = parseFloat(
- ((this.model.consumption * this.model.discount) / 10).toFixed(2)
- )
- }
- } else {
- sum = this.model.consumption
- }
- return sum
- },
- realityAmount() {
- // 实际要收的钱,为负表示要退的钱
- let relMoney = this.couponAmount.toFixed(2) - this.model.collection
- this.isRefund = relMoney < 0
- let result = 0
- if (this.model.couponCard) {
- var find = this.memeberCouponList.find(
- (t) => t.id == this.model.couponId
- )
- if (find) {
- this.isRefund = relMoney - find.cost < 0
- result = Math.abs(relMoney - find.cost)
- }
- }
- result = Math.abs(relMoney)
- if (this.payList && this.payList.length > 0 && this.copyRealityAmount != result) {
- this.payList = [this.payList[0]]
- this.payList[0].money = result
- }
- this.copyRealityAmount = result
- return result
- }
- },
- created() {
- var _info = JSON.parse(localStorage.getItem('storeInfo'))
- if (_info) {
- this.model.hotelId = _info.id
- }
- // 备份model原始值
- this.modelDefault = JSON.parse(JSON.stringify(this.model))
- // this.refundRequest()
- // getAction("/business/busRoomPayType/list", {
- // pageSize: 99999,
- // pageNo: 1,
- // }).then((res) => {
- // if (res.success) {
- // this.payTypeList = res.result.records;
- // }
- // });
- },
- methods: {
- getbusRoomPayType() {
- getAction('/business/busRoomPayType/list', {
- pageSize: 99999,
- pageNo: 1
- }).then((res) => {
- console.log(res);
- if (res.success) {
- this.payTypeList = res.result.records
- if (this.payTypeList && this.payTypeList.length > 0) {
- if (
- !this.model.vipCustomerId ||
- this.model.vipCustomerId.length == 0
- ) {
- var index = this.payTypeList.findIndex((t) =>
- t.name.includes('会员')
- )
- if (index >= 0) {
- this.payTypeList[index].delFlag = 99
- }
- }
- if (
- !this.model.contractTeamId ||
- this.model.contractTeamId.length == 0 ||
- !this.model.contractTeamProtocolId ||
- this.model.contractTeamProtocolId.length == 0
- ) {
- var index = this.payTypeList.findIndex((t) =>
- t.name.includes('单位')
- )
- if (index >= 0) {
- this.payTypeList[index].delFlag = 99
- }
- }
- this.$set(this.model, 'payType', this.payTypeList[0].id)
- this.payList = [
- {
- money: this.realityAmount,
- payType: this.payTypeList[0].id,
- isVipMemmber: false,
- isDanwei: false
- }
- ]
- }
- }
- })
- },
- puls() {
- var sum = this.payList.reduce(function (total, item) {
- return total + item.money
- }, 0)
- var money = this.realityAmount - sum
- if (money < 0) {
- money = 0
- }
- this.payList.push({
- money: money,
- payType: this.payTypeList[0].id,
- isVipMemmber: false,
- isDanwei: false
- })
- },
- remove(index) {
- this.payList.splice(index, 1)
- },
- onChange(e, value) {
- console.log('value', value)
- console.log('e', e)
- var find = this.payTypeList.find((t) => t.id == value.payType)
- value.isVipMemmber = find && find.name.includes('会员')
- value.isDanwei = find && find.name.includes('单位')
- },
- handleSearch(value) {
- let result
- if (!value) {
- result = this.oldcustomerList
- } else {
- result = this.oldcustomerList.filter((t) => t.name.includes(value))
- }
- this.customerList = result
- },
- handleSelectMember(e) {
- var find = this.customerList.find((t) => t.id === e)
- this.model.phone = find.phone
- this.model.customerName = find.name
- this.model.customerId = find.id
- },
- getMemeberCouponList() {
- getAction('/business/busMarketCouponsCashUsed/memeberCouponList', {
- pageNo: 1,
- pageSize: 99,
- conditions: 900,
- mobile: this.model.vipCustomerId
- }).then((res) => {
- if (res.success) {
- this.memeberCouponList = res.result.records
- }
- })
- },
- add(livingOrderId, roomId) {
- this.modelDefault.livingOrderId = livingOrderId
- this.modelDefault.roomId = roomId
- this.edit(this.modelDefault)
- },
- edit(record) {
- // console.log(record);
- this.model = Object.assign({}, record)
- // console.log(this.model);
- this.isRefund = this.model.isRefund
- // if (record.preferentialMoney !== 0 && record.preferentialMoney !== null) {
- // console.log(record.preferentialMoney)
- // debugger
- // this.model.coupon = true
- // this.model.preferentialType = 2
- // this.model.couponFirstAmount = record.preferentialMoney
- // }
- this.getbusRoomPayType()
- this.refundRequest()
- if (this.model.vipCustomerId) {
- this.getMemeberCouponList()
- }
- if (this.model.vipCustomerId) {
- getAction('/business/busMemberCard/list', {
- id: this.model.vipCustomerId
- }).then((res) => {
- if (res.success) {
- if (res.result.records && res.result.records.length > 0) {
- this.memberCard = res.result.records[0]
- }
- }
- })
- }
- if (this.model.contractTeamId && this.model.contractTeamProtocolId) {
- getAction('/business/busMarketAgreementUnit/list', {
- id: this.model.contractTeamId
- }).then((res) => {
- if (res.success) {
- var list = res.result.records
- if (list.length > 0) {
- this.agreementUnitData = list[0]
- getAction('/business/busMarketAgreementCustomer/list', {
- agreementId: this.model.contractTeamId
- }).then((res2) => {
- if (res2.success) {
- var list2 = res2.result.records
- if (list2 && list2.length > 0) {
- this.danwei = list2.find(
- (t) => t.id == this.model.contractTeamProtocolId
- )
- }
- }
- })
- }
- }
- })
- }
- this.visible = true
- },
- submitForm() {
- const that = this
- // 触发表单验证
- this.$refs.form.validate((valid) => {
- if (valid) {
- if (this.model.couponFirstAmount > this.model.consumption.toFixed(2)) {
- this.model.couponFirstAmount = 0
- this.$message.warning('优惠金额不能大于消费')
- return
- }
- if (this.realityAmount != this.sumAmount) {
- that.$message.warning('实收金额和实收合计必须相等')
- return
- }
- console.log(this.model);
- // return
- var obj = {}
- var fees = []
- if (this.model.coupon) {
- fees.push({
- feeType: this.model.feeType,
- preferentialType: this.model.preferentialType,
- money: this.couponAmount.toFixed(2) - this.model.consumption.toFixed(2),
- custorerOrderRemark: '优惠金额',
- isPreferential: true
- })
- }
- console.log(fees, 'fees')
- if (this.model.couponCard && this.model.couponId) {
- var find = this.memeberCouponList.find(
- (t) => t.id === this.model.couponId
- )
- if (find) {
- fees.push({
- feeType: this.model.feeType,
- money: -find.cost.toFixed(2),
- custorerOrderRemark: '优惠券',
- isPreferential: true,
- couponscashId: find.id
- })
- }
- }
- // this.payList.forEach((item) => {
- // let remark = '结账收款'
- // let money = item.money.toFixed(2)
- // if (this.isRefund) {
- // remark = '结账退款'
- // money = -money
- // }
- // fees.push({
- // feeType: this.model.feeType,
- // money,
- // payType: item.payType,
- // custorerOrderRemark: remark,
- // isPreferential: this.model.isPreferential,
- // preferentialMoney: this.model.preferentialMoney
- // })
- // })
- if (this.isRefund) {
- this.feeList.forEach((item) => {
- let remark =
- // let money = -money
- fees.push({
- feeType: this.model.feeType,
- money: -item.prerefund,
- payType: item.payType,
- custorerOrderRemark: '结账退款',
- isPreferential: this.model.isPreferential,
- preferentialMoney: this.model.preferentialMoney
- })
- })
- } else {
- this.payList.forEach((item) => {
- let remark = '结账收款'
- let money = item.money.toFixed(2)
- fees.push({
- feeType: this.model.feeType,
- money,
- payType: item.payType,
- custorerOrderRemark: remark,
- isPreferential: this.model.isPreferential,
- preferentialMoney: this.model.preferentialMoney
- })
- })
- }
-
- that.confirmLoading = true
- var url =
- '/business/busRoomBookingOrders/settle-checkout?bookingOrderId=' +
- this.model.bookingOrderId
- if (this.model.livingOrderId) {
- url =
- '/business/busRoomBookingOrders/living-settle-checkout?livingOrderId=' +
- this.model.livingOrderId
- }
- if (
- this.model.selectedFeeIds &&
- this.model.selectedFeeIds.length > 0
- ) {
- url = '/business/busRoomBookingOrders/partial-settle'
- // 部分
- obj = {
- fees: fees,
- livingOrderId: this.model.livingOrderId,
- selectedFeeIds: this.model.selectedFeeIds
- }
- }
- httpAction(
- url,
- this.model.selectedFeeIds && this.model.selectedFeeIds.length > 0
- ? obj
- : fees,
- 'post'
- )
- .then((res) => {
- if (res.success) {
- that.$message.success('结账成功')
- that.$emit('ok')
- } else {
- that.$message.warning(res.message)
- }
- })
- .finally(() => {
- that.confirmLoading = false
- })
- }
- })
- },
- // 退款列表请求数据
- refundRequest() {
- let returnFeeList = []
- // let feeList = []
- console.log(this.model);
- let livingOrderIds = this.model.livingOrderId
- 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)
- }
- })
- ])
-
- 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)
- // }
- // })
- // })
-
- // this.feeList.forEach(item => {
-
- // })
- })
- }
-
- },
- }
- }
- </script>
- <style scoped>
- .dynamic-delete-button {
- cursor: pointer;
- position: relative;
- /* top: 4px; */
- margin-left: 5px;
- font-size: 18px;
- color: #1890ff;
- transition: all 0.3s;
- }
- .dynamic-delete-button:hover {
- color: #777;
- }
- .dynamic-delete-button[disabled] {
- cursor: not-allowed;
- opacity: 0.5;
- }
- .refund_style {
- font-size: 32px;
- color: red;
- text-align: center;
- padding-top: 7%;
- /* margin: 0 auto; */
- /* display: inline-block; */
- /* margin-top: 60px; */
-
- }
- .crad_style {
- display: flex;
- background-color: #fcfcfc;
- width: 100%;
- border-radius: 5%;
- }
- .ant-col-16 {
- border-left: 2px solid #fc9424;
- }
- .ant-form-item {
- margin-bottom: 16px;
- }
- .presentation_style {
- /* font-size: ; */
- color: #fc9424;
- padding-left: 25px;
- padding-bottom: 5px;
- border-bottom: 1px solid #fc9424;
- padding-top: 10px;
- }
- .presentation_style_two {
- /* padding-left: 25px; */
- /* padding-bottom: 5px; */
- border-top: 1px solid #fc9424;
- margin-top: 10px;
- padding: 20px 0px 5px 25px;
- }
- .receipt_style {
- margin-top: 30px;
- }
- .settle_style {
- color: red !important;
- }
- </style>
|