已支付订单列表:where.payStatus = 1;
This commit is contained in:
+303
@@ -0,0 +1,303 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_booking_userCard_index = require("../../api/booking/userCard/index.js");
|
||||
const api_shop_order_index = require("../../api/shop/order/index.js");
|
||||
require("../../utils/request.js");
|
||||
const utils_common = require("../../utils/common.js");
|
||||
const store_modules_car = require("../../store/modules/car.js");
|
||||
const store_modules_user = require("../../store/modules/user.js");
|
||||
const userStore = store_modules_user.useUserStore();
|
||||
const carStore = store_modules_car.useCarStore();
|
||||
const { goodsList, totalPrice, carNum, merchantId, merchantName, merchantCode, type, dateTime } = common_vendor.storeToRefs(carStore);
|
||||
const cardType = ["年卡", "次卡", "月卡", "IC卡", "充值卡"];
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
id: 0,
|
||||
goodsId: 0,
|
||||
userInfo: {},
|
||||
form: {},
|
||||
address: {},
|
||||
addressList: [],
|
||||
week: 0,
|
||||
cardType,
|
||||
goodsList,
|
||||
// 订单总金额
|
||||
totalPrice,
|
||||
reducePrice: 0,
|
||||
merchantId,
|
||||
merchantName,
|
||||
merchantCode,
|
||||
getWeek: utils_common.getWeek,
|
||||
payType: 1,
|
||||
isLogin: false,
|
||||
disabled: false
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.cardId;
|
||||
this.reload();
|
||||
},
|
||||
onShow() {
|
||||
if (common_vendor.index.getStorageSync("user_id") && common_vendor.index.getStorageSync("access_token")) {
|
||||
this.isLogin = true;
|
||||
}
|
||||
this.openLogin();
|
||||
},
|
||||
methods: {
|
||||
async reload() {
|
||||
const app = this;
|
||||
const { id } = this;
|
||||
const userInfo = await userStore.fetchUserInfo();
|
||||
app.userInfo = userInfo;
|
||||
api_booking_userCard_index.getUserCard(id).then((data) => {
|
||||
app.form = data;
|
||||
});
|
||||
},
|
||||
onDisabled() {
|
||||
this.disabled = !this.disabled;
|
||||
},
|
||||
navTo(url) {
|
||||
common_vendor.index.navigateTo({
|
||||
url
|
||||
});
|
||||
},
|
||||
openUrl(url) {
|
||||
if (!this.isLogin) {
|
||||
this.$refs.login.open("bottom");
|
||||
return false;
|
||||
} else {
|
||||
common_vendor.index.navigateTo({
|
||||
url
|
||||
});
|
||||
}
|
||||
},
|
||||
onAddress(item) {
|
||||
this.address = item;
|
||||
this.$refs.addForm.close();
|
||||
},
|
||||
// 切换支付方式
|
||||
onPayType(index) {
|
||||
console.log("e: ", index);
|
||||
this.payType = index;
|
||||
},
|
||||
openQrCode() {
|
||||
this.$refs.addForm.open("center");
|
||||
},
|
||||
// 弹出登录提示框
|
||||
openLogin() {
|
||||
if (!this.isLogin) {
|
||||
this.$refs.login.open("bottom");
|
||||
return false;
|
||||
}
|
||||
},
|
||||
save() {
|
||||
if (!this.disabled) {
|
||||
common_vendor.index.showToast({
|
||||
title: "请先阅读并同意服务协议",
|
||||
icon: "none"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
common_vendor.index.showLoading({
|
||||
title: "订单提交中."
|
||||
});
|
||||
const app = this;
|
||||
const { form, payType } = this;
|
||||
api_shop_order_index.addOrder({
|
||||
type: 2,
|
||||
// 0商城订单 1预定订单 2会员卡订单
|
||||
cardId: form.cardId,
|
||||
merchantId: form.merchantId,
|
||||
merchantName: form.merchantName,
|
||||
totalPrice: form.price,
|
||||
payPrice: form.price,
|
||||
comments: form.cardName,
|
||||
payType
|
||||
}).then((data) => {
|
||||
const orderInfo = data;
|
||||
if (payType == 1) {
|
||||
common_vendor.index.requestPayment({
|
||||
provider: orderInfo.provider,
|
||||
// 服务提供商
|
||||
timeStamp: orderInfo.timeStamp,
|
||||
// 时间戳
|
||||
nonceStr: orderInfo.nonceStr,
|
||||
// 随机字符串
|
||||
package: orderInfo.package,
|
||||
signType: orderInfo.signType,
|
||||
// 签名算法
|
||||
paySign: orderInfo.paySign,
|
||||
// 签名
|
||||
success: function(res) {
|
||||
common_vendor.index.showToast({
|
||||
title: "支付成功",
|
||||
icon: "success"
|
||||
});
|
||||
setTimeout(function() {
|
||||
app.disabled = false;
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/package/user/card"
|
||||
});
|
||||
}, 500);
|
||||
},
|
||||
fail: function(err) {
|
||||
console.log("支付失败", err);
|
||||
app.disabled = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (payType == 0) {
|
||||
if (orderInfo) {
|
||||
common_vendor.index.showToast({
|
||||
title: "支付成功",
|
||||
icon: "success"
|
||||
});
|
||||
setTimeout(function() {
|
||||
app.disabled = false;
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/package/user/card"
|
||||
});
|
||||
}, 500);
|
||||
return;
|
||||
}
|
||||
if (!orderInfo) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "支付失败",
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
}
|
||||
common_vendor.index.hideLoading();
|
||||
}).catch((res) => {
|
||||
common_vendor.index.showToast({
|
||||
title: res.message || "请检查您的网络.",
|
||||
icon: "none"
|
||||
});
|
||||
common_vendor.index.hideLoading();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uv_avatar2 = common_vendor.resolveComponent("uv-avatar");
|
||||
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
|
||||
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
|
||||
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
|
||||
const _easycom_uni_list_item2 = common_vendor.resolveComponent("uni-list-item");
|
||||
const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list");
|
||||
const _easycom_uv_qrcode2 = common_vendor.resolveComponent("uv-qrcode");
|
||||
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
||||
(_easycom_uv_avatar2 + _easycom_ws_login2 + _easycom_uni_card2 + _easycom_uv_button2 + _easycom_uni_list_item2 + _easycom_uni_list2 + _easycom_uv_qrcode2 + _easycom_uni_popup2)();
|
||||
}
|
||||
const _easycom_uv_avatar = () => "../../uni_modules/uv-avatar/components/uv-avatar/uv-avatar.js";
|
||||
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
|
||||
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
|
||||
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
|
||||
const _easycom_uni_list_item = () => "../../uni_modules/uni-list/components/uni-list-item/uni-list-item.js";
|
||||
const _easycom_uni_list = () => "../../uni_modules/uni-list/components/uni-list/uni-list.js";
|
||||
const _easycom_uv_qrcode = () => "../../uni_modules/uv-qrcode/components/uv-qrcode/uv-qrcode.js";
|
||||
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_uv_avatar + _easycom_ws_login + _easycom_uni_card + _easycom_uv_button + _easycom_uni_list_item + _easycom_uni_list + _easycom_uv_qrcode + _easycom_uni_popup)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.t($data.merchantId),
|
||||
b: common_vendor.t($data.merchantCode),
|
||||
c: common_vendor.t($data.merchantName),
|
||||
d: common_vendor.t(_ctx.dateTime),
|
||||
e: common_vendor.t($data.week),
|
||||
f: common_vendor.t($data.totalPrice),
|
||||
g: common_vendor.t(_ctx.type),
|
||||
h: common_vendor.t($data.goodsList),
|
||||
i: common_vendor.p({
|
||||
src: $data.form.merchantAvatar,
|
||||
size: "42"
|
||||
}),
|
||||
j: common_vendor.t($data.form.name),
|
||||
k: common_vendor.t($data.cardType[$data.form.type]),
|
||||
l: common_vendor.p({
|
||||
src: "../../static/qrcode.png",
|
||||
size: "30",
|
||||
shape: "square"
|
||||
}),
|
||||
m: common_vendor.o((...args) => $options.openQrCode && $options.openQrCode(...args)),
|
||||
n: common_vendor.t($data.form.cardNum),
|
||||
o: `url(${$data.form.image}) no-repeat center center`,
|
||||
p: common_vendor.sr("login", "7efd7713-2"),
|
||||
q: common_vendor.o($options.reload),
|
||||
r: common_vendor.p({
|
||||
logo: _ctx.logo
|
||||
}),
|
||||
s: common_vendor.t($data.form.remainingMoney || 0),
|
||||
t: common_vendor.t($data.form.num || 0),
|
||||
v: common_vendor.t($data.form.discount || 0),
|
||||
w: common_vendor.p({
|
||||
border: false,
|
||||
["is-shadow"]: false,
|
||||
padding: "12px 0"
|
||||
}),
|
||||
x: common_vendor.o(($event) => $options.navTo(`/package/user/card-detail-merchant?sid=${$data.form.sid}`)),
|
||||
y: common_vendor.p({
|
||||
customStyle: {
|
||||
width: "300rpx",
|
||||
borderRadius: "30px",
|
||||
color: "#3C8618"
|
||||
},
|
||||
text: "去使用"
|
||||
}),
|
||||
z: common_vendor.o(($event) => $options.navTo(`/package/user/card-detail-about?id=${$data.form.id}`)),
|
||||
A: common_vendor.p({
|
||||
link: true
|
||||
}),
|
||||
B: common_vendor.o(($event) => $options.navTo(`/package/user/card-detail-merchant?sid=${$data.form.sid}`)),
|
||||
C: common_vendor.p({
|
||||
link: true
|
||||
}),
|
||||
D: common_vendor.o(($event) => $options.navTo(`/package/user/card-detail-record?id=${$data.form.id}`)),
|
||||
E: common_vendor.p({
|
||||
link: true
|
||||
}),
|
||||
F: common_vendor.p({
|
||||
border: false
|
||||
}),
|
||||
G: common_vendor.p({
|
||||
border: false,
|
||||
["is-shadow"]: false,
|
||||
padding: 0
|
||||
}),
|
||||
H: common_vendor.sr("qrcode", "7efd7713-12,7efd7713-11"),
|
||||
I: common_vendor.p({
|
||||
size: "390rpx",
|
||||
options: {
|
||||
data: $data.form.cardNum,
|
||||
foregroundImageSrc: $data.form.merchantAvatar,
|
||||
margin: 10,
|
||||
foregroundImagePadding: 4,
|
||||
foregroundImageHeight: 30,
|
||||
foregroundImageWidth: 30,
|
||||
foregroundImageBorderRadius: 4
|
||||
},
|
||||
value: $data.form.cardNum
|
||||
}),
|
||||
J: common_vendor.t($data.form.cardNum),
|
||||
K: common_vendor.p({
|
||||
border: false,
|
||||
["is-shadow"]: false,
|
||||
padding: 0
|
||||
}),
|
||||
L: common_vendor.sr("addForm", "7efd7713-10"),
|
||||
M: common_vendor.p({
|
||||
type: "center",
|
||||
["border-radius"]: "10px 10px 0 0"
|
||||
}),
|
||||
N: common_vendor.sr("login", "7efd7713-13"),
|
||||
O: common_vendor.o($options.reload),
|
||||
P: common_vendor.p({
|
||||
logo: _ctx.logo
|
||||
})
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7efd7713"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/user/card-detail.vue"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
Reference in New Issue
Block a user