xiaokuaisong-xiaochengxu/uniapp04/unpackage/dist/dev/mp-alipay/pages/account/account.js
2024-10-18 15:53:00 +08:00

97 lines
3.4 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const API_api = require("../../API/api.js");
if (!Array) {
const _easycom_uni_collapse_item2 = common_vendor.resolveComponent("uni-collapse-item");
_easycom_uni_collapse_item2();
}
const _easycom_uni_collapse_item = () => "../../uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.js";
if (!Math) {
_easycom_uni_collapse_item();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "account",
setup(__props) {
const address = common_vendor.ref("哈尔滨华德学院二公寓");
const { safeAreaInsets } = common_vendor.index.getSystemInfoSync();
const buyerMessage = common_vendor.ref("");
const totalAmount = common_vendor.ref();
const getMerchantIdFromUrl = () => {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
if (currentPage && currentPage.options && currentPage.options.totalAmount) {
let value = currentPage.options.totalAmount;
if (typeof value === "string" && value.trim() !== "") {
totalAmount.value = Number(value);
if (isNaN(totalAmount.value)) {
console.error("Failed to parse totalAmount as a number:", value);
} else {
console.log(`totalAmount received: ${totalAmount.value}`);
}
} else {
console.error("totalAmount is not a valid string:", value);
}
} else {
console.error("Could not retrieve totalAmount from URL.");
}
};
common_vendor.onMounted(() => {
getMerchantIdFromUrl();
});
common_vendor.watch(totalAmount, (newValue) => {
common_vendor.index.$emit("totalAmountChanged", newValue);
});
const Code = () => {
my.request({
url: API_api.apiImageUrl + "/api/Alipay/trade",
method: "GET",
success: function(result) {
console.log(result);
console.log(result.data.data);
const orderNo = result.data.data;
my.tradePay({
tradeNO: result.data.data,
success: (res) => {
console.log("成功调用");
common_vendor.index.navigateTo({
url: `/pages/foodCode/foodCode?orderNo=${encodeURIComponent(orderNo)}`
});
console.log(res);
},
fail: (res) => {
my.alert({
content: JSON.stringify(res)
});
console.log("失败");
console.log(res);
}
});
}
});
};
return (_ctx, _cache) => {
var _a;
return {
a: common_vendor.t(address.value),
b: common_vendor.f(1, (item, k0, i0) => {
return {
a: item
};
}),
c: common_vendor.t(totalAmount.value),
d: `/pages/goods/goods?id=1`,
e: buyerMessage.value,
f: common_vendor.o(($event) => buyerMessage.value = $event.detail.value),
g: common_vendor.p({
title: "费用明细"
}),
h: common_vendor.t(totalAmount.value),
i: common_vendor.o(Code),
j: ((_a = common_vendor.unref(safeAreaInsets)) == null ? void 0 : _a.bottom) + "px"
};
};
}
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/111111000000/uniapp04/pages/account/account.vue"]]);
my.createPage(MiniProgramPage);