381 lines
12 KiB
JavaScript
381 lines
12 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_shop_order_index = require("../../api/shop/order/index.js");
|
|
const api_shop_wechatDeposit_index = require("../../api/shop/wechatDeposit/index.js");
|
|
const utils_common = require("../../utils/common.js");
|
|
const _sfc_main = {
|
|
components: {},
|
|
data() {
|
|
return {
|
|
isRefresh: false,
|
|
isLogin: false,
|
|
userId: 0,
|
|
where: {
|
|
page: 1,
|
|
type: 1,
|
|
// 0商城订单 1场地预定
|
|
sceneType: "showOrderInfo"
|
|
// 查询订单附加场地信息
|
|
},
|
|
canReset: false,
|
|
loadMore: "more",
|
|
logo: "",
|
|
items: ["全部订单", "未支付", "已支付", "已完成", "押金"],
|
|
orderList: [],
|
|
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();
|
|
},
|
|
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;
|
|
}
|
|
where.userId = userId;
|
|
app.loadMore = "loading";
|
|
api_shop_order_index.pageOrder(where).then((res) => {
|
|
const list = res.list.map((d) => {
|
|
console.log(d);
|
|
return d;
|
|
});
|
|
if (app.orderList.length < res.count) {
|
|
console.log("11111: ", 11111);
|
|
app.orderList = app.orderList.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;
|
|
}
|
|
if (index === 0) {
|
|
where.payStatus = void 0;
|
|
where.orderStatus = void 0;
|
|
}
|
|
if (index === 1) {
|
|
where.payStatus = 0;
|
|
where.orderStatus = void 0;
|
|
}
|
|
if (index === 2) {
|
|
where.payStatus = 1;
|
|
}
|
|
if (index === 3) {
|
|
where.payStatus = 1;
|
|
where.orderStatus = 1;
|
|
}
|
|
if (index === 4) {
|
|
api_shop_wechatDeposit_index.pageWechatDeposit({
|
|
uid: common_vendor.index.getStorageSync("user_id")
|
|
}).then((res) => {
|
|
app.orderList = res.list;
|
|
if (res.count == 0) {
|
|
app.loadMore = "no-more";
|
|
}
|
|
common_vendor.index.hideLoading();
|
|
});
|
|
return false;
|
|
}
|
|
this.where.page = 1;
|
|
this.orderList = [];
|
|
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) {
|
|
api_shop_order_index.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;
|
|
}
|
|
},
|
|
// 申请开票
|
|
onInvoice(id) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/package/user/invoice?id=" + id
|
|
});
|
|
},
|
|
showInvoice(id) {
|
|
common_vendor.index.navigateTo({
|
|
url: `/package/user/invoice-show?id=${id}`
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
|
|
const _easycom_uv_avatar2 = common_vendor.resolveComponent("uv-avatar");
|
|
const _easycom_uv_count_down2 = common_vendor.resolveComponent("uv-count-down");
|
|
const _easycom_uv_cell2 = common_vendor.resolveComponent("uv-cell");
|
|
const _easycom_uv_cell_group2 = common_vendor.resolveComponent("uv-cell-group");
|
|
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
|
const _easycom_uv_skeleton2 = common_vendor.resolveComponent("uv-skeleton");
|
|
const _easycom_uv_gap2 = common_vendor.resolveComponent("uv-gap");
|
|
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_avatar2 + _easycom_uv_count_down2 + _easycom_uv_cell2 + _easycom_uv_cell_group2 + _easycom_uni_card2 + _easycom_uv_skeleton2 + _easycom_uv_gap2 + _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_avatar = () => "../../uni_modules/uv-avatar/components/uv-avatar/uv-avatar.js";
|
|
const _easycom_uv_count_down = () => "../../uni_modules/uv-count-down/components/uv-count-down/uv-count-down.js";
|
|
const _easycom_uv_cell = () => "../../uni_modules/uv-cell/components/uv-cell/uv-cell.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_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_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_avatar + _easycom_uv_count_down + _easycom_uv_cell + _easycom_uv_cell_group + _easycom_uni_card + _easycom_uv_skeleton + _easycom_uv_gap + _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: $data.orderList.length > 0
|
|
}, $data.orderList.length > 0 ? {
|
|
d: common_vendor.f($data.orderList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: "1317716d-2-" + i0 + "," + ("1317716d-1-" + i0),
|
|
b: common_vendor.p({
|
|
src: item.merchantAvatar,
|
|
size: "24"
|
|
}),
|
|
c: common_vendor.t(item.merchantName),
|
|
d: item.orderStatus == 2
|
|
}, item.orderStatus == 2 ? {} : item.orderStatus == 1 ? {} : common_vendor.e({
|
|
f: item.payStatus == 1
|
|
}, item.payStatus == 1 ? {} : {}, {
|
|
g: item.payStatus == 0
|
|
}, item.payStatus == 0 ? {
|
|
h: "1317716d-3-" + i0 + "," + ("1317716d-1-" + i0),
|
|
i: common_vendor.p({
|
|
time: item.timestamp,
|
|
format: "mm:ss"
|
|
})
|
|
} : {}), {
|
|
e: item.orderStatus == 1,
|
|
j: common_vendor.f(item.orderInfo, (sub, subIndex, i1) => {
|
|
return {
|
|
a: common_vendor.o(($event) => $options.openUrl(`/package/order/detail?id=${item.orderId}`), subIndex),
|
|
b: "1317716d-5-" + i0 + "-" + i1 + "," + ("1317716d-4-" + i0),
|
|
c: common_vendor.p({
|
|
title: `${sub.fieldName}`,
|
|
label: `${sub.comments}`,
|
|
cellStyle: {
|
|
padding: "0",
|
|
paddingBottom: "5px"
|
|
},
|
|
border: false
|
|
}),
|
|
d: subIndex
|
|
};
|
|
}),
|
|
k: "1317716d-4-" + i0 + "," + ("1317716d-1-" + i0),
|
|
l: common_vendor.t(item.totalPrice),
|
|
m: common_vendor.t(item.payPrice),
|
|
n: item.payStatus == 0 && item.orderStatus == 0
|
|
}, item.payStatus == 0 && item.orderStatus == 0 ? {
|
|
o: common_vendor.o(($event) => $options.closeOrder(item), index),
|
|
p: common_vendor.o(($event) => $options.toPay(item.orderId), index)
|
|
} : {}, {
|
|
q: item.payStatus == 1
|
|
}, item.payStatus == 1 ? common_vendor.e({
|
|
r: item.isInvoice == 0
|
|
}, item.isInvoice == 0 ? {
|
|
s: common_vendor.o(($event) => $options.onInvoice(item.orderId), index)
|
|
} : {
|
|
t: common_vendor.o(($event) => $options.showInvoice(item.orderId), index)
|
|
}) : {}, {
|
|
v: "1317716d-1-" + i0,
|
|
w: index
|
|
});
|
|
}),
|
|
e: common_vendor.p({
|
|
customStyle: {
|
|
backgroundColor: "#ffffff"
|
|
},
|
|
border: false
|
|
}),
|
|
f: common_vendor.p({
|
|
border: false,
|
|
["is-shadow"]: false,
|
|
padding: 0
|
|
})
|
|
} : {}, {
|
|
g: $data.orderList.length == 0 && $data.loadMore != "no-more"
|
|
}, $data.orderList.length == 0 && $data.loadMore != "no-more" ? {
|
|
h: common_vendor.p({
|
|
rows: "3",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
i: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
j: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
k: common_vendor.p({
|
|
rows: "3",
|
|
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.p({
|
|
rows: "3",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
o: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
p: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
}),
|
|
q: common_vendor.p({
|
|
rows: "3",
|
|
avatar: true,
|
|
loading: $data.hideTools,
|
|
title: false
|
|
}),
|
|
r: common_vendor.p({
|
|
height: "16"
|
|
}),
|
|
s: common_vendor.p({
|
|
border: false,
|
|
padding: "18px 6px"
|
|
})
|
|
} : {}, {
|
|
t: $data.orderList.length > 0
|
|
}, $data.orderList.length > 0 ? {
|
|
v: common_vendor.p({
|
|
status: $data.loadMore
|
|
})
|
|
} : {}, {
|
|
w: common_vendor.sr("login", "1317716d-19"),
|
|
x: common_vendor.o($options.reload),
|
|
y: 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/pages/order/order.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|