+
{{ t('live_room.button') }}
diff --git a/app/pages/payment/index.vue b/app/pages/payment/index.vue
index c2ffe17..9feaffc 100644
--- a/app/pages/payment/index.vue
+++ b/app/pages/payment/index.vue
@@ -4,45 +4,60 @@ import {createBuyOrder} from "~/api/goods/index.js";
import {goodStore} from "~/stores/goods/index.js";
import { showLoadingToast ,closeToast} from 'vant';
import {authStore} from "~/stores/auth/index.js";
-const {checkoutSessionUrl}= authStore()
+import {message} from "~/components/x-message/useMessage.js";
+const {checkoutSessionUrl,payment}= authStore()
const payStatus=ref(0)
+definePageMeta({
+ title: '支付'
+})
const changePayStatus=()=>{
payStatus.value=payStatus.value===0?1:0
}
const { auctionData} = liveStore()
-const validateInput = (e) => {
- const value = e.target.value
- const char = String.fromCharCode(e.charCode)
-
- if (!/[\d.]/.test(char)) {
- e.preventDefault()
- return
- }
-
- if (char === '.' && (value.includes('.') || !value)) {
- e.preventDefault()
- return
- }
-
- if (value.includes('.') && value.split('.')[1]?.length >= 2) {
- e.preventDefault()
- return
- }
-}
+const amount=ref('')
const confirmPay=async ()=>{
+ if (payStatus.value===1&&!amount.value){
+ message.warning('请输入金额')
+ return
+ }
+ if (Number(payment.value.leftPrice)
{
+ // 只允许数字和小数点,且只保留两位小数
+ const value = e.target.value
+ // 清除非数字和小数点
+ let newValue = value.replace(/[^\d.]/g, '')
+ // 确保只有一个小数点
+ newValue = newValue.replace(/\.{2,}/g, '.')
+ // 只保留第一个小数点
+ newValue = newValue.replace(/^(\d*\.\d*)\./, '$1')
+ // 保留两位小数
+ if (newValue.indexOf('.') > 0) {
+ newValue = newValue.slice(0, newValue.indexOf('.') + 3)
+ }
+ // 禁止输入以0开头的多位整数
+ newValue = newValue.replace(/^0+(\d)/, '$1')
+
+ amount.value = newValue
+}
@@ -51,9 +66,9 @@ const confirmPay=async ()=>{
{{payStatus===0?'支付全部':'支付部分'}}
-
{{auctionData?.nowAuctionPrice?.currency}} {{auctionData?.nowAuctionPrice?.successPrice}}
+
{{payment.leftCurrency}} {{payment?.leftPrice}}
-
+
{{payStatus===1?'支付全部':'支付部分'}}
diff --git a/app/pages/profile/index.vue b/app/pages/profile/index.vue
index 0c25fc1..8fcf0a6 100644
--- a/app/pages/profile/index.vue
+++ b/app/pages/profile/index.vue
@@ -10,7 +10,7 @@ definePageMeta({
})
const {t}=useI18n();
const router = useRouter()
-const { userInfo } = authStore()
+const { userInfo,payment } = authStore()
const showMyList = ref([])
const localState = ref({
finished: true,
@@ -47,10 +47,13 @@ const onRefresh = async () => {
localState.value.refreshing = false
}
-const goPay = (status) => {
- if (status===1){
+const goPay = (item) => {
+ payment.value.leftPrice=item.leftPrice
+ payment.value.leftCurrency=item.leftCurrency
+ payment.value.buyUid=item.uuid
+ if (item.status===1){
router.push('/signature/protocol')
- }else if (status===4){
+ }else if (item.status===4){
router.push('/payment')
}
}
@@ -129,7 +132,7 @@ fetchData()
v-if="[1,3,4].includes(item.status)"
class="w-73px !h-30px"
type="primary"
- @click.stop="goPay(item.status)"
+ @click.stop="goPay(item)"
>
{{ $t('art_detail_page.button') }}
diff --git a/app/stores/auth/index.js b/app/stores/auth/index.js
index 4fe36c1..a4123d2 100644
--- a/app/stores/auth/index.js
+++ b/app/stores/auth/index.js
@@ -5,7 +5,13 @@ export const authStore = createGlobalState(() => {
const userInfo=useLocalStorage('userInfo',{})
const fingerprint=useLocalStorage('fingerprint','')
const checkoutSessionUrl=useLocalStorage('checkoutSessionUrl','')
+ const payment=useLocalStorage('payment',{
+ leftPrice:'',
+ leftCurrency:'',
+ buyUid:''
+ })
return{
+ payment,
checkoutSessionUrl,
userInfo,
RefreshToken,
diff --git a/app/stores/live/index.js b/app/stores/live/index.js
index b4143e6..1da3c62 100644
--- a/app/stores/live/index.js
+++ b/app/stores/live/index.js
@@ -112,7 +112,7 @@ export const liveStore = createGlobalState(() => {
// 定义常量
const WS_TYPES = {
TIP: 'tip',
- STOP_ARTWORK: 'stopArtwor',
+ STOP_ARTWORK: 'stopArtwork',
OVER: 'over'
}