223 lines
6.8 KiB
JavaScript
223 lines
6.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
require("../../utils/request.js");
|
|
const api_layout_index = require("../../api/layout/index.js");
|
|
const api_shop_merchant_index = require("../../api/shop/merchant/index.js");
|
|
const store_modules_tenant = require("../../store/modules/tenant.js");
|
|
require("../../store/modules/user.js");
|
|
const tenantStore = store_modules_tenant.useTenantStore();
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
itemType: null,
|
|
items: ["关注", "推荐"],
|
|
// 场馆列表
|
|
merchant: [],
|
|
// 网站参数
|
|
fields: {},
|
|
// 幻灯片广告
|
|
ads: [],
|
|
// 幻灯片链接地址
|
|
pathList: [],
|
|
// 项目列表
|
|
itemList: [],
|
|
// 小程序导航图标
|
|
navigation: [],
|
|
// 小程序导航图标(双排)
|
|
doubleNavigation: [],
|
|
isLogin: false,
|
|
// 骨架屏
|
|
hideTools: true,
|
|
mp_menu_display_method: 0
|
|
};
|
|
},
|
|
onLoad(o) {
|
|
this.itemType = o.type;
|
|
this.reload();
|
|
},
|
|
methods: {
|
|
async reload() {
|
|
const app = this;
|
|
const info = await tenantStore.fetchTenantInfo();
|
|
if (common_vendor.index.getStorageSync("user_id") && common_vendor.index.getStorageSync("access_token")) {
|
|
app.isLogin = true;
|
|
}
|
|
if (info.fields) {
|
|
info.fields.map((d) => {
|
|
const key = d.name;
|
|
app.fields[key] = d.value;
|
|
if (d.name == "h5_url") {
|
|
common_vendor.index.setStorageSync(d.name, d.value);
|
|
}
|
|
if (d.name == "mp_menu_display_method") {
|
|
app.mp_menu_display_method = d.value;
|
|
}
|
|
});
|
|
}
|
|
if (info.ads) {
|
|
const ad = info.ads.filter((d) => d.adType == "幻灯片");
|
|
if (ad) {
|
|
const adsList = JSON.parse(ad[0].images);
|
|
adsList.map((d) => {
|
|
app.ads.push(d.url);
|
|
});
|
|
app.pathList = JSON.parse(ad[0].path);
|
|
}
|
|
app.hideTools = false;
|
|
}
|
|
if (info.websiteName) {
|
|
common_vendor.index.setNavigationBarTitle({
|
|
title: info.websiteName
|
|
});
|
|
}
|
|
if (info.websiteLogo) {
|
|
common_vendor.index.setStorageSync("app_logo", info.websiteLogo);
|
|
app.logo = info.websiteLogo;
|
|
}
|
|
if (info.mpMenus) {
|
|
const arr = info.mpMenus.filter((d) => d.type == 2 && d.rows == 0);
|
|
const arr1 = info.mpMenus.filter((d) => d.type == 2 && d.rows == 1);
|
|
info.mpMenus.filter((d) => d.type == 2 && d.rows == 2);
|
|
app.navigation = [];
|
|
app.doubleNavigation = [];
|
|
if (arr1) {
|
|
app.doubleNavigation.push(arr);
|
|
app.doubleNavigation.push(arr1);
|
|
} else {
|
|
app.doubleNavigation.push(arr);
|
|
}
|
|
if (arr) {
|
|
app.navigation = arr;
|
|
}
|
|
}
|
|
Promise.all([app.getMerchantList()]).then((res) => {
|
|
app.merchant = res[0];
|
|
});
|
|
},
|
|
getSiteInfo() {
|
|
return new Promise((resolve, reject) => {
|
|
api_layout_index.getSiteInfo().then((result) => {
|
|
resolve(result);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
getMerchantList() {
|
|
const { itemType } = this;
|
|
return new Promise((resolve, reject) => {
|
|
api_shop_merchant_index.listMerchant({ itemType }).then((result) => {
|
|
resolve(result);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
change(e) {
|
|
const { index } = e.detail;
|
|
const id = this.merchant[index].merchantId;
|
|
this.openUrl(`/package/booking/index?id=${id}`);
|
|
},
|
|
onAds(index) {
|
|
const { pathList } = this;
|
|
this.openUrl(pathList[index]);
|
|
},
|
|
openUrl(url) {
|
|
if (!this.isLogin) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
} else {
|
|
common_vendor.index.navigateTo({
|
|
url
|
|
});
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uni_grid_item2 = common_vendor.resolveComponent("uni-grid-item");
|
|
const _easycom_uni_grid2 = common_vendor.resolveComponent("uni-grid");
|
|
const _easycom_uv_skeleton2 = common_vendor.resolveComponent("uv-skeleton");
|
|
const _easycom_uv_gap2 = common_vendor.resolveComponent("uv-gap");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
|
|
(_easycom_uni_grid_item2 + _easycom_uni_grid2 + _easycom_uv_skeleton2 + _easycom_uv_gap2 + _easycom_uni_card2 + _easycom_ws_login2)();
|
|
}
|
|
const _easycom_uni_grid_item = () => "../../uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.js";
|
|
const _easycom_uni_grid = () => "../../uni_modules/uni-grid/components/uni-grid/uni-grid.js";
|
|
const _easycom_uv_skeleton = () => "../../uni_modules/uv-skeleton/components/uv-skeleton/uv-skeleton.js";
|
|
const _easycom_uv_gap = () => "../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
|
|
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
|
|
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
|
|
if (!Math) {
|
|
(_easycom_uni_grid_item + _easycom_uni_grid + _easycom_uv_skeleton + _easycom_uv_gap + _easycom_uni_card + _easycom_ws_login)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: $data.merchant.length > 0
|
|
}, $data.merchant.length > 0 ? {
|
|
b: common_vendor.f($data.merchant, (item, index, i0) => {
|
|
return {
|
|
a: item.image,
|
|
b: common_vendor.t(item.merchantName),
|
|
c: index,
|
|
d: "5f22de14-1-" + i0 + ",5f22de14-0",
|
|
e: common_vendor.p({
|
|
index
|
|
})
|
|
};
|
|
}),
|
|
c: common_vendor.o($options.change),
|
|
d: common_vendor.p({
|
|
column: 3,
|
|
borderColor: "transparent",
|
|
highlight: true
|
|
})
|
|
} : {
|
|
e: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
f: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
g: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
h: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
i: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
j: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
k: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
l: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
m: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
})
|
|
}, {
|
|
n: common_vendor.sr("login", "5f22de14-11"),
|
|
o: common_vendor.o($options.reload),
|
|
p: common_vendor.p({
|
|
logo: _ctx.logo
|
|
})
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-5f22de14"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/booking/merchant.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|