已支付订单列表:where.payStatus = 1;
This commit is contained in:
+225
@@ -0,0 +1,225 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_booking_userCoupon_index = require("../../api/booking/userCoupon/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,
|
||||
status: 0
|
||||
},
|
||||
canReset: false,
|
||||
loadMore: "more",
|
||||
logo: "",
|
||||
items: ["待使用(0)", "已使用(0)", "已失效(0)"],
|
||||
list: [],
|
||||
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
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
this.openLogin();
|
||||
this.reload();
|
||||
},
|
||||
onShow(e) {
|
||||
this.openLogin();
|
||||
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;
|
||||
}
|
||||
common_vendor.index.showLoading({
|
||||
title: "数据读取中."
|
||||
});
|
||||
app.loadMore = "loading";
|
||||
api_booking_userCoupon_index.data().then((res) => {
|
||||
console.log("res: ", res);
|
||||
app.items[0] = `待使用(${res.toBeUsed})`;
|
||||
app.items[1] = `已使用(${res.used})`;
|
||||
app.items[2] = `已失效(${res.invalid})`;
|
||||
});
|
||||
api_booking_userCoupon_index.pageUserCoupon(where).then((res) => {
|
||||
const list = res.list.map((d) => {
|
||||
console.log(d);
|
||||
return d;
|
||||
});
|
||||
if (app.list.length < res.count) {
|
||||
console.log("11111: ", 11111);
|
||||
app.list = app.list.concat(list);
|
||||
app.canReset = true;
|
||||
app.loadMore = "no-more";
|
||||
} else {
|
||||
app.canReset = false;
|
||||
app.loadMore = "no-more";
|
||||
console.log("22222: ", 22222);
|
||||
}
|
||||
common_vendor.index.hideLoading();
|
||||
app.isRefresh = false;
|
||||
}).catch(() => {
|
||||
common_vendor.index.showToast({
|
||||
title: "请检查您的网络.",
|
||||
icon: "none"
|
||||
});
|
||||
common_vendor.index.hideLoading();
|
||||
app.isRefresh = false;
|
||||
});
|
||||
},
|
||||
onClickItem(e) {
|
||||
const app = this;
|
||||
const {
|
||||
where,
|
||||
userId
|
||||
} = this;
|
||||
const index = e.currentIndex;
|
||||
if (this.current !== e.currentIndex) {
|
||||
this.current = e.currentIndex;
|
||||
}
|
||||
if (userId == 0) {
|
||||
app.openLogin();
|
||||
return;
|
||||
}
|
||||
app.where.status = index;
|
||||
this.where.page = 1;
|
||||
this.list = [];
|
||||
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) {
|
||||
OrderApi.updateOrder({
|
||||
orderStatus: 2,
|
||||
orderId: item.orderId
|
||||
}).then((msg) => {
|
||||
common_vendor.index.showToast({
|
||||
title: msg,
|
||||
icon: "none"
|
||||
});
|
||||
item.orderStatus = 2;
|
||||
}).catch(() => {
|
||||
common_vendor.index.showToast({
|
||||
title: "请检查您的网络.",
|
||||
icon: "none"
|
||||
});
|
||||
common_vendor.index.hideLoading();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 弹出登录提示框
|
||||
async openLogin() {
|
||||
this.userId = common_vendor.index.getStorageSync("user_id");
|
||||
if (!this.userId) {
|
||||
this.$refs.login.open("bottom");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
|
||||
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
|
||||
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
|
||||
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
|
||||
(_easycom_uni_segmented_control2 + _easycom_uv_button2 + _easycom_uni_load_more2 + _easycom_ws_login2)();
|
||||
}
|
||||
const _easycom_uni_segmented_control = () => "../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js";
|
||||
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
|
||||
const _easycom_uni_load_more = () => "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
|
||||
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_segmented_control + _easycom_uv_button + _easycom_uni_load_more + _easycom_ws_login)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.o($options.onClickItem),
|
||||
b: common_vendor.p({
|
||||
current: $data.current,
|
||||
values: $data.items,
|
||||
styleType: $data.styleType,
|
||||
activeColor: $data.activeColor,
|
||||
inActiveColor: "#808080"
|
||||
}),
|
||||
c: common_vendor.f($data.list, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.o(_ctx.save, index),
|
||||
b: "5db01768-1-" + i0,
|
||||
c: index
|
||||
};
|
||||
}),
|
||||
d: common_vendor.p({
|
||||
size: "mini",
|
||||
customStyle: {
|
||||
background: "linear-gradient(to right, #70b915, #008e04)",
|
||||
color: "#ffffff",
|
||||
border: "none"
|
||||
},
|
||||
text: "去使用"
|
||||
}),
|
||||
e: $data.list.length > 0
|
||||
}, $data.list.length > 0 ? {
|
||||
f: common_vendor.p({
|
||||
status: $data.loadMore
|
||||
})
|
||||
} : {}, {
|
||||
g: common_vendor.sr("login", "5db01768-3"),
|
||||
h: common_vendor.o($options.reload),
|
||||
i: common_vendor.p({
|
||||
logo: $data.logo
|
||||
})
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/user/coupon.vue"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
Reference in New Issue
Block a user