|
|
@@ -2,160 +2,213 @@
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
<j-form-container :disabled="formDisabled">
|
|
|
<a-form-model
|
|
|
- ref="form"
|
|
|
- :model="model"
|
|
|
- :rules="validatorRules"
|
|
|
- slot="detail"
|
|
|
+ ref="form"
|
|
|
+ :model="model"
|
|
|
+ :rules="validatorRules"
|
|
|
+ slot="detail"
|
|
|
>
|
|
|
<a-row>
|
|
|
<a-col :span="24">
|
|
|
<a-form-model-item
|
|
|
- label="押金"
|
|
|
- :labelCol="labelCol"
|
|
|
- :wrapperCol="wrapperCol"
|
|
|
- prop="deposit"
|
|
|
+ label="收款金额"
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
>
|
|
|
- <a-input
|
|
|
- style="width: 100px"
|
|
|
- disabled
|
|
|
- v-model="model.deposit"
|
|
|
- placeholder="押金应退"
|
|
|
- ></a-input
|
|
|
- >元
|
|
|
- <a-select
|
|
|
- v-model="model.payType"
|
|
|
- style="width: 200px"
|
|
|
- placeholder="支付类型"
|
|
|
- >
|
|
|
- <a-select-option
|
|
|
- :value="item.id"
|
|
|
- v-for="item in payTypeList"
|
|
|
- :key="item.id"
|
|
|
- :disabled="item.delFlag == 99"
|
|
|
- >{{ item.name }}</a-select-option
|
|
|
- >
|
|
|
- </a-select>
|
|
|
+ {{ model.collection.toFixed(2) }}元
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="24">
|
|
|
<a-form-model-item
|
|
|
- label="预付款"
|
|
|
- :labelCol="labelCol"
|
|
|
- :wrapperCol="wrapperCol"
|
|
|
- prop="billRefund"
|
|
|
+ label="消费金额"
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
>
|
|
|
- <a-input
|
|
|
- style="width: 100px"
|
|
|
- disabled
|
|
|
- v-model="model.billRefund"
|
|
|
- placeholder="请输入结账应退"
|
|
|
- ></a-input
|
|
|
- >元
|
|
|
- <a-select
|
|
|
- v-model="model.payType"
|
|
|
- style="width: 200px"
|
|
|
- placeholder="支付类型"
|
|
|
- >
|
|
|
- <a-select-option
|
|
|
- :value="item.id"
|
|
|
- v-for="item in payTypeList"
|
|
|
- :key="item.id"
|
|
|
- :disabled="item.delFlag == 99"
|
|
|
- >{{ item.name }}</a-select-option
|
|
|
- >
|
|
|
- </a-select>
|
|
|
+ {{ model.consumption.toFixed(2) }}元
|
|
|
+ <a-switch v-model="model.coupon" />优惠
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
- <a-col :span="24">
|
|
|
- <a-form-model-item
|
|
|
- label="房费"
|
|
|
+
|
|
|
+ <template v-if="model.coupon">
|
|
|
+ <a-col :span="24">
|
|
|
+ <a-form-model-item
|
|
|
+ label="优惠方式"
|
|
|
:labelCol="labelCol"
|
|
|
:wrapperCol="wrapperCol"
|
|
|
- prop="roomFee"
|
|
|
- >
|
|
|
- <a-input
|
|
|
+ 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" v-if="model.preferentialType == 2">
|
|
|
+ <a-form-model-item
|
|
|
+ label="优惠金额"
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
+ prop="couponFirstAmount"
|
|
|
+ >
|
|
|
+ <a-input-number
|
|
|
style="width: 100px"
|
|
|
- disabled
|
|
|
- v-model="model.roomFee"
|
|
|
- placeholder="请输入房费应退"
|
|
|
- ></a-input
|
|
|
- >元
|
|
|
- <a-select
|
|
|
- v-model="model.payType"
|
|
|
- style="width: 200px"
|
|
|
- placeholder="支付类型"
|
|
|
+ :min="0"
|
|
|
+ v-model="model.couponFirstAmount"
|
|
|
+ placeholder="请输入优惠金额"
|
|
|
+ ></a-input-number
|
|
|
+ >元
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="24">
|
|
|
+ <a-form-model-item
|
|
|
+ label="惠后金额"
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
>
|
|
|
- <a-select-option
|
|
|
- :value="item.id"
|
|
|
- v-for="item in payTypeList"
|
|
|
- :key="item.id"
|
|
|
- :disabled="item.delFlag == 99"
|
|
|
- >{{ item.name }}</a-select-option
|
|
|
+ {{ couponAmount.toFixed(2) }}元
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="24">
|
|
|
+ <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>
|
|
|
+ <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-col>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <a-col :span="24" v-show="showYinshou">
|
|
|
+ <a-form-model-item
|
|
|
+ :label=""结账应" + (model.money < 0 ? "退" : "收")"
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
+ prop="money"
|
|
|
+ >
|
|
|
+ {{ Math.abs(model.money.toFixed(2)) }}元
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="24">
|
|
|
<a-form-model-item
|
|
|
- label="合计消费"
|
|
|
- :labelCol="labelCol"
|
|
|
- :wrapperCol="wrapperCol"
|
|
|
- prop="roomFee"
|
|
|
+ :label=""实" + (this.isRefund ? "退" : "收") + "金额""
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
>
|
|
|
- <a-input
|
|
|
- style="width: 100px"
|
|
|
- disabled
|
|
|
- v-model="model.roomFee"
|
|
|
- placeholder="合计消费"
|
|
|
- ></a-input
|
|
|
- >元
|
|
|
+ {{ realityAmount.toFixed(2) }}元
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
-
|
|
|
<a-col :span="24">
|
|
|
<a-form-model-item
|
|
|
- label="应退金额"
|
|
|
- :labelCol="labelCol"
|
|
|
- :wrapperCol="wrapperCol"
|
|
|
- prop="money"
|
|
|
+ :label="(this.isRefund ? "退" : "收") + "款金额""
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
>
|
|
|
- <a-input
|
|
|
- style="width: 100px"
|
|
|
- disabled
|
|
|
- v-model="model.money"
|
|
|
- placeholder="请输入应退金额"
|
|
|
- ></a-input>
|
|
|
+ <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="24">
|
|
|
<a-form-model-item
|
|
|
- label="实退金额"
|
|
|
- :labelCol="labelCol"
|
|
|
- :wrapperCol="wrapperCol"
|
|
|
- prop="billRefund"
|
|
|
+ :label=""实" + (this.isRefund ? "退" : "收") + "合计""
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
>
|
|
|
- <a-input
|
|
|
- style="width: 100px"
|
|
|
- disabled
|
|
|
- v-model="model.billRefund"
|
|
|
- placeholder="请输入实退金额"
|
|
|
- ></a-input
|
|
|
- >元
|
|
|
- <a-select
|
|
|
- v-model="model.payType"
|
|
|
- style="width: 200px"
|
|
|
- placeholder="支付类型"
|
|
|
- >
|
|
|
- <a-select-option
|
|
|
- :value="item.id"
|
|
|
- v-for="item in payTypeList"
|
|
|
- :key="item.id"
|
|
|
- :disabled="item.delFlag == 99"
|
|
|
- >{{ item.name }}</a-select-option
|
|
|
- >
|
|
|
- </a-select>
|
|
|
+ {{ Math.abs(sumAmount.toFixed(2)) }}元
|
|
|
</a-form-model-item>
|
|
|
</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>
|
|
|
@@ -163,36 +216,44 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { httpAction, getAction } from "@/api/manage";
|
|
|
+import { httpAction, getAction } from '@/api/manage'
|
|
|
+import { validateDuplicateValue } from '@/utils/util'
|
|
|
|
|
|
export default {
|
|
|
- name: "PayOrRefund",
|
|
|
+ name: 'PayOrRefund',
|
|
|
components: {},
|
|
|
props: {
|
|
|
- //表单禁用
|
|
|
+ // 表单禁用
|
|
|
disabled: {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
- required: false,
|
|
|
+ required: false
|
|
|
},
|
|
|
+ showYinshou: {
|
|
|
+ type: Boolean,
|
|
|
+ default: true,
|
|
|
+ required: false
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ isRefund: false,
|
|
|
model: {
|
|
|
- payType: "",
|
|
|
- payType2: "",
|
|
|
- livingOrderId: "",
|
|
|
- certType: 1,
|
|
|
- gender: 1,
|
|
|
- bookingOrderId: "",
|
|
|
+ coupon: false,
|
|
|
+ discount: 1,
|
|
|
+ couponCard: false,
|
|
|
+ couponType: 1,
|
|
|
+ couponFirstAmount: 0,
|
|
|
+ billAmount: 0,
|
|
|
+ selectedFeeIds: []
|
|
|
},
|
|
|
labelCol: {
|
|
|
xs: { span: 24 },
|
|
|
- sm: { span: 5 },
|
|
|
+ sm: { span: 5 }
|
|
|
},
|
|
|
wrapperCol: {
|
|
|
xs: { span: 24 },
|
|
|
- sm: { span: 16 },
|
|
|
+ sm: { span: 16 }
|
|
|
},
|
|
|
confirmLoading: false,
|
|
|
validatorRules: {
|
|
|
@@ -200,22 +261,22 @@ export default {
|
|
|
{
|
|
|
required: true,
|
|
|
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
|
|
- message: "请输入手机号!",
|
|
|
- },
|
|
|
+ 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: "请输入有效期!" }],
|
|
|
+ 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",
|
|
|
+ add: '/business/busRoomBookingOrders/booking-to-live',
|
|
|
+ edit: '/business/busMemberCard/edit',
|
|
|
+ queryById: '/business/busMemberCard/queryById'
|
|
|
},
|
|
|
gradeList: [],
|
|
|
paymentMethodList: [],
|
|
|
@@ -223,40 +284,93 @@ export default {
|
|
|
customerList: [],
|
|
|
oldcustomerList: [],
|
|
|
payTypeList: [],
|
|
|
- };
|
|
|
+ memberCard: {},
|
|
|
+ danwei: {},
|
|
|
+ isVipMemmber: false,
|
|
|
+ isDanwei: false,
|
|
|
+ payList: [],
|
|
|
+ memeberCouponList: [],
|
|
|
+ agreementUnitData: {}
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
formDisabled() {
|
|
|
- return this.disabled;
|
|
|
+ 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
|
|
|
+ debugger
|
|
|
+ }
|
|
|
+ return sum
|
|
|
},
|
|
|
+ realityAmount() {
|
|
|
+ // 实际要收的钱,为负表示要退的钱
|
|
|
+ let relMoney = this.couponAmount.toFixed(2) - this.model.collection
|
|
|
+ this.isRefund = relMoney < 0
|
|
|
+ if (this.model.couponCard) {
|
|
|
+ var find = this.memeberCouponList.find(
|
|
|
+ (t) => t.id == this.model.couponId
|
|
|
+ )
|
|
|
+ if (find) {
|
|
|
+ this.isRefund = relMoney - find.cost < 0
|
|
|
+ return Math.abs(relMoney - find.cost)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Math.abs(relMoney)
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
- var _info = JSON.parse(localStorage.getItem("storeInfo"));
|
|
|
+ var _info = JSON.parse(localStorage.getItem('storeInfo'))
|
|
|
if (_info) {
|
|
|
- this.model.hotelId = _info.id;
|
|
|
+ this.model.hotelId = _info.id
|
|
|
}
|
|
|
- //备份model原始值
|
|
|
- this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
|
|
- this.getbusCustomer();
|
|
|
+ // 备份model原始值
|
|
|
+ this.modelDefault = JSON.parse(JSON.stringify(this.model))
|
|
|
+ // getAction("/business/busRoomPayType/list", {
|
|
|
+ // pageSize: 99999,
|
|
|
+ // pageNo: 1,
|
|
|
+ // }).then((res) => {
|
|
|
+ // if (res.success) {
|
|
|
+ // this.payTypeList = res.result.records;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
},
|
|
|
methods: {
|
|
|
getbusRoomPayType() {
|
|
|
- getAction("/business/busRoomPayType/list", {
|
|
|
+ getAction('/business/busRoomPayType/list', {
|
|
|
pageSize: 99999,
|
|
|
- pageNo: 1,
|
|
|
+ pageNo: 1
|
|
|
}).then((res) => {
|
|
|
if (res.success) {
|
|
|
- this.payTypeList = res.result.records;
|
|
|
+ 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("会员")
|
|
|
- );
|
|
|
+ t.name.includes('会员')
|
|
|
+ )
|
|
|
if (index >= 0) {
|
|
|
- this.payTypeList[index].delFlag = 99;
|
|
|
+ this.payTypeList[index].delFlag = 99
|
|
|
}
|
|
|
}
|
|
|
if (
|
|
|
@@ -266,89 +380,243 @@ export default {
|
|
|
this.model.contractTeamProtocolId.length == 0
|
|
|
) {
|
|
|
var index = this.payTypeList.findIndex((t) =>
|
|
|
- t.name.includes("单位")
|
|
|
- );
|
|
|
+ t.name.includes('单位')
|
|
|
+ )
|
|
|
if (index >= 0) {
|
|
|
- this.payTypeList[index].delFlag = 99;
|
|
|
+ this.payTypeList[index].delFlag = 99
|
|
|
}
|
|
|
}
|
|
|
- this.$set(this.model, "payType", this.payTypeList[0].id);
|
|
|
+ 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;
|
|
|
+ let result
|
|
|
if (!value) {
|
|
|
- result = this.oldcustomerList;
|
|
|
+ result = this.oldcustomerList
|
|
|
} else {
|
|
|
- result = this.oldcustomerList.filter((t) => t.name.includes(value));
|
|
|
+ result = this.oldcustomerList.filter((t) => t.name.includes(value))
|
|
|
}
|
|
|
- this.customerList = result;
|
|
|
+ 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;
|
|
|
+ var find = this.customerList.find((t) => t.id === e)
|
|
|
+ this.model.phone = find.phone
|
|
|
+ this.model.customerName = find.name
|
|
|
+ this.model.customerId = find.id
|
|
|
},
|
|
|
- getbusCustomer() {
|
|
|
- getAction("/bus/busCustomer/list", {}).then((res) => {
|
|
|
+ getMemeberCouponList() {
|
|
|
+ getAction('/business/busMarketCouponsCashUsed/memeberCouponList', {
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 99,
|
|
|
+ conditions: 900,
|
|
|
+ mobile: this.model.vipCustomerId
|
|
|
+ }).then((res) => {
|
|
|
if (res.success) {
|
|
|
- this.customerList = res.result.records;
|
|
|
- this.oldcustomerList = JSON.parse(JSON.stringify(this.customerList));
|
|
|
+ this.memeberCouponList = res.result.records
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
add(livingOrderId, roomId) {
|
|
|
- this.modelDefault.livingOrderId = livingOrderId;
|
|
|
- this.modelDefault.roomId = roomId;
|
|
|
- this.edit(this.modelDefault);
|
|
|
+ this.modelDefault.livingOrderId = livingOrderId
|
|
|
+ this.modelDefault.roomId = roomId
|
|
|
+ this.edit(this.modelDefault)
|
|
|
},
|
|
|
edit(record) {
|
|
|
- this.model = Object.assign({}, record);
|
|
|
-
|
|
|
- this.getbusRoomPayType();
|
|
|
- this.visible = true;
|
|
|
+ this.model = Object.assign({}, record)
|
|
|
+ this.isRefund = this.model.isRefund
|
|
|
+ if (record.preferentialMoney !== 0 && record.preferentialMoney !== null) {
|
|
|
+ this.model.coupon = true
|
|
|
+ this.model.preferentialType = 2
|
|
|
+ this.model.couponFirstAmount = record.preferentialMoney
|
|
|
+ }
|
|
|
+ this.getbusRoomPayType()
|
|
|
+ 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;
|
|
|
+ const that = this
|
|
|
// 触发表单验证
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- that.confirmLoading = true;
|
|
|
- var fees = [];
|
|
|
- fees.push({
|
|
|
- feeType: this.model.feeType,
|
|
|
- money: this.model.money,
|
|
|
- payType: this.model.payType,
|
|
|
- custorerOrderRemark: "结账退款",
|
|
|
- isPreferential: false,
|
|
|
- livingOrderId: this.model.livingOrderId,
|
|
|
- });
|
|
|
+ if (this.realityAmount != this.sumAmount) {
|
|
|
+ that.$message.warning('实收金额和实收合计必须相等')
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ that.confirmLoading = true
|
|
|
var url =
|
|
|
- "/business/busRoomBookingOrders/settle-checkout?bookingOrderId=" +
|
|
|
- this.model.bookingOrderId;
|
|
|
+ '/business/busRoomBookingOrders/settle-checkout?bookingOrderId=' +
|
|
|
+ this.model.bookingOrderId
|
|
|
if (this.model.livingOrderId) {
|
|
|
url =
|
|
|
- "/business/busRoomBookingOrders/living-settle-checkout?livingOrderId=" +
|
|
|
- this.model.livingOrderId;
|
|
|
+ '/business/busRoomBookingOrders/living-settle-checkout?livingOrderId=' +
|
|
|
+ this.model.livingOrderId
|
|
|
}
|
|
|
- httpAction(url, fees, "post")
|
|
|
+ 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");
|
|
|
+ that.$message.success('结账成功')
|
|
|
+ that.$emit('ok')
|
|
|
} else {
|
|
|
- that.$message.warning(res.message);
|
|
|
+ that.$message.warning(res.message)
|
|
|
}
|
|
|
})
|
|
|
.finally(() => {
|
|
|
- that.confirmLoading = false;
|
|
|
- });
|
|
|
+ that.confirmLoading = false
|
|
|
+ })
|
|
|
}
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</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;
|
|
|
+}
|
|
|
+</style>
|