xiaokuaisong-xiaochengxu/uniapp04/unpackage/dist/dev/mp-alipay/pages/drinks/drinks.js

88 lines
2.7 KiB
JavaScript
Raw Permalink Normal View History

2024-10-18 07:53:00 +00:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const API_api = require("../../API/api.js");
2025-04-11 06:42:29 +00:00
if (!Array) {
const _easycom_uni_rate2 = common_vendor.resolveComponent("uni-rate");
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
(_easycom_uni_rate2 + _easycom_uni_icons2)();
}
const _easycom_uni_rate = () => "../../uni_modules/uni-rate/components/uni-rate/uni-rate.js";
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
(_easycom_uni_rate + _easycom_uni_icons)();
}
2024-10-18 07:53:00 +00:00
const _sfc_main = {
__name: "drinks",
setup(__props) {
const historyList = common_vendor.ref([]);
const fetchHistoryData = async () => {
try {
const res = await common_vendor.index.request({
2025-04-11 06:42:29 +00:00
url: API_api.apiImageUrl + "/api/business/list/page/vo",
method: "POST",
data: {
address: "",
businessName: "",
businessProfile: "",
categoryId: 2,
current: 1,
id: "",
pageSize: 20,
sortField: "",
sortOrder: "",
state: 1,
storeStatus: 1,
userId: ""
}
2024-10-18 07:53:00 +00:00
});
if (res.data.code === 0) {
2025-04-11 06:42:29 +00:00
console.log(res.data.data.records);
historyList.value = res.data.data.records;
2024-10-18 07:53:00 +00:00
}
} catch (error) {
console.error("Error fetching data:", error);
}
};
common_vendor.onMounted(() => {
fetchHistoryData();
});
const handleDonate = (item) => {
2025-04-11 06:42:29 +00:00
console.log(item.id);
common_vendor.index.setStorageSync("Mybusiness", item);
common_vendor.index.setStorageSync("businessItem", item.id);
2024-10-18 07:53:00 +00:00
if (!item || !item.hasOwnProperty("id")) {
console.error("The 'item' variable is undefined or missing the 'id' property.");
return;
}
const merchantId = item.id;
common_vendor.index.navigateTo({
url: `/pages/merchant/merchant?merchantId=${merchantId}`
});
};
return (_ctx, _cache) => {
return {
2025-04-11 06:42:29 +00:00
a: common_vendor.f(historyList.value, (item, index, i0) => {
2024-10-18 07:53:00 +00:00
return {
2025-04-11 06:42:29 +00:00
a: item == null ? void 0 : item.businessAvatar,
b: common_vendor.t(item == null ? void 0 : item.businessName),
c: "3b1218ee-0-" + i0,
d: common_vendor.p({
readonly: true,
value: item.level,
size: "12px"
}),
e: "3b1218ee-1-" + i0,
f: index,
g: common_vendor.o(($event) => handleDonate(item))
2024-10-18 07:53:00 +00:00
};
2025-04-11 06:42:29 +00:00
}),
b: common_vendor.p({
type: "paperplane-filled",
color: "#e99e44"
2024-10-18 07:53:00 +00:00
})
};
};
}
};
2025-04-11 06:42:29 +00:00
my.createPage(_sfc_main);