fix:修复支付问题

This commit is contained in:
hanlin 2024-12-11 11:27:39 +08:00
parent d329ab031f
commit b4dfe55e97
9 changed files with 42 additions and 41 deletions

View File

@ -89,7 +89,7 @@ export const checkPhoneFdd = () => {
//获取openid //获取openid
export const getOpenId = (data) => { export const getOpenId = (data) => {
return http.request({ return http.request({
url: "/api/wxuser/openid", url: "/api/wxuser/get/openid",
method: "POST", method: "POST",
data, data,
}); });

View File

@ -764,9 +764,8 @@ export default {
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: async ({ code }) => { success: async ({ code }) => {
console.log('code', code)
const res3 = await this.$api.login.getOpenId({ code }) const res3 = await this.$api.login.getOpenId({ code })
if (res3.status === 0) { if (res3.code === 200) {
const res2 = await postDataByParams( const res2 = await postDataByParams(
'/api/v2/warehouse/paid', '/api/v2/warehouse/paid',
{ {
@ -786,6 +785,9 @@ export default {
}) })
} }
}) })
} else {
this.loading = false
this.$common.msgToast(res2.msg)
} }
} else { } else {
this.$common.msgToast(res3.msg) this.$common.msgToast(res3.msg)

View File

@ -255,43 +255,42 @@ export default {
this.messageText = `确认补款吗` this.messageText = `确认补款吗`
this.$refs.alertDialog.open() this.$refs.alertDialog.open()
}, },
async getOpenId() {
uni.login({
provider: 'weixin',
success: async ({ code }) => {
const res = await this.$api.login.getOpenId({ code })
this.status = res.data.status
if (res.data.status !== 0) this.$common.msgToast(res.msg)
}
})
},
async supplementaryPayment() { async supplementaryPayment() {
const data = { const data = {
ID: this.item.ID ID: this.item.ID
} }
const res = await postDataByParams( uni.login({
'/api/warehouse/supply/paid', provider: 'weixin',
data success: async ({ code }) => {
) const res3 = await this.$api.login.getOpenId({ code })
await this.getOpenId() if (res3.code === 200) {
if (res.code === 200 && this.status === 0) { const res = await postDataByParams(
uni.requestPayment({ '/api/warehouse/supply/paid',
...res.data, data
fail: (res) => {}, )
success: () => { if (res.code === 200) {
this.getData() uni.requestPayment({
uni.showToast({ ...res.data,
title: '补款成功', fail: (res) => {},
icon: 'none' success: () => {
}) this.getData()
uni.showToast({
title: '补款成功',
icon: 'none'
})
}
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
} else {
this.$common.msgToast(res3.msg)
} }
}) }
} else { })
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}, },
async getDistanceFromTopToPageBottom(classValue) { async getDistanceFromTopToPageBottom(classValue) {
const { windowHeight, windowWidth } = await uni.getSystemInfo() const { windowHeight, windowWidth } = await uni.getSystemInfo()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long