|
|
@@ -15,12 +15,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="患者姓名" align="center" prop="patientName" />
|
|
|
- <el-table-column label="身份证号" align="center" prop="idCard" width="170px"/>
|
|
|
- <el-table-column label="出生年月" align="center" prop="birthday" width="180">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <el-table-column label="身份证号" align="center" prop="idCard" width="170px" />
|
|
|
<el-table-column label="性别" align="center" prop="sex">
|
|
|
<template slot-scope="scope">
|
|
|
<dict-tag :options="sexOptions" :value="scope.row.sex"/>
|
|
|
@@ -31,13 +26,18 @@
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="病情描述" prop="illnessDesc">
|
|
|
- <el-input type="textarea" rows="4" v-model="form.illnessDesc" placeholder="请输入病情描述" />
|
|
|
+ <el-input type="textarea" rows="2" v-model="form.illnessDesc" placeholder="请输入病情描述" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="订单类型" prop="orderType">
|
|
|
- <el-radio-group v-model="form.orderType">
|
|
|
- <el-radio label="1">图文问诊</el-radio>
|
|
|
- <el-radio label="2">视频问诊</el-radio>
|
|
|
- <el-radio label="3">健康咨询</el-radio>
|
|
|
+ <el-radio-group v-model="form.orderType" @change="handleOrderTypeChange">
|
|
|
+ <el-radio :label="1">图文</el-radio>
|
|
|
+ <el-radio :label="2">语音</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="问诊类型" prop="inquiryType">
|
|
|
+ <el-radio-group v-model="form.inquiryType" @change="handleInquiryTypeChange">
|
|
|
+ <el-radio :label="1">专家</el-radio>
|
|
|
+ <el-radio :label="2">极速</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="医生信息" prop="doctorId">
|
|
|
@@ -71,6 +71,15 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="支付金额" prop="payMoney">
|
|
|
+ <el-input-number v-model="form.payMoney" :precision="2" :min="0" placeholder="支付金额" style="width: 300px;" @change="handlePayMoneyChange" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="应付金额" prop="payableAmount">
|
|
|
+ <el-input-number v-model="form.payableAmount" :precision="2" :min="0" placeholder="应付金额" style="width: 300px;" @change="handlePayableAmountChange" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="form.couponId" label="优惠金额">
|
|
|
+ <span>{{ formatMoney(discountMoney) }}</span>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="订单备注" prop="companyUserRemark">
|
|
|
<el-input type="textarea" rows="2" v-model="form.companyUserRemark" placeholder="" />
|
|
|
</el-form-item>
|
|
|
@@ -85,7 +94,7 @@
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm" :loading="submitLoading">分 享</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm" :loading="submitLoading || amountLoading">分 享</el-button>
|
|
|
<el-button @click="handleClose">取 消</el-button>
|
|
|
</div>
|
|
|
|
|
|
@@ -97,7 +106,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { listPatient } from "@/api/store/patient";
|
|
|
-import { shareInquiryOrderLink } from "@/api/store/inquiryOrder";
|
|
|
+import { shareInquiryOrderLink, computeInquiryOrderAmount } from "@/api/store/inquiryOrder";
|
|
|
import { getDoctorList } from "@/api/his/doctor";
|
|
|
import { getUserCoupon } from "@/api/store/coupon";
|
|
|
import addPatient from "@/views/store/components/addPatient";
|
|
|
@@ -115,12 +124,19 @@ export default {
|
|
|
return {
|
|
|
dialogVisible: false,
|
|
|
submitLoading: false,
|
|
|
+ amountLoading: false,
|
|
|
shareLink: null,
|
|
|
+ discountMoney: 0,
|
|
|
+ originalPayableAmount: null,
|
|
|
+ amountCalculated: false,
|
|
|
form: {
|
|
|
patientId: null,
|
|
|
illnessDesc: null,
|
|
|
- orderType: '1',
|
|
|
+ orderType: 1,
|
|
|
+ inquiryType: 1,
|
|
|
doctorId: null,
|
|
|
+ payMoney: null,
|
|
|
+ payableAmount: null,
|
|
|
companyUserRemark: null,
|
|
|
couponId: null
|
|
|
},
|
|
|
@@ -128,6 +144,7 @@ export default {
|
|
|
patientId: [{ required: true, message: "请选择就诊人", trigger: "change" }],
|
|
|
illnessDesc: [{ required: true, message: "请输入病情描述", trigger: "blur" }],
|
|
|
orderType: [{ required: true, message: "请选择订单类型", trigger: "change" }],
|
|
|
+ inquiryType: [{ required: true, message: "请选择问诊类型", trigger: "change" }],
|
|
|
doctorId: [{ required: true, message: "请选择医生", trigger: "change" }]
|
|
|
},
|
|
|
patientList: [],
|
|
|
@@ -162,12 +179,18 @@ export default {
|
|
|
this.form = {
|
|
|
patientId: null,
|
|
|
illnessDesc: null,
|
|
|
- orderType: '1',
|
|
|
+ orderType: 1,
|
|
|
+ inquiryType: 1,
|
|
|
doctorId: null,
|
|
|
+ payMoney: null,
|
|
|
+ payableAmount: null,
|
|
|
companyUserRemark: null,
|
|
|
couponId: null
|
|
|
};
|
|
|
this.selectedDoctor = null;
|
|
|
+ this.discountMoney = 0;
|
|
|
+ this.originalPayableAmount = null;
|
|
|
+ this.amountCalculated = false;
|
|
|
if (this.$refs.form) {
|
|
|
this.$refs.form.resetFields();
|
|
|
}
|
|
|
@@ -195,6 +218,21 @@ export default {
|
|
|
var item = this.doctorList.find(d => d.doctorId === doctorId);
|
|
|
if (item) {
|
|
|
this.selectedDoctor = item;
|
|
|
+ const consultFee = this.getConsultFee(item.priceJson);
|
|
|
+ this.form.payMoney = null;
|
|
|
+ this.form.payableAmount = consultFee;
|
|
|
+ this.originalPayableAmount = consultFee;
|
|
|
+ } else {
|
|
|
+ this.selectedDoctor = null;
|
|
|
+ this.form.payMoney = null;
|
|
|
+ this.form.payableAmount = null;
|
|
|
+ this.originalPayableAmount = null;
|
|
|
+ }
|
|
|
+ this.discountMoney = 0;
|
|
|
+ this.amountCalculated = false;
|
|
|
+ this.shareLink = null;
|
|
|
+ if (this.form.couponId) {
|
|
|
+ this.computeAmount();
|
|
|
}
|
|
|
},
|
|
|
getConsultFee(priceJson) {
|
|
|
@@ -202,13 +240,75 @@ export default {
|
|
|
try {
|
|
|
var priceList = JSON.parse(priceJson);
|
|
|
var item = priceList.find(p => p.type === parseInt(this.form.orderType));
|
|
|
- return item ? item.price : 0;
|
|
|
+ return item ? Number(item.price || 0) : 0;
|
|
|
} catch (e) {
|
|
|
return 0;
|
|
|
}
|
|
|
},
|
|
|
+ handleOrderTypeChange() {
|
|
|
+ if (this.selectedDoctor) {
|
|
|
+ const consultFee = this.getConsultFee(this.selectedDoctor.priceJson);
|
|
|
+ this.form.payableAmount = consultFee;
|
|
|
+ this.originalPayableAmount = consultFee;
|
|
|
+ }
|
|
|
+ this.discountMoney = 0;
|
|
|
+ this.amountCalculated = false;
|
|
|
+ this.shareLink = null;
|
|
|
+ if (this.form.couponId) {
|
|
|
+ this.computeAmount();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleInquiryTypeChange() {
|
|
|
+ this.shareLink = null;
|
|
|
+ },
|
|
|
handleCouponChange(couponId) {
|
|
|
- console.log('Selected coupon:', couponId);
|
|
|
+ this.shareLink = null;
|
|
|
+ this.amountCalculated = false;
|
|
|
+ if (!couponId) {
|
|
|
+ this.discountMoney = 0;
|
|
|
+ if (this.originalPayableAmount !== null && this.originalPayableAmount !== undefined) {
|
|
|
+ this.form.payableAmount = this.originalPayableAmount;
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.computeAmount();
|
|
|
+ },
|
|
|
+ handlePayMoneyChange() {
|
|
|
+ this.shareLink = null;
|
|
|
+ },
|
|
|
+ handlePayableAmountChange() {
|
|
|
+ this.amountCalculated = true;
|
|
|
+ this.shareLink = null;
|
|
|
+ },
|
|
|
+ formatMoney(value) {
|
|
|
+ const money = Number(value || 0);
|
|
|
+ return `¥${money.toFixed(2)}`;
|
|
|
+ },
|
|
|
+ buildAmountData() {
|
|
|
+ return {
|
|
|
+ userId: this.userInfo.userId,
|
|
|
+ couponId: this.form.couponId,
|
|
|
+ payMoney: this.form.payMoney,
|
|
|
+ payableAmount: this.form.payableAmount
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computeAmount() {
|
|
|
+ if (!this.form.doctorId || this.form.payableAmount === null || this.form.payableAmount === undefined) {
|
|
|
+ return Promise.resolve();
|
|
|
+ }
|
|
|
+ this.amountLoading = true;
|
|
|
+ return computeInquiryOrderAmount(this.buildAmountData()).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ const data = response.data || response;
|
|
|
+ this.form.payableAmount = data.payableAmount;
|
|
|
+ this.discountMoney = data.discountMoney || 0;
|
|
|
+ this.amountCalculated = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ return Promise.reject(response);
|
|
|
+ }).finally(() => {
|
|
|
+ this.amountLoading = false;
|
|
|
+ });
|
|
|
},
|
|
|
handleAddUserPatient() {
|
|
|
this.userPatient.open = true;
|
|
|
@@ -238,12 +338,20 @@ export default {
|
|
|
patientId: this.form.patientId,
|
|
|
title: this.form.illnessDesc,
|
|
|
orderType: this.form.orderType,
|
|
|
+ inquiryType: this.form.inquiryType,
|
|
|
doctorId: this.form.doctorId,
|
|
|
companyUserRemark: this.form.companyUserRemark,
|
|
|
- couponId: this.form.couponId
|
|
|
+ couponId: this.form.couponId,
|
|
|
+ payMoney: this.form.payMoney,
|
|
|
+ payableAmount: this.form.payableAmount
|
|
|
};
|
|
|
this.submitLoading = true;
|
|
|
- shareInquiryOrderLink(submitData).then(response => {
|
|
|
+ const request = this.form.couponId && !this.amountCalculated ? this.computeAmount() : Promise.resolve();
|
|
|
+ request.then(() => {
|
|
|
+ submitData.payMoney = this.form.payMoney;
|
|
|
+ submitData.payableAmount = this.form.payableAmount;
|
|
|
+ return shareInquiryOrderLink(submitData);
|
|
|
+ }).then(response => {
|
|
|
if (response.code === 200) {
|
|
|
this.shareLink = response.shareLink || (response.data && response.data.shareLink);
|
|
|
this.$emit("success");
|