重构会员卡数据库
This commit is contained in:
@@ -277,6 +277,8 @@ export default {
|
||||
}).then((data) => {
|
||||
if (data) {
|
||||
app.hideUser = false;
|
||||
app.userInfo.money = data.money;
|
||||
console.log('money',app.userInfo.money)
|
||||
app.userInfo.ouid = data.userId;
|
||||
app.userInfo = Object.assign({}, app.userInfo, data);
|
||||
}
|
||||
@@ -321,12 +323,13 @@ export default {
|
||||
Promise.all([app.getUserCard(), app.getPayment()]).then((res) => {
|
||||
const userCard = res[0];
|
||||
const payment = res[1];
|
||||
|
||||
// 当前可用会员卡
|
||||
app.userCard = userCard;
|
||||
// 支付方式列表
|
||||
app.payment = payment.map((d) => {
|
||||
if (d.type == 0) {
|
||||
d.name = `${d.name} (余额¥${app.userInfo.balance})`;
|
||||
d.name = `${d.name} (余额¥${app.userInfo.money || 0})`;
|
||||
}
|
||||
if (d.type == 2 && userCard) {
|
||||
d.name = `${userCard.name}(¥${userCard.remainingMoney})`;
|
||||
@@ -381,10 +384,12 @@ export default {
|
||||
// 读取可用的会员卡
|
||||
async getUserCard() {
|
||||
const app = this;
|
||||
const { payPrice } = this
|
||||
return new Promise((resolve, reject) => {
|
||||
const { merchantId } = this;
|
||||
UserCardApi.findUseCard({
|
||||
sid: merchantId
|
||||
sid: merchantId,
|
||||
payPrice
|
||||
})
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
@@ -590,7 +595,7 @@ export default {
|
||||
const orderInfo = data;
|
||||
|
||||
// 调起微信支付
|
||||
if (form.payType == 1) {
|
||||
if (form.payType === 1) {
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.requestPayment({
|
||||
provider: orderInfo.provider, // 服务提供商
|
||||
@@ -636,7 +641,7 @@ export default {
|
||||
// #endif
|
||||
}
|
||||
// 使用余额支付
|
||||
if (form.payType == 0) {
|
||||
if (form.payType === 0) {
|
||||
if (!orderInfo) {
|
||||
return uni.showToast({
|
||||
title: '支付失败',
|
||||
@@ -664,7 +669,7 @@ export default {
|
||||
}
|
||||
|
||||
// 使用会员卡支付
|
||||
if (form.payType == 2) {
|
||||
if (form.payType === 2) {
|
||||
if (!orderInfo) {
|
||||
return uni.showToast({
|
||||
title: '支付失败',
|
||||
|
||||
Reference in New Issue
Block a user