95 lines
3.1 KiB
JavaScript
95 lines
3.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const API_api = require("../../API/api.js");
|
|
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)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "goSearch",
|
|
setup(__props) {
|
|
const searchTerm = common_vendor.ref("");
|
|
const businessRecords = common_vendor.ref([]);
|
|
const searchBusiness = () => {
|
|
const businessName = searchTerm.value;
|
|
common_vendor.index.request({
|
|
url: API_api.apiImageUrl + "/api/business/list/page/vo",
|
|
method: "POST",
|
|
data: {
|
|
address: "",
|
|
businessName,
|
|
businessProfile: "",
|
|
categoryId: "",
|
|
current: 1,
|
|
id: "",
|
|
pageSize: 10,
|
|
sortField: "",
|
|
sortOrder: "",
|
|
state: 1,
|
|
storeStatus: "",
|
|
userId: ""
|
|
},
|
|
success(res) {
|
|
businessRecords.value = res.data.data.records || [];
|
|
console.log(businessRecords.value);
|
|
console.log("成功");
|
|
},
|
|
fail() {
|
|
console.log("出错了");
|
|
}
|
|
});
|
|
};
|
|
const handleDonate = (item) => {
|
|
console.log(item.id);
|
|
common_vendor.index.setStorageSync("Mybusiness", item);
|
|
common_vendor.index.setStorageSync("businessItem", item.id);
|
|
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 common_vendor.e({
|
|
a: searchTerm.value,
|
|
b: common_vendor.o(($event) => searchTerm.value = $event.detail.value),
|
|
c: common_vendor.o(searchBusiness),
|
|
d: businessRecords.value.length === 0
|
|
}, businessRecords.value.length === 0 ? {} : {}, {
|
|
e: businessRecords.value.length > 0
|
|
}, businessRecords.value.length > 0 ? {
|
|
f: common_vendor.f(businessRecords.value, (item, index, i0) => {
|
|
return {
|
|
a: item.businessAvatar,
|
|
b: common_vendor.t(item.businessName),
|
|
c: "9800dcee-0-" + i0,
|
|
d: "9800dcee-1-" + i0,
|
|
e: index,
|
|
f: common_vendor.o(($event) => handleDonate(item))
|
|
};
|
|
}),
|
|
g: common_vendor.p({
|
|
readonly: true,
|
|
value: 4,
|
|
size: "12px"
|
|
}),
|
|
h: common_vendor.p({
|
|
type: "paperplane-filled",
|
|
color: "#e99e44"
|
|
})
|
|
} : {});
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9800dcee"]]);
|
|
my.createPage(MiniProgramPage);
|