123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const _sfc_main = {
- data() {
- return {
- orderNo: "",
- orderInfo: {}
- };
- },
- onLoad(options) {
- if (options.orderNo) {
- this.orderNo = options.orderNo;
- setTimeout(() => {
- this.payEnsure();
- }, 200);
- }
- this.orderInfo = JSON.parse(sessionStorage.getItem("orderInfo"));
- },
- methods: {
- // 检查订单支付状态
- checkOrder() {
- let _this = this;
- _this.$request.get({
- url: `api/wx-pay/queryOrder/${_this.orderNo}`,
- loadingTip: "加载中...",
- data: {}
- }).then((res) => {
- common_vendor.index.hideLoading();
- let resultInfo = JSON.parse(res.data.body);
- if (resultInfo.trade_state === "SUCCESS") {
- common_vendor.index.navigateTo({
- url: `/newScale/EQtest/paySuccess?resultId=${this.orderInfo.resultId}&userId=${this.orderInfo.userId}`
- });
- } else {
- return;
- }
- });
- },
- // 拉起微信支付
- getH5Pay(params) {
- let _this = this;
- _this.$request.get({
- url: `api/orderInfo/queryOrderByResultIdAndUserId/${this.orderInfo.userId}/${this.orderInfo.resultId}`,
- loadingTip: "加载中...",
- data: {}
- }).then((res) => {
- common_vendor.index.hideLoading();
- if (res.data && res.data.orderStatus === "支付成功") {
- common_vendor.index.navigateTo({
- url: `/newScale/EQtest/paySuccess?resultId=${this.orderInfo.resultId}&userId=${this.orderInfo.userId}`
- });
- } else {
- _this.$request.post({
- url: "api/wx-pay/h5Pay",
- loadingTip: "加载中...",
- data: _this.orderInfo
- }).then((res2) => {
- let redirect_url = encodeURI(
- `http://hnhong-duo.com/webo/newScale/EQtest/paymentPage?orderNo=${res2.data.orderNo}`
- );
- window.location.href = `${res2.data.codeUrl}&redirect_url=${redirect_url}`;
- });
- }
- });
- },
- payEnsure() {
- this.$refs.popup.open();
- },
- uncompleteHandle() {
- this.$refs.popup.close();
- },
- completeHandle() {
- common_vendor.index.showLoading({
- title: ""
- });
- this.checkOrder();
- }
- }
- };
- if (!Array) {
- const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
- _easycom_uni_popup2();
- }
- const _easycom_uni_popup = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup.js";
- if (!Math) {
- _easycom_uni_popup();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: common_vendor.o(($event) => $options.getH5Pay()),
- b: common_vendor.o(($event) => $options.getH5Pay()),
- c: common_vendor.o((...args) => $options.completeHandle && $options.completeHandle(...args)),
- d: common_vendor.o((...args) => $options.uncompleteHandle && $options.uncompleteHandle(...args)),
- e: common_vendor.sr("popup", "cef389e1-0"),
- f: common_vendor.p({
- type: "center"
- })
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-cef389e1"], ["__file", "E:/psy_web_share/newScale/EQtest/paymentPage.vue"]]);
- tt.createPage(MiniProgramPage);
|