NurseStationUI/src/views/system/order/index.vue
2022-11-11 15:34:09 +08:00

871 lines
24 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="所属护理站" prop="nurseStationName">
<el-select
v-model="queryParams.nurseStationId"
placeholder="请选择护理站"
v-loadmore="loadMore"
>
<el-option
v-for="item in nurseStationlist"
:key="item.id"
:label="item.nurseStationName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="客户" prop="patientName">
<el-input
v-model="queryParams.patientName"
placeholder="请输入客户"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="订单编号" prop="orderNo">
<el-input
v-model="queryParams.orderNo"
placeholder="请输入订单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="订单状态" prop="orderStatus">
<el-select
v-model="queryParams.orderStatus"
placeholder="请选择订单状态"
>
<el-option
v-for="item in orderStatuslist"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="OrderDetailsList"
@selection-change="handleSelectionChange"
>
<el-table-column
label="所属护理站"
align="center"
prop="nurseStationName"
/>
<el-table-column label="会员名称" align="center" prop="patientName" />
<el-table-column label="订单编号" align="center" prop="orderNo" />
<el-table-column
label="护理项目名称"
align="center"
prop="nurseItemName"
/>
<el-table-column label="订单总金额" align="center" prop="totalPrice" />
<el-table-column label="订单状态" align="center" prop="orderStatus">
<template slot-scope="scope">
<el-button v-if="scope.row.orderStatus == 'WAIT_PAY'"
>待付款</el-button
>
<el-button type="primary" v-if="scope.row.orderStatus == 'PAY'"
>已付款</el-button
>
<el-button
type="primary"
v-if="scope.row.orderStatus == 'WAIT_DISPATCH'"
>待派单</el-button
>
<el-button type="primary" v-if="scope.row.orderStatus == 'NOT_FINISH'"
>未完成</el-button
>
<el-button type="success" v-if="scope.row.orderStatus == 'COMPLETE'"
>服务完成</el-button
>
<el-button
type="warning"
v-if="scope.row.orderStatus == 'WAIT_REFUND'"
>退款中</el-button
>
<el-button
type="warning"
v-if="scope.row.orderStatus == 'WAIT_RETURNED_GOODS'"
>待退货</el-button
>
<el-button type="danger" v-if="scope.row.orderStatus == 'CANCEL'"
>已取消</el-button
>
<el-button type="danger" v-if="scope.row.orderStatus == 'REFUNDED'"
>退款成功</el-button
>
</template>
</el-table-column>
<el-table-column label="下单时间" align="center" prop="createTime" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-zoom-in"
@click="seeLook(scope.row)"
v-hasPermi="['system:appointmentOrder:query']"
>查看</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-s-promotion"
@click="dispatch(scope.row)"
v-hasPermi="['system:appointmentOrder:dispatch']"
v-if="scope.row.orderStatus == 'WAIT_DISPATCH'"
>派单</el-button
>
<el-button
size="mini"
type="text"
disabled
icon="el-icon-s-promotion"
@click="dispatch(scope.row)"
v-else
>派单</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-error"
v-if="scope.row.orderStatus == 'WAIT_REFUND'"
@click="cencel(scope.row)"
v-hasPermi="['system:appointmentOrder:confirmCancel']"
>取消预约</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-error"
v-else
disabled
v-hasPermi="['system:appointmentOrder:confirmCancel']"
>取消预约</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:nurseType:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 查看弹框 -->
<el-dialog
title="查看订单信息"
:visible.sync="innerVisible4"
append-to-body
width="1048px"
>
<el-form
:inline="true"
ref="form"
:model="query"
:rules="rules"
label-width="120px"
class="orderInfo"
>
<el-form-item label="订单编号" prop="orderNo">
<el-input
v-model="query.orderNo"
:disabled="true"
style="width: 190px"
/>
</el-form-item>
<el-form-item label="订单状态" prop="orderStatus">
<el-input
:value="switchOrderStatus(query.orderStatus)"
disabled
style="width: 150px"
>
</el-input>
</el-form-item>
<el-form-item label="护理站名称" prop="nurseStationName">
<el-input
v-model="query.nurseStationName"
clearable
:disabled="true"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="订单数量" prop="orderCount">
<el-input
v-model="query.orderCount"
clearable
:disabled="true"
style="width: 190px"
/>
</el-form-item>
<el-form-item label="护理项目名称" prop="nurseItemName">
<el-input
v-model="query.nurseItemName"
clearable
:disabled="true"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="服务时间" prop="time">
<el-input
v-model="query.time"
clearable
:disabled="true"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="护理项目时长" prop="itemServeDurationUnit">
<el-input
v-model="query.itemServeDurationUnit"
clearable
:disabled="true"
style="width: 190px"
/>
</el-form-item>
<el-form-item label="护理项目价格" prop="nurseItemPrice">
<el-input
v-model="query.nurseItemPrice"
clearable
:disabled="true"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="服务地址" prop="serviceAddress">
<el-input
v-model="query.serviceAddress"
clearable
:disabled="true"
style="width: 240px"
/>
</el-form-item>
<el-table
:data="query.appointmentOrderConsumableList"
align="center"
style="margin: 10px 0 20px 0; padding-bottom: 20px"
>
<el-table-column
prop="orderConsumableName"
label="耗材包名称"
width="200"
align="center"
>
</el-table-column>
<el-table-column
prop="orderConsumableCount"
label="耗材包数量"
width="200"
align="center"
>
</el-table-column>
<el-table-column
prop="orderConsumablePrice"
label="耗材包价格"
width="200"
align="center"
>
</el-table-column>
</el-table>
</el-form>
</el-dialog>
<!-- 派单弹框 -->
<el-dialog
title="派单"
:visible.sync="innerdispatch"
append-to-body
width="500px"
height="100px"
>
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<el-form-item label="护理员姓名" prop="nursePersonName">
<el-button
type=""
v-if="nurseName == '请选择护理员'"
style="width: 300px; text-align: left; height: 36px; color: #c0c4cc"
@click="clicknursePersonName()"
>{{ nurseName }}</el-button
>
<el-button
type=""
@click="clicknursePersonName()"
v-else
style="
width: 300px;
text-align: left;
height: 36px;
padding-left: -10px;
"
>{{ nurseName }}</el-button
>
</el-form-item>
<!-- <el-button
type=""
@click="departclick(item, index)"
v-else
style="
width: 200px;
text-align: left;
height: 36px;
padding-left: -10px;
"
>{{ item.departmentName }}</el-button
> -->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<!-- <el-button @click="cancel">取 消</el-button> -->
</div>
</el-dialog>
<!-- 取消预约弹框 -->
<el-dialog
title="取消预约"
:visible.sync="innerrefund"
append-to-body
width="500px"
>
<el-form :inline="true" :rules="rules" label-width="120px">
<el-form-item label="订单编号" prop="orderNo">
<el-input
style="width: 260px"
v-model="query.orderNo"
clearable
:disabled="true"
/>
</el-form-item>
<el-form-item label="服务项目" prop="nurseItemName">
<el-input
v-model="query.nurseItemName"
style="width: 260px"
clearable
:disabled="true"
/>
</el-form-item>
<el-form-item label="会员姓名" prop="time">
<el-input
v-model="query.patientName"
style="width: 260px"
clearable
:disabled="true"
/>
</el-form-item>
<el-form-item label="退款原因" prop="cancelAppointmentReason">
<el-input
style="width: 260px"
v-model="query.cancelAppointmentReason"
placeholder=""
clearable
type="textarea"
:rows="5"
disabled
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cencelbtn">取 消</el-button>
<el-button type="primary" @click="ordercacenl">确 定</el-button>
</div>
</el-dialog>
<!-- 姓名弹框 -->
<el-dialog
:visible.sync="nursePersonNameinfo"
width="1000px"
append-to-body
>
<el-form
ref="queryForm"
:model="querynursePersonname"
:rules="rules"
label-width="80px"
:inline="true"
>
<el-form-item label="姓名" prop="nursePersonName" label-width="120">
<el-input
v-model="querynursePersonname.nursePersonName"
placeholder="请输入姓名"
clearable
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery2"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery2"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table :data="dispatchlist" @cell-dblclick="nursePersonclick">
<el-table-column label="请选择" width="70" align="center">
<template slot-scope="scope">
<el-button
type="primary"
style="width: 15px; height: 15px; overflow: hidden"
v-if="nursePersonid == scope.row.nurseStationPersonId"
circle
@click="nursePersonclick(scope.row)"
></el-button>
<el-button
v-else
style="width: 15px; height: 15px; overflow: hidden"
circle
@click="nursePersonclick(scope.row)"
></el-button>
</template>
</el-table-column>
<el-table-column
property="nursePersonCode"
label="护理员编号"
width="150"
align="center"
>
</el-table-column>
<el-table-column
property="nursePersonName"
label="护理站人员姓名"
width="150"
align="center"
>
</el-table-column>
<el-table-column
property="nursePersonType"
label="护理站人员类型"
width="150"
align="center"
>
<template slot-scope="scope">
{{ scope.row.nursePersonType == "NURSE" ? "护士" : "" }}
{{ scope.row.nursePersonType == "NURSE_TEACHER" ? "护理师" : "" }}
</template>
</el-table-column>
<el-table-column
property="phone"
label="手机号"
width="150"
align="center"
>
</el-table-column>
<el-table-column label="性别" align="center" prop="sex">
<template slot-scope="scope">
{{ scope.row.sex == "MALE" ? "" : "" }}
{{ scope.row.sex == "FEMALE" ? "" : "" }}
</template>
</el-table-column>
</el-table>
<pagination
v-show="total2 > 0"
:total="total2"
:page.sync="querynursePersonname.pageNum"
:limit.sync="querynursePersonname.pageSize"
@pagination="handleQuery2"
/>
</el-dialog>
</div>
</template>
<script>
import {
appointmentOrderDetailsList,
Detailed,
deldetailed,
getPerson,
dispatchsubmit,
xylWeChatRefundNotify,
appointmentOrderDetails,
} from "@/api/system/order";
import { getListByUser } from "@/api/system/userlist.js";
import { weChatRefundOrderApply } from "@/api/system/goodsOrder";
export default {
name: "order",
data() {
return {
orderStatuslist: [
{
value: "WAIT_PAY",
label: "待付款",
},
{
value: "PAY",
label: "已付款",
},
{
value: "CANCEL",
label: "已取消",
},
// {
// value: "WAIT_RECEIVED_GOODS",
// label: "待收货",
// },
// {
// value: "RECEIVED_GOODS",
// label: "已收货",
// },
{
value: "WAIT_DISPATCH",
label: "待派单",
},
{
value: "WAIT_REFUND",
label: "退款中",
},
{
value: "REFUNDED",
label: "退款成功",
},
{
value: "COMPLETE",
label: "服务完成",
},
{
value: "WAIT_RETURNED_GOODS",
label: "待退货",
},
{
value: "RETURNED_GOODS",
label: "已退货",
},
{
value: "NOT_FINISH",
label: "未完成",
},
],
value: "",
// 遮罩层
loading: true,
innerVisible4: false,
innerrefund: false,
// 派单弹框
innerdispatch: false,
// 姓名弹框
nursePersonNameinfo: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
input: "",
// 总条数
total: 0,
// 护理类型信息表格数据
OrderDetailsList: [],
dispatchlist: [],
nurseName: "请选择护理员",
nursePersonid: "",
// querynursecencel:{
// appointmentOrderId:"",
// },
appointmentOrderId: "",
nurseStationPersonId: "",
total2: 0,
nurseStationlist: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
open2: false,
// 查询参数
queryParams: {
patientName: null,
orderNo: null,
nurseStationId: null,
// orderStatus: null,
orderStatus: "",
pageNum: 1,
pageSize: 10,
},
querynursePersonname: {
orderNo: "",
nursePersonName: null,
nursePersonType: null,
departmentName: null,
pageNum: 1,
pageSize: 10,
},
query: [],
// 表单参数
form: {},
// 表单校验
rules: {},
};
},
created() {
this.getList();
this.info()
},
methods: {
//取消预约确定按钮
ordercacenl() {
var obj = {
orderNo: this.query.orderNo,
refundPrice: this.query.totalPrice,
refundReason: this.query.cancelAppointmentReason,
};
xylWeChatRefundNotify(obj).then((res) => {
if (res.code == 200) {
this.$modal.msgSuccess("退款有延迟请耐心等待");
}
this.getList();
this.innerrefund=false
console.log(res);
});
},
// 取消按钮
cencelbtn(){
this.innerrefund = false;
},
switchOrderStatus(orderStatus) {
switch (orderStatus) {
case "WAIT_PAY":
return "待付款";
case "WAIT_DISPATCH":
return "待派单";
case "NOT_FINISH":
return "未完成";
case "COMPLETE":
return "服务完成";
default:
break;
}
},
// 查看
seeLook(row) {
const id = row.orderNo;
// console.log(row);
appointmentOrderDetails(id).then((res) => {
res.data.forEach((e) => {
if (e.serviceDate) {
e.time =
e.serviceDate + "-" + e.serviceStartTime + "-" + e.serviceEndTime;
}
});
this.query = res.data[0];
this.innerVisible4 = true;
console.log(this.query);
});
},
// 派单
dispatch(row) {
console.log(row);
this.querynursePersonname.orderNo = row.orderNo;
console.log(this.querynursePersonname.orderNo);
// console.log(row)
this.nurseName = "请选择护理员";
this.innerdispatch = true;
this.nursePersonid = "";
},
// 姓名弹框
clicknursePersonName() {
getPerson(this.querynursePersonname).then((res) => {
this.dispatchlist = res.rows;
this.total2 = res.total;
console.log(this.dispatchlist);
this.nursePersonNameinfo = true;
});
},
// 姓名弹框确定按钮
submitForm() {
let params = {
nurseStationPersonId: this.nursePersonid,
orderNo: this.querynursePersonname.orderNo,
};
dispatchsubmit(params).then((res) => {
if (res.code == 200) {
this.$modal.msgSuccess("派单成功");
}
this.innerdispatch = false;
this.getList();
this.nurseName = "请选择护理员";
});
},
// 选择姓名按钮
nursePersonclick(row) {
this.nursePersonid = row.nurseStationPersonId;
this.nurseName = row.nursePersonName;
this.nursePersonNameinfo = false;
console.log(row);
},
// 确认取消预约
cencel(row) {
Detailed(row.orderNo).then((res) => {
this.query = res.data;
this.innerrefund = true;
});
},
/** 查询护理类型信息列表 */
getList() {
this.loading = true;
appointmentOrderDetailsList(this.queryParams).then((response) => {
this.OrderDetailsList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
patientName: "",
orderNo: "",
orderStatus: "",
createTime: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
handleQuery2() {
getPerson(this.querynursePersonname).then((res) => {
this.dispatchlist = res.rows;
console.log(this.querynursePersonname);
// this.innerdispatch = true;
});
},
/** 重置按钮操作 */
resetQuery() {
if (this.nurseStationlist[0].isAdmin == '1') {
this.resetForm("queryForm");
this.queryParams = {
pageNum: 1,
pageSize: 10
}
} else {
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10
}
this.handleQuery();
},
//权限列表
info() {
getListByUser(this.queryParams).then((res) => {
if (res.rows[0].isAdmin == "1") {
this.nurseStationlist = res.rows;
this.total = res.total;
} else {
this.total = res.total;
this.nurseStationlist = res.rows;
this.queryParams.nurseStationId = res.rows[0].id;
this.handleQuery();
}
});
},
//滑动下拉框
loadMore() {
var a = Math.ceil(this.total / 10);
if (this.nurseStationlist.length + 1 >= this.total) {
} else {
if (this.queryParams.pageNum >= a) {
} else {
this.queryParams.pageNum++;
getListByUser(this.queryParams).then((res) => {
res.rows.forEach((e) => {
this.nurseStationlist.push(e);
});
});
}
}
},
resetQuery2() {
this.resetForm("queryForm");
this.handleQuery2();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 删除按钮操作 */
handleDelete(row) {
// console.log('row :>> ', row);
this.$confirm("是否确认删除订单信息的数据项", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
deldetailed(row.appointmentOrderId).then((res) => {
this.$message.success("删除成功");
this.getList();
});
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/nurseType/export",
{
...this.queryParams,
},
`nurseType_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<style scoped>
::v-deep .orderInfo {
height: 350px;
overflow-y: scroll;
}
</style>