268 lines
7.3 KiB
JavaScript
268 lines
7.3 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_booking_userCard_index = require("../../api/booking/userCard/index.js");
|
|
require("../../utils/request.js");
|
|
const utils_common = require("../../utils/common.js");
|
|
const _sfc_main = {
|
|
components: {},
|
|
data() {
|
|
return {
|
|
isRefresh: false,
|
|
isLogin: false,
|
|
userId: 0,
|
|
where: {
|
|
page: 1
|
|
},
|
|
canReset: false,
|
|
loadMore: "more",
|
|
logo: "",
|
|
items: ["月/年卡", "次卡", "充值卡"],
|
|
cardList: [],
|
|
styles: [
|
|
{
|
|
value: "button",
|
|
text: "按钮",
|
|
checked: true
|
|
},
|
|
{
|
|
value: "text",
|
|
text: "文字"
|
|
}
|
|
],
|
|
colors: ["#333333", "#4cd964", "#dd524d"],
|
|
current: 0,
|
|
colorIndex: 0,
|
|
activeColor: "#108001",
|
|
styleType: "text",
|
|
getWeek: utils_common.getWeek,
|
|
// 骨架屏
|
|
hideTools: true
|
|
};
|
|
},
|
|
onLoad(option) {
|
|
this.openLogin();
|
|
this.reload();
|
|
console.log("判断是否刷新: ", option);
|
|
if (option.isRefresh) {
|
|
this.isRefresh = true;
|
|
}
|
|
},
|
|
onShow(e) {
|
|
console.log("判断是否刷新: ", e);
|
|
this.openLogin();
|
|
if (this.isRefresh) {
|
|
this.reload();
|
|
}
|
|
},
|
|
// 触底函数
|
|
onReachBottom() {
|
|
const app = this;
|
|
const { where } = this;
|
|
if (app.canReset) {
|
|
app.where.page = ++where.page;
|
|
app.reload();
|
|
}
|
|
},
|
|
methods: {
|
|
reload() {
|
|
const app = this;
|
|
const { where, userId } = this;
|
|
if (userId == 0) {
|
|
app.openLogin();
|
|
return;
|
|
}
|
|
where.userId = userId;
|
|
where.payStatus = 1;
|
|
app.loadMore = "loading";
|
|
api_booking_userCard_index.pageUserCard(where).then((res) => {
|
|
console.log("res: ", res);
|
|
const list = res.list.map((d) => {
|
|
console.log(d);
|
|
return d;
|
|
});
|
|
if (app.cardList.length < res.count) {
|
|
app.cardList = app.cardList.concat(list);
|
|
app.canReset = true;
|
|
app.loadMore = "no-more";
|
|
} else {
|
|
app.canReset = false;
|
|
app.hideTools = false;
|
|
app.loadMore = "no-more";
|
|
}
|
|
app.isRefresh = false;
|
|
}).catch(() => {
|
|
common_vendor.index.showToast({
|
|
title: "请检查您的网络.",
|
|
icon: "none"
|
|
});
|
|
app.hideTools = false;
|
|
app.isRefresh = false;
|
|
});
|
|
},
|
|
onClickItem(e, text) {
|
|
const { where, userId } = this;
|
|
const index = e.currentIndex;
|
|
if (this.current !== e.currentIndex) {
|
|
this.current = e.currentIndex;
|
|
}
|
|
if (index == 0) {
|
|
where.cardCode = "月/年卡";
|
|
}
|
|
if (index == 1) {
|
|
where.cardCode = "次卡";
|
|
}
|
|
if (index == 2) {
|
|
where.cardCode = "充值卡";
|
|
}
|
|
this.where.page = 1;
|
|
this.cardList = [];
|
|
this.hideTools = true;
|
|
this.reload();
|
|
},
|
|
openUrl(url) {
|
|
common_vendor.index.navigateTo({
|
|
url
|
|
});
|
|
},
|
|
toPay(orderId) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/package/booking/confirm?id=" + orderId
|
|
});
|
|
},
|
|
closeOrder(item) {
|
|
common_vendor.index.showModal({
|
|
title: "确定取消此订单?",
|
|
success(o) {
|
|
if (o.confirm) ;
|
|
}
|
|
});
|
|
},
|
|
// 弹出登录提示框
|
|
async openLogin() {
|
|
this.userId = common_vendor.index.getStorageSync("user_id");
|
|
if (!this.userId) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uv_avatar2 = common_vendor.resolveComponent("uv-avatar");
|
|
const _easycom_uv_skeleton2 = common_vendor.resolveComponent("uv-skeleton");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
|
|
const _easycom_uv_empty2 = common_vendor.resolveComponent("uv-empty");
|
|
(_easycom_uv_avatar2 + _easycom_uv_skeleton2 + _easycom_uni_card2 + _easycom_ws_login2 + _easycom_uv_empty2)();
|
|
}
|
|
const _easycom_uv_avatar = () => "../../uni_modules/uv-avatar/components/uv-avatar/uv-avatar.js";
|
|
const _easycom_uv_skeleton = () => "../../uni_modules/uv-skeleton/components/uv-skeleton/uv-skeleton.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";
|
|
const _easycom_uv_empty = () => "../../uni_modules/uv-empty/components/uv-empty/uv-empty.js";
|
|
if (!Math) {
|
|
(_easycom_uv_avatar + _easycom_uv_skeleton + _easycom_uni_card + _easycom_ws_login + _easycom_uv_empty)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: !$data.hideTools || $data.cardList.length > 0
|
|
}, !$data.hideTools || $data.cardList.length > 0 ? {
|
|
b: common_vendor.f($data.cardList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: "75a1ddb6-0-" + i0,
|
|
b: common_vendor.p({
|
|
src: item.merchantAvatar,
|
|
size: "36"
|
|
}),
|
|
c: common_vendor.t(item.name),
|
|
d: item.type == 2
|
|
}, item.type == 2 ? {
|
|
e: common_vendor.t(item.number)
|
|
} : {}, {
|
|
f: item.type == 1 || item.type == 3 || item.type == 5
|
|
}, item.type == 1 || item.type == 3 || item.type == 5 ? {
|
|
g: common_vendor.t(item.remainingMoney)
|
|
} : {}, {
|
|
h: index,
|
|
i: common_vendor.o(($event) => $options.openUrl("/package/user/card-detail?cardId=" + item.id), index),
|
|
j: `url(${item.image}) no-repeat center center`
|
|
});
|
|
})
|
|
} : {
|
|
c: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
d: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
e: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
f: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
g: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
h: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
i: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
j: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
k: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
l: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
m: common_vendor.p({
|
|
rows: "2",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
n: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
})
|
|
}, {
|
|
o: common_vendor.sr("login", "75a1ddb6-13"),
|
|
p: common_vendor.o($options.reload),
|
|
q: common_vendor.p({
|
|
logo: $data.logo
|
|
}),
|
|
r: !$data.hideTools && $data.cardList.length == 0
|
|
}, !$data.hideTools && $data.cardList.length == 0 ? {
|
|
s: common_vendor.p({
|
|
mode: "list",
|
|
icon: "https://cdn.uviewui.com/uview/empty/list.png"
|
|
})
|
|
} : {});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/user/card.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|