matchPayDone.js 3.53 KB
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_match = require("../../common/match.js");
require("../../common/request.js");
require("../../config.js");
require("../../common/login.js");
require("../../common/api.js");
if (!Array) {
  const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  _easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
  _easycom_uni_icons();
}
const _sfc_main = {
  __name: "matchPayDone",
  setup(__props) {
    const data = common_vendor.reactive({
      chargeFlag: "",
      amount: "",
      payType: ""
    });
    const { chargeFlag, payType, amount } = common_vendor.toRefs(data);
    getApp();
    let cptId;
    let groupId;
    common_vendor.onLoad((option) => {
      console.log(option);
      cptId = option.cptId;
      groupId = option.groupId;
      chargeFlag.value = option.chargeFlag;
      option.orderId;
      if (option.amount) {
        amount.value = option.amount;
      }
      if (option.payType) {
        payType.value = option.payType;
      }
    });
    function goDetail() {
      common_vendor.index.redirectTo({
        url: `/pages/usercenter/matchSignDetail?id=${cptId}&groupId=${groupId}&auditStatus=1}`
      });
    }
    function download() {
      common_match.downloadpz(cptId, groupId).then((res) => {
        goWebView(res.data);
      });
    }
    function goWebView(url) {
      console.log(url);
      url = url.replace("http://", "https://");
      common_vendor.index.showLoading({
        title: "下载中"
      });
      common_vendor.index.downloadFile({
        url,
        success: function(res) {
          common_vendor.index.hideLoading();
          var filePath = res.tempFilePath;
          common_vendor.index.showLoading({
            title: "正在打开"
          });
          common_vendor.index.openDocument({
            filePath,
            showMenu: true,
            success: function(res2) {
              common_vendor.index.hideLoading();
            },
            fail: function(err) {
              common_vendor.index.hideLoading();
              common_vendor.index.showToast({
                title: err,
                icon: "none",
                duration: 2e3
              });
            }
          });
        },
        fail: function(error) {
          common_vendor.index.hideLoading();
          common_vendor.index.showToast({
            title: `下载失败`,
            icon: "none",
            duration: 2e3
          });
        }
      });
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          type: "checkbox-filled",
          size: "100",
          color: "#1EC886"
        }),
        b: common_vendor.unref(chargeFlag) == "0"
      }, common_vendor.unref(chargeFlag) == "0" ? {} : common_vendor.e({
        c: common_vendor.t(common_vendor.unref(amount)),
        d: common_vendor.unref(payType) == "0"
      }, common_vendor.unref(payType) == "0" ? {} : common_vendor.unref(payType) == "1" ? {} : common_vendor.unref(payType) == "2" ? {} : {}, {
        e: common_vendor.unref(payType) == "1",
        f: common_vendor.unref(payType) == "2"
      }), {
        g: common_vendor.o(download),
        h: common_vendor.o(goDetail)
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9177fafc"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages_match/match/matchPayDone.vue"]]);
wx.createPage(MiniProgramPage);