feat(collectCode): 优化签名功能并添加加载提示
- 在签名面板中添加加载提示功能 - 根据签名顺序跳转到不同页面 - 在个人信息页面添加默认国家代码功能 - 优化个人信息页面的初始化逻辑
This commit is contained in:
parent
ead04355d0
commit
98be4bc5ac
@ -4,6 +4,7 @@ import { showToast } from 'vant';
|
||||
import {codeAuthStore} from "~/stores-collect-code/auth/index.js";
|
||||
import {signOffline} from "~/api/goods/index.js";
|
||||
import {useI18n} from "vue-i18n";
|
||||
import {showLoadingToast} from 'vant'
|
||||
const {t} = useI18n();
|
||||
const {formData,number,qrData}=codeAuthStore()
|
||||
const signaturePad = ref(null);
|
||||
@ -31,14 +32,28 @@ const clearSignature = () => {
|
||||
};
|
||||
|
||||
const confirm=async ()=>{
|
||||
const toast= showLoadingToast({
|
||||
message:t('collectCode.signature.loading'),
|
||||
forbidClick:true,
|
||||
})
|
||||
try {
|
||||
const res=await signOffline({
|
||||
auctionArtworkUuid:qrData.value.auctionArtworkUuid,
|
||||
userInfo:formData.value,
|
||||
signOrder:Number(number.value),
|
||||
signImgFileData:imgUrl.value,
|
||||
})
|
||||
|
||||
if (res.status===0){
|
||||
if(Number(number.value)===1){
|
||||
router.push('/collectCode/signature/result')
|
||||
}else if(Number(number.value)===2){
|
||||
router.push('/collectCode/payment')
|
||||
}
|
||||
toast.close()
|
||||
}
|
||||
} catch (error) {
|
||||
toast.close()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -4,6 +4,7 @@ import XVanSelect from '@/components/x-van-select/index.vue'
|
||||
import XVanDate from '@/components/x-van-date/index.vue'
|
||||
import {codeAuthStore} from "@/stores-collect-code/auth/index.js";
|
||||
import {message} from "@/components/x-message/useMessage.js";
|
||||
import countryCode from '@/pages/countryRegion/data/index.js'
|
||||
import {fddInfo, offlineQrcode} from "~/api-collect-code/goods/index.js";
|
||||
import {signOffline} from "~/api/goods/index.js";
|
||||
const {formData,number,auctionArtworkUuid,qrUid,qrData}=codeAuthStore()
|
||||
@ -12,7 +13,7 @@ definePageMeta({
|
||||
i18n: 'menu.profile',
|
||||
})
|
||||
|
||||
const {t} = useI18n()
|
||||
const {t,locale} = useI18n()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const columns = ref([
|
||||
@ -24,6 +25,33 @@ const columns1 = ref([
|
||||
{text: t('realAuth.passport'), value: 2},
|
||||
{text: t('realAuth.other'), value: 3},
|
||||
])
|
||||
const getDefaultCountry = () => {
|
||||
let defaultCode = 'CN' // 默认中国大陆
|
||||
switch (locale.value) {
|
||||
case 'zh-CN':
|
||||
defaultCode = 'CN'
|
||||
break
|
||||
case 'zh-TW':
|
||||
defaultCode = 'TW'
|
||||
break
|
||||
case 'ja-JP':
|
||||
defaultCode = 'JP'
|
||||
break
|
||||
case 'en-US':
|
||||
defaultCode = 'US'
|
||||
break
|
||||
}
|
||||
|
||||
const country = countryCode.find(c => c.code === defaultCode)
|
||||
return {
|
||||
zone: country.zone,
|
||||
name: locale.value === 'zh-CN' ? country.cn :
|
||||
locale.value === 'zh-TW' ? country.tw :
|
||||
locale.value === 'ja-JP' ? country.ja :
|
||||
country.en
|
||||
}
|
||||
}
|
||||
|
||||
const goCountryRegion=()=>{
|
||||
router.push({
|
||||
path:'/countryRegion'
|
||||
@ -64,11 +92,14 @@ const initData= async ()=>{
|
||||
router.replace('/collectCode/payment')
|
||||
}
|
||||
}
|
||||
|
||||
if(!formData.value.countryCode){
|
||||
console.log('formData.value.countryCode',!!formData.value.countryCode)
|
||||
const defaultCountry = getDefaultCountry()
|
||||
console.log('defaultCountry',defaultCountry)
|
||||
formData.value.countryCode= defaultCountry.zone
|
||||
}
|
||||
if (route.query.zone){
|
||||
formData.value.countryCode=route.query.zone
|
||||
}else {
|
||||
formData.value.countryCode='86'
|
||||
}
|
||||
}
|
||||
const nextClick=async ()=>{
|
||||
@ -110,6 +141,7 @@ const nextClick=async ()=>{
|
||||
router.push('/collectCode/signature/protocol')
|
||||
}
|
||||
}
|
||||
|
||||
initData()
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user