Files
gxtyzx-uniapp/dist/dev/mp-weixin/package/match/detail.js
T

402 lines
12 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const api_booking_match_index = require("../../api/booking/match/index.js");
const store_modules_car = require("../../store/modules/car.js");
store_modules_car.useCarStore();
const _sfc_main = {
data() {
return {
id: 0,
// 场馆信息
match: {},
// 场馆相册
photo: [],
isLogin: false,
disabled: true,
options: [
{
icon: "headphones",
text: "客服"
},
{
icon: "upload",
text: "分享"
}
],
buttonGroup: [
{
text: "立即报名",
backgroundColor: "linear-gradient(90deg, #FE6035, #EF1224)",
color: "#fff"
}
],
specList: [
{
id: 1,
type: 0,
name: "周五(7.5)第一场",
time: "2024-07-05 14:30 至 2024-07-05 15:30",
users: 1,
maxUsers: 30,
price: 0
},
{
id: 2,
type: 0,
name: "周五(7.5)第二场",
time: "2024-07-06 14:30 至 2024-07-06 15:30",
users: 3,
maxUsers: 30,
price: 0
},
{
id: 3,
type: 0,
name: "周五(7.5)第三场",
time: "2024-07-07 14:30 至 2024-07-07 15:30",
users: 8,
maxUsers: 30,
price: 0
}
],
selected: 0
};
},
onLoad(option) {
this.id = option.id;
this.reload();
},
onShow() {
if (common_vendor.index.getStorageSync("user_id") && common_vendor.index.getStorageSync("access_token")) {
this.isLogin = true;
}
},
onShareTimeline(res) {
if (res.from === "button") {
console.log("来自页面内分享按钮", res.target);
}
return {
title: this.match.title,
path: "/package/match/detail?id=" + this.match.matchId
};
},
onShareAppMessage(res) {
if (res.from === "button") {
console.log("来自页面内分享按钮", res.target);
}
return {
title: this.match.title,
path: "/package/match/detail?id=" + this.match.matchId
};
},
methods: {
async reload() {
const app = this;
Promise.all([app.getMatch()]).then((res) => {
const match = res[0];
app.match = match;
common_vendor.index.setNavigationBarTitle({
title: match.title
});
common_vendor.index.$uv.mpShare.title = match.title;
if (match.files) {
app.photo = JSON.parse(match.files);
}
});
},
getMatch() {
return new Promise((resolve, reject) => {
api_booking_match_index.getMatch(this.id).then((result) => {
resolve(result);
}).catch(reject);
});
},
onDisabled() {
this.disabled = !this.disabled;
},
navTo(url) {
common_vendor.index.navigateTo({
url
});
},
openBookingTel() {
this.$refs.popup.open("bottom");
},
closeBookingTel() {
this.$refs.popup.close();
},
callPhone(phone) {
common_vendor.index.makePhoneCall({
phoneNumber: phone
});
},
onSelect(item) {
this.selected = item.id;
},
mapTo() {
common_vendor.index.getLocation({
type: "gcj02",
//返回可以用于uni.openLocation的经纬度
success: function(res) {
console.log("返回可以用于uni.openLocation的经纬度: ", res);
const latitude = this.match.latitude;
const longitude = this.match.longitude;
common_vendor.index.openLocation({
latitude,
longitude,
success: function() {
console.log("success");
}
});
}
});
},
buttonClick() {
this.openBookingTel();
},
onClick(e) {
const index = e.index;
if (index == 1) {
common_vendor.index.$uv.mpShare = {
title: "啦啦啦",
// 默认为小程序名称,可自定义
path: "/package/match/detail?id=1"
// 默认为当前页面路径,一般无需修改,QQ小程序不支持
// 分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径。
// 支持PNG及JPG,默认为当前页面的截图
// imageUrl: ''
};
}
},
save() {
if (!this.disabled) {
common_vendor.index.showToast({
title: "请先阅读并同意订票协议",
icon: "none"
});
return false;
}
common_vendor.index.navigateTo({
url: "/package/match/checkout?id=" + this.id
});
}
}
};
if (!Array) {
const _easycom_uv_swiper2 = common_vendor.resolveComponent("uv-swiper");
const _easycom_uv_icon2 = common_vendor.resolveComponent("uv-icon");
const _easycom_uv_cell2 = common_vendor.resolveComponent("uv-cell");
const _easycom_uv_tags2 = common_vendor.resolveComponent("uv-tags");
const _easycom_uv_cell_group2 = common_vendor.resolveComponent("uv-cell-group");
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
const _easycom_uv_gap2 = common_vendor.resolveComponent("uv-gap");
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
(_easycom_uv_swiper2 + _easycom_uv_icon2 + _easycom_uv_cell2 + _easycom_uv_tags2 + _easycom_uv_cell_group2 + _easycom_uni_card2 + _easycom_uv_gap2 + _easycom_uv_button2 + _easycom_uni_popup2 + _easycom_ws_login2)();
}
const _easycom_uv_swiper = () => "../../uni_modules/uv-swiper/components/uv-swiper/uv-swiper.js";
const _easycom_uv_icon = () => "../../uni_modules/uv-icon/components/uv-icon/uv-icon.js";
const _easycom_uv_cell = () => "../../uni_modules/uv-cell/components/uv-cell/uv-cell.js";
const _easycom_uv_tags = () => "../../uni_modules/uv-tags/components/uv-tags/uv-tags.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_uv_gap = () => "../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.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_icon + _easycom_uv_cell + _easycom_uv_tags + _easycom_uv_cell_group + _easycom_uni_card + _easycom_uv_gap + _easycom_uv_button + _easycom_uni_popup + _easycom_ws_login)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
list: $data.photo,
indicator: true,
indicatorMode: "line",
circular: true,
height: "200",
radius: "0"
}),
b: common_vendor.t($data.match.title),
c: common_vendor.p({
size: "50rpx",
name: "map-fill",
color: "#5ac725"
}),
d: common_vendor.o(($event) => $options.mapTo($data.match)),
e: common_vendor.p({
title: "活动地点",
label: `${$data.match.address}`,
cellStyle: {
padding: "10px 5px"
}
}),
f: common_vendor.p({
title: "活动时间",
label: `2024-07-12 至 2024-08-12`,
cellStyle: {
padding: "10px 5px"
}
}),
g: common_vendor.p({
title: "报名时间",
label: `2024-07-12 至 2024-08-12`,
cellStyle: {
padding: "10px 5px"
}
}),
h: common_vendor.p({
title: "退款规则",
label: `${$data.match.refundRule}`,
cellStyle: {
padding: "10px 5px"
}
}),
i: common_vendor.t($data.match.users),
j: common_vendor.t($data.match.maxUsers),
k: common_vendor.p({
text: "未开始",
plain: true,
size: "mini",
type: "primary"
}),
l: common_vendor.p({
title: "已报名",
border: false,
cellStyle: {
padding: "10px 5px"
}
}),
m: common_vendor.p({
customStyle: {
backgroundColor: "#ffffff"
},
border: false
}),
n: common_vendor.p({
title: "活动信息",
border: false,
["is-shadow"]: false,
padding: 0
}),
o: $data.match.content,
p: common_vendor.p({
title: "活动介绍",
["is-shadow"]: false,
border: false,
padding: 0
}),
q: common_vendor.p({
height: "100"
}),
r: common_vendor.p({
icon: "server-fill"
}),
s: common_vendor.p({
icon: "share-square",
["open-type"]: "share"
}),
t: common_vendor.o(($event) => $options.navTo(`/package/match/checkout?id=${$data.match.matchId}`)),
v: common_vendor.p({
customStyle: {
background: "linear-gradient(to right, #ccff66, #008e04)",
borderRadius: "30px",
padding: "0 120rpx",
color: "#ffffff"
},
text: "立即报名"
}),
w: common_vendor.p({
cellStyle: {
padding: "10px 5px"
}
}),
x: common_vendor.f($data.specList, (item, index, i0) => {
return common_vendor.e({
a: "c7659a46-19-" + i0 + ",c7659a46-17",
b: item.type === 0
}, item.type === 0 ? {
c: "c7659a46-21-" + i0 + "," + ("c7659a46-20-" + i0),
d: common_vendor.p({
text: "个人",
size: "mini",
type: "primary"
})
} : {}, {
e: item.type === 1
}, item.type === 1 ? {
f: "c7659a46-22-" + i0 + "," + ("c7659a46-20-" + i0),
g: common_vendor.p({
text: "企业",
size: "mini",
type: "primary"
})
} : {}, {
h: common_vendor.t(item.name),
i: common_vendor.t(item.time),
j: common_vendor.t(item.users),
k: common_vendor.t(item.maxUsers),
l: item.price === 0
}, item.price === 0 ? {} : {
m: common_vendor.t(item.price)
}, {
n: common_vendor.o(($event) => $options.onSelect(item), index),
o: "c7659a46-20-" + i0 + ",c7659a46-17",
p: common_vendor.p({
border: false,
cellStyle: {
padding: "10px 5px",
borderRadius: "4px",
backgroundColor: item.id === $data.selected ? "rgb(254 242 242)" : "rgb(249 250 251)"
}
}),
q: index
});
}),
y: common_vendor.p({
height: "10"
}),
z: common_vendor.p({
height: "50"
}),
A: common_vendor.p({
customStyle: {
backgroundColor: "#ffffff"
},
border: false
}),
B: common_vendor.p({
["is-full"]: true,
border: false,
["is-shadow"]: false,
padding: 0
}),
C: common_vendor.o($options.save),
D: common_vendor.p({
disabled: $data.selected === 0,
customStyle: {
width: "240rpx",
background: "linear-gradient(90deg, #FE6035, #EF1224)",
borderRadius: "0",
color: "#ffffff",
border: "none",
padding: "0"
},
text: "下一步"
}),
E: common_vendor.sr("popup", "c7659a46-15"),
F: common_vendor.p({
type: "center"
}),
G: common_vendor.sr("login", "c7659a46-25"),
H: common_vendor.o($options.reload),
I: common_vendor.p({
logo: _ctx.logo
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c7659a46"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/match/detail.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);