import { appointmentOrderDetailsList, Detailed, deldetailed, getPerson, dispatchsubmit, xylWeChatRefundNotify, appointmentOrderDetails, getPersonInfo, edit, updateCompanionStatus } from "@/api/system/order"; import { getListByUser } from "@/api/system/userlist.js"; export default { name: "order", data() { return { setDateRange: { disabledDate: time => { // 禁用今天之前的日期【当前天可选】 return time.getTime() < Date.now() - 24 * 60 * 60 * 1000; } }, timevalue: [], map: null, baseurl: process.env.VUE_APP_BASE_API, 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: "已取消", } ], // 遮罩层 loading: true, innerVisible4: false, editinnerVisible: false, innerrefund: false, // 护理员姓名弹框 nursePersonNameinfo: false, nursePersonlist: {}, //查看证书 certificateshow: false, PersonChecksrcList: [], // 选中数组 ids: [], // 非单个禁用 single: true, // 非多个禁用 multiple: true, // 显示搜索条件 showSearch: true, input: "", // 总条数 total: 0, // 护理类型信息表格数据 OrderDetailsList: [], dispatchlist: [], total2: 0, //护理站 stationtotal: 0, nurseStationlist: [], nurseStationshow: false, // 弹出层标题 title: "", // 查询参数 getListByUserquery: { pageNum: 1, pageSize: 10, }, lookedit: undefined, queryParams: { patientName: null, orderNo: null, nurseStationId: null, // orderStatus: null, orderStatus: "", pageNum: 1, pageSize: 10, orderType: null, }, querynursePersonname: { orderNo: "", nursePersonName: null, nursePersonType: null, departmentName: null, pageNum: 1, pageSize: 10, }, query: {}, // 表单参数 form: {}, // 表单校验 rules: {}, ordertypelist: [{ value: "COMPANION_IN_HOSPITAL", label: "陪诊陪护", }, { value: "OTHER", label: "其它", }, ], }; }, created() { this.getList(); }, mounted() { }, methods: { //时间确定 timechange(e) { this.query.companionStartDate = this.formatDate(new Date(e[0]).getTime()); this.query.companionEndDate = this.formatDate(new Date(e[1]).getTime()); }, //修改提交 editsubmitForm() { edit(this.query).then(res => { if (res.code == 200) { this.$message.success("修改成功"); this.editinnerVisible = false; } }); }, 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; }); }, // 取消按钮 cencelbtn() { this.innerrefund = false; }, switchOrderStatus(orderStatus) { switch (orderStatus) { case "WAIT_PAY": return "待付款"; case "PAY": return "已付款"; case "WAIT_DISPATCH": return "待派单"; case "NOT_FINISH": return "未完成"; case "WAIT_RECEIVE": return "待接单" case "COMPLETE": return "待评价"; case "EVALUATED": return "服务完成"; case "WAIT_REFUND": return "退款中"; case "REFUNDED": return "退款成功"; case "CANCEL": return "已取消"; default: break; } }, switchOrderStatus2(orderStatus) { switch (orderStatus) { case "WAIT_PAY": return "待付款"; case "PAY": return "已付款"; case "WAIT_DISPATCH": return "已支付"; case "NOT_FINISH": return "未完成"; case "WAIT_RECEIVE": return "待接单" case "COMPLETE": return "待评价"; case "EVALUATED": return "服务完成"; case "WAIT_REFUND": return "退款中"; case "REFUNDED": return "退款成功"; case "CANCEL": return "已取消"; default: break; } }, formatDate(time, timetype) { let date = new Date(time); //13位时间戳 //let date = new Date(parseInt(time) * 1000); //10位时间戳 let y = date.getFullYear(); let MM = date.getMonth() + 1; MM = MM < 10 ? "0" + MM : MM; let d = date.getDate(); d = d < 10 ? "0" + d : d; return y + "-" + MM + "-" + d; }, //确认完成 Confirmcompletion(row) { this.$confirm("确认完成此陪诊陪护订单?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", }) .then(() => { updateCompanionStatus(row.orderStatus, row.orderNo).then(res => { this.$modal.msgSuccess("订单已完成"); this.getList() }) }) .catch(() => { }); }, //编辑 seelookedit(row, boolean) { this.lookedit = boolean this.loading = true; const id = row.orderNo; this.map = null; appointmentOrderDetails(id).then(res => { this.timevalue = [ res.data.companionStartDate ? res.data.companionStartDate : "", res.data.companionEndDate ? res.data.companionEndDate : "" ]; this.query = res.data; res.data.disablingCondition == "DISABLED" ? (res.data.disablingCondition = "是") : ""; res.data.disablingCondition == "NOT_DISABLED" ? (res.data.disablingCondition = "否") : ""; if (row.orderStatus == "EVALUATED") { if (res.data) { if (res.data.evaluateSatisfaction == "COMMONLY") { this.query.evaluateSatisfaction = "一般"; } else if (res.data.evaluateSatisfaction == "SATISFIED") { this.query.evaluateSatisfaction = "满意"; } else if (res.data.evaluateSatisfaction == "DISSATISFIED") { this.query.evaluateSatisfaction = "不满意"; } else if (res.data.evaluateSatisfaction == "VERYSATISFIED") { this.query.evaluateSatisfaction = "非常满意"; } else if (res.data.evaluateSatisfaction == "VERYDISSATISFIED") { this.query.evaluateSatisfaction = "非常不满意"; } this.loading = false; this.editinnerVisible = true; } else { this.loading = false; this.editinnerVisible = true; } } else if (row.orderStatus == "COMPLETE") { this.loading = false; this.editinnerVisible = true; } else { this.loading = false; this.editinnerVisible = true; } }); }, // 查看 seeLook(row) { this.loading = true const id = row.orderNo; this.map = null appointmentOrderDetails(id).then((res) => { res.data.time = res.data.serviceDate + "-" + res.data.serviceStartTime; this.query = res.data; res.data.disablingCondition == 'DISABLED' ? res.data.disablingCondition = '是' : '' res.data.disablingCondition == 'NOT_DISABLED' ? res.data.disablingCondition = '否' : '' if (row.orderStatus == 'EVALUATED') { if (res.data) { if (res.data.evaluateSatisfaction == 'COMMONLY') { this.query.evaluateSatisfaction = '一般' } else if (res.data.evaluateSatisfaction == 'SATISFIED') { this.query.evaluateSatisfaction = '满意' } else if (res.data.evaluateSatisfaction == 'DISSATISFIED') { this.query.evaluateSatisfaction = '不满意' } else if (res.data.evaluateSatisfaction == 'VERYSATISFIED') { this.query.evaluateSatisfaction = '非常满意' } else if (res.data.evaluateSatisfaction == 'VERYDISSATISFIED') { 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 getPerson(this.querynursePersonname).then((res) => { this.dispatchlist = res.rows; this.total2 = res.total; this.nursePersonNameinfo = true; }); }, //派单护理员 nursePersonNameinfocancel() { this.nursePersonNameinfo = false this.nursePersonlist = {} }, // 护理员姓名弹框确定按钮 submitFormclick() { let params = { nurseStationPersonId: this.nursePersonlist.nurseStationPersonId, orderNo: this.querynursePersonname.orderNo, }; dispatchsubmit(params).then((res) => { if (res.code == 200) { this.$modal.msgSuccess("派单成功"); } this.nursePersonNameinfo = false; this.getList(); }); }, submitForm(row) { this.nursePersonlist = row }, // 查看护理员证书按钮 nursePersonclick(row) { getPersonInfo(row.nurseStationPersonId).then(res => { this.PersonChecksrcList = res.data; this.certificateshow = true }) }, // 确认取消预约 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; }); }, // 表单重置 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; }); }, /** 重置按钮操作 */ 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) { 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` ); }, }, };