Merge branch 'main' of ssh://18.167.251.121:10002/aidlab/Aida_Purchaser_Front

This commit is contained in:
2026-05-29 14:59:16 +08:00
3 changed files with 110 additions and 101 deletions

View File

@@ -74,11 +74,11 @@ export const CreateOrder = (data, loading?: boolean) => {
* @param loading - 是否显示loading * @param loading - 是否显示loading
* @returns * @returns
*/ */
export const GetOrderStatus = (paymentId: string, loading?: boolean) => { export const GetOrderStatus = (paymentId: string) => {
return request({ return request({
url: `/buyer/buyer/payment/status/${paymentId}`, url: `/buyer/buyer/payment/status/${paymentId}`,
method: 'get', method: 'get',
loading loading: true,
}) })
} }
export const ORDER_STATUS = { export const ORDER_STATUS = {

View File

@@ -24,7 +24,10 @@
try { try {
let str = route.query.list as string let str = route.query.list as string
list.value = JSON.parse(decodeURIComponent(atob(str))) list.value = JSON.parse(decodeURIComponent(atob(str)))
} catch (error) {} console.log(list.value)
} catch (error) {
console.log(error)
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@@ -4,28 +4,31 @@
<span class="icon"><svg-icon name="back" size="30" /></span> <span class="icon"><svg-icon name="back" size="30" /></span>
<span class="text">Payment Details</span> <span class="text">Payment Details</span>
</div> </div>
<div class="paylist" v-if="paymentStatus !== ORDER_STATUS.SUCCESS"> <!-- 未支付 -->
<template v-if="paymentStatus !== ORDER_STATUS.SUCCESS">
<div class="paylist">
<div class="item"> <div class="item">
<img src="@/assets/images/pay/stripe.png" alt="" /> <img src="@/assets/images/pay/stripe.png" alt="" />
<span>Credit / Debit Card</span> <span>Credit / Debit Card</span>
</div> </div>
</div> </div>
<div class="agreement" v-if="paymentStatus !== ORDER_STATUS.SUCCESS"> <div class="agreement">
<el-checkbox v-model="agreement"> <el-checkbox v-model="agreement">
<div class="text"> <div class="text">
I agree to the <span>Terms & Conditions</span> and <span>Privacy Policy</span>. I agree to the <span>Terms & Conditions</span> and
All digital item sales are final and non-refundable. <span>Privacy Policy</span>. All digital item sales are final and
non-refundable.
</div></el-checkbox </div></el-checkbox
> >
</div> </div>
<div class="title" v-if="paymentStatus !== ORDER_STATUS.SUCCESS"> <div class="title">
<span class="icon"><svg-icon name="card" size="20" /></span> <span class="icon"><svg-icon name="card" size="20" /></span>
<span class="text">Pay with Paypal</span> <span class="text">Pay with Paypal</span>
</div> </div>
<template v-if="!query.paymentId"> <template v-if="!query.paymentId">
<div class="tip"> <div class="tip">
You'll be redirected to a Paypal popup to log in and confirm. No card details are You'll be redirected to a Paypal popup to log in and confirm. No card details
shared with Stylish Parade — PayPal handles all payment security. are shared with Stylish Parade — PayPal handles all payment security.
</div> </div>
<div class="buttons"> <div class="buttons">
<button custom="black" @click="onPayWith"> <button custom="black" @click="onPayWith">
@@ -37,12 +40,13 @@
<span class="text" @click="onBack">Cancel</span> <span class="text" @click="onBack">Cancel</span>
</div> </div>
</template> </template>
<!-- 已支付,等待确认 -->
<template v-if="query.paymentId"> <template v-if="query.paymentId">
<div class="tip"> <div class="tip">
Please keep the window open until the payment is completed. If you are to open the Please keep the window open until the payment is completed. If you are to open
payment window, please check your browser settings to see if pop-ups are being the payment window, please check your browser settings to see if pop-ups are
blocked. Points may be delayed after successful payment. Please wait 1-3 minutes and being blocked. Points may be delayed after successful payment. Please wait 1-3
click the credits refresh button. minutes and click the credits refresh button.
</div> </div>
<div class="buttons"> <div class="buttons">
<button custom="black" @click="getOrderStatus">I Have Completed payment</button> <button custom="black" @click="getOrderStatus">I Have Completed payment</button>
@@ -51,6 +55,8 @@
<span class="text" @click="onBack">Back</span> <span class="text" @click="onBack">Back</span>
</div> </div>
</template> </template>
</template>
<!-- 已支付 -->
<template v-if="paymentStatus === ORDER_STATUS.SUCCESS"> <template v-if="paymentStatus === ORDER_STATUS.SUCCESS">
<div class="success"> <div class="success">
<img src="@/assets/images/pay/success.png" alt="" /> <img src="@/assets/images/pay/success.png" alt="" />
@@ -105,6 +111,14 @@
default: () => [] default: () => []
} }
}) })
onMounted(() => {
if (query.value.paymentLink && query.value.paymentId) {
createOrderCall({
paymentLink: query.value.paymentLink,
paymentId: query.value.paymentId
})
}
})
const agreement = ref(false) const agreement = ref(false)
const paymentStatus = ref(ORDER_STATUS.PENDING) const paymentStatus = ref(ORDER_STATUS.PENDING)
const onPayWith = () => { const onPayWith = () => {
@@ -113,7 +127,9 @@
} }
const ids = [...props.ids] const ids = [...props.ids]
if (ids.length === 0) return if (ids.length === 0) return
CreateOrder(ids, true).then((res: any) => { CreateOrder(ids, true).then(createOrderCall)
}
const createOrderCall = (res: any) => {
const url = res.paymentLink const url = res.paymentLink
const paymentId = res.paymentId const paymentId = res.paymentId
openView(url) openView(url)
@@ -123,26 +139,16 @@
paymentId paymentId
} }
}) })
})
}
const statusTips = {
[ORDER_STATUS.PENDING]: '订单未支付',
[ORDER_STATUS.FAILED]: '订单支付失败',
[ORDER_STATUS.CANCELED]: '订单已取消'
} }
const getOrderStatus = () => { const getOrderStatus = () => {
const paymentId = query.value.paymentId as string const paymentId = query.value.paymentId as string
GetOrderStatus(paymentId).then((res: any) => { GetOrderStatus(paymentId).then((res: any) => {
const status = res as number const status = res === null ? ORDER_STATUS.PENDING : (res as number)
if (status === ORDER_STATUS.SUCCESS) { paymentStatus.value = status
// paymentStatus.value = status if (status !== ORDER_STATUS.SUCCESS) {
}else{ ElMessage.warning('订单未支付')
} }
// const tip = statusTips[status]
// console.log(status)
}) })
// paymentStatus.value = ORDER_STATUS.SUCCESS
} }
const openView = (url, width = 600, height = 800) => { const openView = (url, width = 600, height = 800) => {
const left = (screen.width - width) / 2 const left = (screen.width - width) / 2