diff --git a/app/api/goods/index.js b/app/api/goods/index.js index a2a5606..0c15547 100644 --- a/app/api/goods/index.js +++ b/app/api/goods/index.js @@ -81,7 +81,7 @@ export async function fddCheck(data) { export async function createBuyOrder(data) { return await request( { - url:'/api/v1/m/auction/createBuyOrder', + url:'/api/v1/m/auction/createBuyOrder/v2', method: 'POST', data }) diff --git a/app/components/stripe/CheckoutPage.vue b/app/components/stripe/CheckoutPage.vue new file mode 100644 index 0000000..edb45c4 --- /dev/null +++ b/app/components/stripe/CheckoutPage.vue @@ -0,0 +1,331 @@ + + + + + \ No newline at end of file diff --git a/app/components/stripe/CompletePage.vue b/app/components/stripe/CompletePage.vue new file mode 100644 index 0000000..fe04a73 --- /dev/null +++ b/app/components/stripe/CompletePage.vue @@ -0,0 +1,115 @@ + + + + + \ No newline at end of file diff --git a/app/pages/collectCode/mine/index.vue b/app/pages/collectCode/mine/index.vue index eb309c1..0e7cd78 100644 --- a/app/pages/collectCode/mine/index.vue +++ b/app/pages/collectCode/mine/index.vue @@ -49,16 +49,15 @@ const confirm=async ()=>{ message.warning(t('collectCode.message.lotNoRequired')) return false } - function validateNumber(num) { - const numStr = String(num) - return /^250\d{3}$/.test(numStr) - } -if (!validateNumber(createForm.value.lotNo)){ + function is25Format(num) { + return /^25\d{3}$/.test(String(num)); +} +if (!is25Format(createForm.value.lotNo)){ message.warning(t('collectCode.message.lotNoType')) return } - const res=await offlineQrcodeCreate({...createForm.value,price:String(createForm.value.price)}) + const res=await offlineQrcodeCreate({...createForm.value,price:String(createForm.value.price),lotNo:createForm.value.lotNo-25000}) if (res.status===0){ show.value=false onRefresh() diff --git a/app/pages/externallinks/index.vue b/app/pages/externallinks/index.vue index 54d8af6..f14457a 100644 --- a/app/pages/externallinks/index.vue +++ b/app/pages/externallinks/index.vue @@ -1,18 +1,19 @@ diff --git a/app/pages/home/components/ItemList/index.vue b/app/pages/home/components/ItemList/index.vue index dd9abf1..aeb1145 100644 --- a/app/pages/home/components/ItemList/index.vue +++ b/app/pages/home/components/ItemList/index.vue @@ -71,9 +71,9 @@ const openShow = async (item) => { class="w-full object-cover rounded-4px" />
- LOT{{ item.index }} + Lot{{ item.index }}
diff --git a/app/pages/payment/checkoutPage/index.vue b/app/pages/payment/checkoutPage/index.vue new file mode 100644 index 0000000..90da516 --- /dev/null +++ b/app/pages/payment/checkoutPage/index.vue @@ -0,0 +1,342 @@ + + + + + \ No newline at end of file diff --git a/app/pages/payment/completePage/index.vue b/app/pages/payment/completePage/index.vue new file mode 100644 index 0000000..e4681ef --- /dev/null +++ b/app/pages/payment/completePage/index.vue @@ -0,0 +1,363 @@ + + + + + \ No newline at end of file diff --git a/app/pages/payment/index.vue b/app/pages/payment/index.vue index 51553ff..6482a70 100644 --- a/app/pages/payment/index.vue +++ b/app/pages/payment/index.vue @@ -5,7 +5,7 @@ import {goodStore} from "~/stores/goods/index.js"; import { showLoadingToast ,closeToast} from 'vant'; import {authStore} from "~/stores/auth/index.js"; import {message} from "~/components/x-message/useMessage.js"; -const {checkoutSessionUrl,payment}= authStore() +const {checkoutSessionUrl,payment,payUid}= authStore() const payStatus=ref(0) definePageMeta({ i18n: 'payment.title' @@ -38,11 +38,16 @@ const confirmPay=async ()=>{ testReturnHost:window.location.origin, testReturnEndPoint:'/payment/result' }) - if (res.status===0){ - window.location.href=res.data.checkoutSessionUrl - } + console.log('res',res); + if (res.status===0){ + // if (res.status===0){ + // window.location.href=res.data.checkoutSessionUrl + // } + checkoutSessionUrl.value=res.data.checkoutSessionUrl + payUid.value=res.data.payUid + router.push('/payment/checkoutPage') +} } - const handleInput = (e) => { // 只允许数字和小数点,且只保留两位小数 const value = e.target.value diff --git a/app/pages/payment/result/index.vue b/app/pages/payment/result/index.vue index c665ed1..a8f412a 100644 --- a/app/pages/payment/result/index.vue +++ b/app/pages/payment/result/index.vue @@ -1,25 +1,68 @@ @@ -36,9 +79,8 @@ const goHome=()=>{ {{ t('payment.result.backToHome') }}
- + \ No newline at end of file diff --git a/app/stores/auth/index.js b/app/stores/auth/index.js index e6a7cee..a812e23 100644 --- a/app/stores/auth/index.js +++ b/app/stores/auth/index.js @@ -12,8 +12,9 @@ export const authStore = createGlobalState(() => { buyUid:'', auctionArtworkUuid:'' }) - +const payUid=useLocalStorage('payUid','') return{ + payUid, selectedZone, payment, checkoutSessionUrl, diff --git a/env/.env.test b/env/.env.test index e2232e5..6d382ab 100644 --- a/env/.env.test +++ b/env/.env.test @@ -2,4 +2,5 @@ NUXT_PUBLIC_API_BASE=https://auction-test.szjixun.cn NUXT_PUBLIC_API_COLLECT_CODE=http://auction-test.szjixun.cn NUXT_API_SECRET=test-secret -NUXT_PUBLIC_SOCKET_URL=wss://auction-test.szjixun.cn \ No newline at end of file +NUXT_PUBLIC_SOCKET_URL=wss://auction-test.szjixun.cn +NUXT_PUBLIC_PKEY=pk_test_51QfbSAAB1Vm8VfJq3AWsR4k2mZjnlF7XFrmlbc6XVXrtwXquAUfwzZmOFDbxMIAwqJBgqao8KLt2wmPc4vNOCTeo00WB78KtfV \ No newline at end of file diff --git a/i18n/locales/en-US.json b/i18n/locales/en-US.json index 4905db7..c19cc95 100644 --- a/i18n/locales/en-US.json +++ b/i18n/locales/en-US.json @@ -268,7 +268,9 @@ "placeholder": { "amount": "Maximum {currency}{price}" }, - "amount": "Payment Amount" + "amount": "Payment Amount", + "amountRequired": "Please enter the amount", + "exceedAmount": "Can't be greater than the total amount" }, "signature": { "protocol": { diff --git a/i18n/locales/ja-JP.json b/i18n/locales/ja-JP.json index 5a604a4..239bad2 100644 --- a/i18n/locales/ja-JP.json +++ b/i18n/locales/ja-JP.json @@ -268,7 +268,9 @@ "placeholder": { "amount": "最大 {currency}{price}" }, - "amount": "支払い金額" + "amount": "支払い金額", + "amountRequired": "金額を入力してください", + "exceedAmount": "総額よりも大きくすることはできません" }, "signature": { "protocol": { diff --git a/i18n/locales/zh-CN.json b/i18n/locales/zh-CN.json index 062c7f5..fa1788c 100644 --- a/i18n/locales/zh-CN.json +++ b/i18n/locales/zh-CN.json @@ -269,7 +269,9 @@ "placeholder": { "amount": "最多" }, - "amount": "支付金额" + "amount": "支付金额", + "amountRequired": "请输入金额", + "exceedAmount": "不能大于全部金额" }, "signature": { "protocol": { diff --git a/i18n/locales/zh-TW.json b/i18n/locales/zh-TW.json index 1d60898..fda58d0 100644 --- a/i18n/locales/zh-TW.json +++ b/i18n/locales/zh-TW.json @@ -319,7 +319,9 @@ "placeholder": { "amount": "最多{currency}{price}" }, - "amount": "支付金額" + "amount": "支付金額", + "amountRequired": "請輸入金額", + "exceedAmount": "不能大於全部金額" }, "signature": { "protocol": { diff --git a/nuxt.config.js b/nuxt.config.js index d8e8076..2e45790 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -72,6 +72,13 @@ export default defineNuxtConfig({ link: [ { rel: 'icon', href: '/favicon.ico', sizes: 'any' }, ], + // stripe支付CDN引用 + script: [ + { + src: 'https://js.stripe.com/v3/', + defer: true // 可选,建议添加 defer + } + ], meta: [ { name: 'viewport', content: 'width=device-width, initial-scale=1, viewport-fit=cover,user-scalable=no' }, { name: 'apple-mobile-web-app-capable', content: 'yes' },