123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- import { orderDetail, cancelOrder, getHospitalInfo } from "./service";
- import history from "../../utils/history";
- import { reportApi } from "../../utils/cloudMonitorHelper";
- import { getSubscribeAuth } from "../../../../core/utils/ywtService";
- Component({
- data: {
- result: {},
- modalOpened: false,
- type: "",
- buttons: [
- {
- text: "不,先留着",
- },
- {
- text: "取消预约",
- extClass: "buttonBold",
- },
- ],
- hospitalDistrictId: "",
- hospitalInfo: {},
- },
- didMount() {
- const { type, hospitalDistrictId } = this.$page.data.query;
- this.setData({
- type,
- hospitalDistrictId,
- });
- this.getBookingDetails();
- this.getHospital(hospitalDistrictId);
- /* 服务办结,核酸预约成功 */
- reportApi("核酸预约成功");
- },
- methods: {
- async getBookingDetails() {
- const {
- query = {
- orderId: "",
- },
- } = this.$page.data;
- my.showLoading();
- orderDetail({
- orderId: query.orderId,
- }).then((data) => {
- this.setData({
- result: data,
- });
- my.hideLoading();
- });
- },
- async getHospital(hospitalDistrictId) {
- const hospitalInfo = await getHospitalInfo({
- hospitalDistrictId,
- });
- this.setData({
- hospitalInfo: hospitalInfo.configInfo,
- });
- },
- handleOpenCheck(e) {
- const { url } = e.target.dataset;
- history.toH5(url);
- },
- handleBack() {
- const len = getCurrentPages().length;
- my.navigateBack({
- delta: len - 2,
- });
- },
- // 确认取消预约
- handleCancelBook() {
- my.confirm({
- title: "确认取消预约?",
- content: "已支付金额会退回原付款账户",
- confirmButtonText: "取消预约",
- cancelButtonText: "不,先留着",
- success: async ({ confirm }) => {
- if (confirm) {
- const {
- query = {
- orderId: "",
- },
- } = this.$page.data;
- await getSubscribeAuth();
- cancelOrder({
- orderId: query.orderId,
- reason: "",
- }).then(() => {
- this.handleBack();
- });
- }
- },
- });
- },
- },
- });
|