NurseStationOperateUI/src/views/system/order/indexjs.js
2022-12-06 09:53:31 +08:00

419 lines
14 KiB
JavaScript
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.

import {
appointmentOrderDetailsList,
Detailed,
deldetailed,
getPerson,
dispatchsubmit,
xylWeChatRefundNotify,
appointmentOrderDetails,
} from "@/api/system/order";
import { getListByUser } from "@/api/system/userlist.js";
import baseurl from '@/api/baseurl.js'
export default {
name: "order",
data() {
return {
map: null,
baseurl: null,
orderStatuslist: [{
value: "WAIT_PAY",
label: "待付款",
},
{
value: "PAY",
label: "已付款",
},
{
value: "WAIT_DISPATCH",
label: "待派单",
},
{
value: "NOT_FINISH",
label: "未完成",
},
{
value: "COMPLETE",
label: "待评价",
},
{
value: "EVALUATED",
label: "服务完成",
},
{
value: "WAIT_REFUND",
label: "退款中",
},
{
value: 'REFUNDED',
label: '退款成功'
},
{
value: "CANCEL",
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,
//护理站
stationtotal: 0,
nurseStationlist: [],
nurseStationshow: false,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
open2: false,
// 查询参数
getListByUserquery: {
pageNum: 1,
pageSize: 10,
},
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.baseurl = baseurl
},
mounted() {},
methods: {
init(query) {
this.map = new AMap.Map("container", {
resizeEnable: true, //设置地图可缩放
zoom: 18, //设置地图的层级
center: [query.serveLocationLongitude, query.serveLocationLatitude], //设置地图中心点 更多配置项参照高德官网的配置
});
var layer = new AMap.LabelsLayer({
zooms: [3, 20],
zIndex: 1000,
// 开启标注避让默认为开启v1.4.15 新增属性
collision: true,
// 开启标注淡入动画默认为开启v1.4.15 新增属性
animation: true,
});
this.map.add(layer);
var labelMarker = new AMap.LabelMarker({
name: query.serviceLocationName,
position: [query.serveLocationLongitude, query.serveLocationLatitude],
icon: {
type: "image",
image: "https://a.amap.com/jsapi_demos/static/images/poi-marker.png",
clipOrigin: [280, 8],
clipSize: [50, 68],
size: [25, 34],
anchor: "bottom-center",
angel: 0,
retina: true,
},
text: {
content: query.serviceLocationName,
direction: "top",
offset: [0, 0],
style: {
fontSize: 13,
fontWeight: "normal",
fillColor: "black",
padding: "2, 5",
backgroundColor: "",
},
},
});
layer.add(labelMarker);
},
//取消预约确定按钮
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 "PAY":
return "已付款";
case "WAIT_DISPATCH":
return "待派单";
case "NOT_FINISH":
return "未完成";
case "COMPLETE":
return "待评价";
case "EVALUATED":
return "服务完成";
case "WAIT_REFUND":
return "退款中";
case "REFUNDED":
return "退款成功";
case "CANCEL":
return "已取消";
default:
break;
}
},
// 查看
seeLook(row) {
this.loading = true
const id = row.orderNo;
this.map = null
appointmentOrderDetails(id).then((res) => {
res.data.forEach((e) => {
if (e.serviceDate) {
e.time =
e.serviceDate + "-" + e.serviceStartTime + "-" + e.serviceEndTime;
}
});
this.query = res.data[0];
if (row.orderStatus == 'EVALUATED') {
if (res.data) {
if (res.data[0].evaluateSatisfaction == 'COMMONLY') {
this.query.evaluateSatisfaction = '一般'
} else if (res.data[0].evaluateSatisfaction == 'SATISFIED') {
this.query.evaluateSatisfaction = '满意'
} else if (res.data[0].evaluateSatisfaction == 'DISSATISFIED') {
this.query.evaluateSatisfaction = '不满意'
}
this.loading = false
this.innerVisible4 = true;
setTimeout(() => {
this.init(this.query)
}, 500);
} else {
this.loading = false
this.innerVisible4 = true;
setTimeout(() => {
this.init(this.query)
}, 500);
}
} else if (row.orderStatus == 'COMPLETE') {
this.loading = false
this.innerVisible4 = true;
setTimeout(() => {
this.init(this.query)
}, 500);
} else {
this.loading = false
this.innerVisible4 = true;
}
});
},
// 派单
dispatch(row) {
this.querynursePersonname.orderNo = row.orderNo;
this.nurseName = "请选择护理员";
this.innerdispatch = true;
this.nursePersonid = "";
},
// 姓名弹框
clicknursePersonName() {
getPerson(this.querynursePersonname).then((res) => {
this.dispatchlist = res.rows;
this.total2 = res.total;
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;
});
},
clicknurseStationshow() {
this.nurseStationshow = false;
},
//护理站重置
stationcancel() {
this.getListByUserquery = {
pageNum: 1,
pageSize: 10,
};
this.info();
},
//护理站页面选择护理站
choicestationid(item) {
this.queryParams.nurseStationName = item.nurseStationName;
this.queryParams.nurseStationId = item.id;
this.nurseStationshow = false;
},
//护理站list
info() {
getListByUser(this.getListByUserquery).then((res) => {
this.nurseStationlist = res.rows;
this.stationtotal = res.total;
});
},
//页面所属护理站
ParamsStation(item) {
this.info();
this.nurseStationshow = 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() {
this.resetForm("queryForm");
this.queryParams = {
pageNum: 1,
pageSize: 10,
};
this.handleQuery();
},
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`
);
},
},
};