258 lines
8.4 KiB
JavaScript
258 lines
8.4 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_shop_merchant_index = require("../../api/shop/merchant/index.js");
|
|
const store_modules_car = require("../../store/modules/car.js");
|
|
const carStore = store_modules_car.useCarStore();
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
id: 0,
|
|
// 场馆信息
|
|
merchant: {},
|
|
// 场馆相册
|
|
photo: [],
|
|
isLogin: false,
|
|
disabled: true
|
|
};
|
|
},
|
|
onLoad(option) {
|
|
this.id = option.id;
|
|
carStore.merchantId = option.id;
|
|
this.reload();
|
|
},
|
|
onShow() {
|
|
if (common_vendor.index.getStorageSync("user_id") && common_vendor.index.getStorageSync("access_token")) {
|
|
this.isLogin = true;
|
|
}
|
|
},
|
|
methods: {
|
|
async reload() {
|
|
const app = this;
|
|
Promise.all([app.getMerchant()]).then((res) => {
|
|
const merchant = res[0];
|
|
app.merchant = merchant;
|
|
common_vendor.index.setNavigationBarTitle({
|
|
title: merchant.merchantName
|
|
});
|
|
if (merchant.files) {
|
|
app.photo = JSON.parse(merchant.files);
|
|
}
|
|
carStore.setMerchant(merchant);
|
|
carStore.merchantId = merchant.merchantId;
|
|
carStore.merchantName = merchant.merchantName;
|
|
carStore.merchantCode = merchant.merchantCode;
|
|
});
|
|
},
|
|
getMerchant() {
|
|
return new Promise((resolve, reject) => {
|
|
api_shop_merchant_index.getMerchant(this.id).then((result) => {
|
|
resolve(result);
|
|
}).catch(reject);
|
|
});
|
|
},
|
|
onDisabled() {
|
|
this.disabled = !this.disabled;
|
|
},
|
|
navTo(url) {
|
|
common_vendor.index.navigateTo({
|
|
url
|
|
});
|
|
},
|
|
mapTo(item) {
|
|
console.log("item: ", item.lngAndLat);
|
|
const arr = item.lngAndLat.split(",");
|
|
console.log("arr: ", arr);
|
|
common_vendor.index.openLocation({
|
|
latitude: parseFloat(arr[1]),
|
|
longitude: parseFloat(arr[0]),
|
|
success: function() {
|
|
console.log("success");
|
|
}
|
|
});
|
|
},
|
|
openBookingTel() {
|
|
this.$refs.popup.open("center");
|
|
},
|
|
closeBookingTel() {
|
|
this.$refs.popup.close();
|
|
},
|
|
callPhone(phone) {
|
|
common_vendor.index.makePhoneCall({
|
|
phoneNumber: phone
|
|
});
|
|
},
|
|
onMap() {
|
|
common_vendor.index.getLocation({
|
|
type: "gcj02",
|
|
//返回可以用于uni.openLocation的经纬度
|
|
success: function(res) {
|
|
console.log("返回可以用于uni.openLocation的经纬度: ", res);
|
|
const latitude = this.merchant.latitude;
|
|
const longitude = this.merchant.longitude;
|
|
common_vendor.index.openLocation({
|
|
latitude,
|
|
longitude,
|
|
success: function() {
|
|
console.log("success");
|
|
}
|
|
});
|
|
}
|
|
});
|
|
},
|
|
save() {
|
|
if (!this.disabled) {
|
|
common_vendor.index.showToast({
|
|
title: "请先阅读并同意订票协议",
|
|
icon: "none"
|
|
});
|
|
return false;
|
|
}
|
|
common_vendor.index.navigateTo({
|
|
url: "/package/booking/checkout?id=" + this.id
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uv_swiper2 = common_vendor.resolveComponent("uv-swiper");
|
|
const _easycom_uv_cell2 = common_vendor.resolveComponent("uv-cell");
|
|
const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon");
|
|
const _easycom_uv_cell_group2 = common_vendor.resolveComponent("uv-cell-group");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
|
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
|
|
const _easycom_uv_gap2 = common_vendor.resolveComponent("uv-gap");
|
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
|
|
(_easycom_uv_swiper2 + _easycom_uv_cell2 + _easycom_uv_icon2 + _easycom_uv_cell_group2 + _easycom_uni_card2 + _easycom_uni_icons2 + _easycom_uv_button2 + _easycom_uv_gap2 + _easycom_uni_popup2 + _easycom_ws_login2)();
|
|
}
|
|
const _easycom_uv_swiper = () => "../../uni_modules/uv-swiper/components/uv-swiper/uv-swiper.js";
|
|
const _easycom_uv_cell = () => "../../uni_modules/uv-cell/components/uv-cell/uv-cell.js";
|
|
const _easycom_uv_icon = () => "../../uni_modules/uv-icon/components/uv-icon/uv-icon.js";
|
|
const _easycom_uv_cell_group = () => "../../uni_modules/uv-cell/components/uv-cell-group/uv-cell-group.js";
|
|
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
|
|
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
|
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
|
|
const _easycom_uv_gap = () => "../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
|
|
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
|
|
if (!Math) {
|
|
(_easycom_uv_swiper + _easycom_uv_cell + _easycom_uv_icon + _easycom_uv_cell_group + _easycom_uni_card + _easycom_uni_icons + _easycom_uv_button + _easycom_uv_gap + _easycom_uni_popup + _easycom_ws_login)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: common_vendor.p({
|
|
list: $data.photo,
|
|
indicator: true,
|
|
indicatorMode: "line",
|
|
circular: true,
|
|
height: "200",
|
|
radius: "0"
|
|
}),
|
|
b: common_vendor.p({
|
|
title: "营业时间",
|
|
label: $data.merchant.businessTime,
|
|
cellStyle: {
|
|
padding: "10px 5px"
|
|
}
|
|
}),
|
|
c: common_vendor.p({
|
|
title: "场馆地址",
|
|
label: $data.merchant.address,
|
|
cellStyle: {
|
|
padding: "10px 5px"
|
|
}
|
|
}),
|
|
d: common_vendor.p({
|
|
size: "50rpx",
|
|
name: "map-fill",
|
|
color: "#5ac725"
|
|
}),
|
|
e: common_vendor.o(($event) => $options.mapTo($data.merchant)),
|
|
f: common_vendor.p({
|
|
title: "场馆位置",
|
|
label: `距离【${$data.merchant.merchantName}】3.8公里·约7分钟`,
|
|
isLink: true,
|
|
cellStyle: {
|
|
padding: "10px 5px"
|
|
}
|
|
}),
|
|
g: common_vendor.o(($event) => $options.callPhone($data.merchant.phone)),
|
|
h: common_vendor.p({
|
|
title: "服务前台电话",
|
|
label: $data.merchant.phone,
|
|
border: false,
|
|
cellStyle: {
|
|
padding: "10px 5px"
|
|
}
|
|
}),
|
|
i: common_vendor.p({
|
|
customStyle: {
|
|
backgroundColor: "#ffffff"
|
|
},
|
|
border: false
|
|
}),
|
|
j: common_vendor.p({
|
|
title: $data.merchant.merchantName,
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: 0
|
|
}),
|
|
k: $data.merchant.content,
|
|
l: common_vendor.p({
|
|
title: "场地介绍",
|
|
["is-shadow"]: false,
|
|
border: false,
|
|
padding: 0
|
|
}),
|
|
m: !$data.disabled
|
|
}, !$data.disabled ? {
|
|
n: common_vendor.o($options.onDisabled),
|
|
o: common_vendor.p({
|
|
type: "circle",
|
|
size: "20",
|
|
color: "#a4a5a7"
|
|
})
|
|
} : {
|
|
p: common_vendor.o($options.onDisabled),
|
|
q: common_vendor.p({
|
|
type: "checkbox",
|
|
size: "20",
|
|
color: "#11a954"
|
|
})
|
|
}, {
|
|
r: common_vendor.o(($event) => $options.navTo("/package/article/detail?articleId=503")),
|
|
s: common_vendor.o((...args) => $options.onDisabled && $options.onDisabled(...args)),
|
|
t: common_vendor.o($options.save),
|
|
v: common_vendor.p({
|
|
customStyle: {
|
|
background: "linear-gradient(to right, #ccff66, #008e04)",
|
|
borderRadius: "30px",
|
|
color: "#ffffff"
|
|
},
|
|
text: "预定场地"
|
|
}),
|
|
w: common_vendor.p({
|
|
height: "50"
|
|
}),
|
|
x: common_vendor.o((...args) => $options.openBookingTel && $options.openBookingTel(...args)),
|
|
y: common_vendor.p({
|
|
name: "close-circle",
|
|
color: "#ffffff",
|
|
size: "30"
|
|
}),
|
|
z: common_vendor.o((...args) => $options.closeBookingTel && $options.closeBookingTel(...args)),
|
|
A: common_vendor.sr("popup", "dfe028cf-13"),
|
|
B: common_vendor.p({
|
|
type: "center"
|
|
}),
|
|
C: common_vendor.sr("login", "dfe028cf-15"),
|
|
D: common_vendor.o($options.reload),
|
|
E: common_vendor.p({
|
|
logo: _ctx.logo
|
|
})
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-dfe028cf"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/booking/index.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|