会员列表,详情,充值,订单列表

This commit is contained in:
wwz
2025-03-01 14:38:02 +08:00
parent 0ab9235f6c
commit 04a84aa17f
33 changed files with 5665 additions and 982 deletions

109
stores/pay.js Normal file
View File

@@ -0,0 +1,109 @@
import {
defineStore
} from 'pinia';
import {
ref
} from 'vue';
import {
APIpayltPayOrder,
APIpayltPayVip
} from '@/common/api/pay.js'
export const Memberpay = defineStore('memberpay', {
actions: {
actionspayltPayVip(data) {
return new Promise(async (resolve, reject) => {
try {
let res = await APIpayltPayVip({
shopId: data.shopId,
shopUserId: data.shopUserId,
amount: data.amount,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
openId: uni.cache.get('userInfo').wechatOpenId,
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
openId: uni.cache.get('userInfo').wechatOpenId,
// #endif
returnUrl: data.returnUrl ? data.returnUrl : '',
buyerRemark: data.buyerRemark ? data.buyerRemark : ''
})
if (res) {
uni.showLoading({
title: '加载中',
mask: true
})
uni.requestPayment({
// #ifdef MP-WEIXIN
provider: 'wxpay', //支付类型-固定值
partnerid: res.appId, // 微信支付商户号
timeStamp: res.timeStamp, // 时间戳(单位:秒)
nonceStr: res.nonceStr, // 随机字符串
package: res.package, // 固定值
signType: res.signType, //固定值
paySign: res.paySign, //签名
// #endif
// #ifdef MP-ALIPAY
provider: 'alipay', //支付类型-固定值
orderInfo: res.tradeNo, // 微信支付商户号
// #endif
success: (res) => {
console.log(res)
uni.hideLoading()
let pages = getCurrentPages()
// #ifdef MP-WEIXIN
uni.showToast({
title: "支付成功"
})
resolve(res)
// #endif
// #ifdef MP-ALIPAY
if (res.resultCode == '9000') {
uni.showToast({
title: "支付成功"
})
resolve(res)
} else {
uni.showToast({
title: "支付失败"
})
}
// #endif
},
fail: (res) => {
uni.hideLoading()
reject(false)
}
});
}
} catch (e) {
uni.hideLoading()
reject(false)
}
})
},
actionsltPayOrder() {
return new Promise(async (resolve, reject) => {
let res = await APIpayltPayOrder({
shopId: uni.cache.get('shopId'),
checkOrderPay: {},
// #ifdef MP-WEIXIN
payType: 'wechatPay',
openId: uni.cache.get('userInfo').wechatOpenId,
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
openId: uni.cache.get('alipayOpenId').wechatOpenId,
// #endif
returnUrl: '',
buyerRemark: '',
})
})
}
}
});

View File

@@ -11,7 +11,7 @@ import {
import {
APIproductqueryShop,
APIshopUserInfo
} from '@/common/api/product/product.js'
} from '@/common/api/member.js'
export const Storelogin = defineStore('login', {
state: () => ({
token: '',
@@ -40,11 +40,7 @@ export const Storelogin = defineStore('login', {
.miniAppOpenId
this.userInfo = res.userInfo
uni.cache.set('token', res.token);
uni.cache.set('openId', res
.userInfo
.wechatOpenId)
uni.cache.set('userInfo', res
.userInfo);
uni.cache.set('userInfo', res.userInfo);
}
resolve(true);
},
@@ -120,17 +116,8 @@ export const productStore = defineStore('product', {
await this.actionsproductqueryShop()
}
}
if (uni.cache.get('productInfo')
.shopTableInfo && !uni
.cache.get('productInfo')
.shopTableInfo
.choseCount) {
uni.pro.navigateTo(
'/pagesOrder/orderAMeal/index', {
tableCode: tableCode,
shopId: uni.cache.get(
'shopId'),
})
if (uni.cache.get('shopInfo').isTableFee == 0) {
uni.pro.navigateTo('product/choosetable')
} else {
uni.pro.navigateTo(
'product/index', {
@@ -141,7 +128,6 @@ export const productStore = defineStore('product', {
}
},
fail: (res) => {
console.log(111)
console.log(res)
}
});
@@ -157,12 +143,16 @@ export const productStore = defineStore('product', {
await this.actionsproductqueryShop()
}
}
if (uni.cache.get('productInfo').shopTableInfo && !uni
.cache.get('productInfo').shopTableInfo.choseCount) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: uni.cache.get('tableCode'),
shopId: uni.cache.get('shopId'),
if (uni.cache.get('shopTable').status != 'idle') {
uni.showToast({
title: '此台桌暂不可用...',
icon: 'none'
})
return false
}
if (uni.cache.get('shopInfo').isTableFee == 0) {
uni.pro.navigateTo('product/choosetable')
} else {
uni.pro.navigateTo('product/index', {
tableCode: uni.cache.get('tableCode'),
@@ -181,13 +171,16 @@ export const productStore = defineStore('product', {
let res = await APIproductqueryShop({
tableCode: uni.cache.get('tableCode'),
})
res.shopInfo.isVip = res.vip ? '1' : '0'
res.shopTable.shopExtendMap = res.shopExtendMap
// 店铺信息
uni.cache.set('shopTable', res.shopTable)
// 台桌信息
uni.cache.set('shopInfo', res.shopInfo)
uni.cache.set('shopId', res.shopTable.shopId)
// 当前用户距离店铺的米数
uni.cache.set('distance', res.distance)
uni.cache.set('distance', res.distance,5000)
resolve(res)
} catch (e) {
reject(false)
@@ -200,11 +193,9 @@ export const productStore = defineStore('product', {
actionsproductqueryProduct() {
return new Promise(async (resolve, reject) => {
try {
let res = await APIshopUserInfo({
"shopId": uni.cache.get('shopId'),
"userId": uni.cache.get('userInfo').id
})
uni.cache.set('ShopUser', res)
let res = await APIshopUserInfo()
// uni.cache.set('ShopUser', res)
uni.cache.set('userInfo', res);
resolve(true)
} catch (e) {
reject(false)
@@ -217,8 +208,12 @@ export const productStore = defineStore('product', {
actionsAPIuser() {
return new Promise(async (resolve, reject) => {
try {
let res = await APIuser()
uni.cache.set('userInfo', res);
if (uni.cache.get('shopId')) {
this.actionsproductqueryProduct()
} else {
let res = await APIuser()
uni.cache.set('userInfo', res);
}
resolve(true)
} catch (e) {
reject(false)