Commit 47d1200e authored by FE-安焕焕's avatar FE-安焕焕 👣

手机号格式校验

parent ac394c99
...@@ -1133,9 +1133,9 @@ ...@@ -1133,9 +1133,9 @@
"integrity": "sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q==" "integrity": "sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q=="
}, },
"@qg/cherry-ui": { "@qg/cherry-ui": {
"version": "2.21.6", "version": "2.21.7",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.21.6.tgz", "resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.21.7.tgz",
"integrity": "sha512-0FozrHsJneBnknKwlLvGdBn1uJq2eyWYP2Nm9WbzDdJzi/BdSMbSC5f/XmV2gwT++VWQvxOYzGHRaCMUD3ImGg==", "integrity": "sha512-kFt8N5aQpTeAKNRldxIJyDIVJ8PSKawv+vLHTJhlZRJfW1d7UepkXdnA0sZwXJsSE/ID6DyUhUessIoKS0a6xA==",
"requires": { "requires": {
"@popperjs/core": "^2.5.4", "@popperjs/core": "^2.5.4",
"vue-lazyload": "^1.3.3", "vue-lazyload": "^1.3.3",
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
}, },
"dependencies": { "dependencies": {
"@better-scroll/core": "^2.0.0-beta.6", "@better-scroll/core": "^2.0.0-beta.6",
"@qg/cherry-ui": "^2.21.6", "@qg/cherry-ui": "^2.21.7",
"@qg/js-bridge": "^1.1.9", "@qg/js-bridge": "^1.1.9",
"@qg/qg-scroll": "^1.4.2", "@qg/qg-scroll": "^1.4.2",
"@qg/ui-request": "0.0.20", "@qg/ui-request": "0.0.20",
......
...@@ -75,12 +75,6 @@ export default { ...@@ -75,12 +75,6 @@ export default {
setTimeout(() => { setTimeout(() => {
this.inputBlur = false; this.inputBlur = false;
}, 500); }, 500);
if (this.phoneNo && !checkPhoneFormat(this.phoneNo)) {
this.$toast.fail('请您输入正确的手机号');
this.input();
return;
}
!this.phoneHome && this.queryhome(); !this.phoneHome && this.queryhome();
this.input(); this.input();
}, },
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
> >
充值订单 充值订单
</a> </a>
<a href="" class="top-link-title" @click="goOrderListTrack('联系客服', 'cs')">联系客服</a> <a href="javascript:;" class="top-link-title" @click="goOrderListTrack('联系客服', 'cs')"
>联系客服</a
>
</div> </div>
<div class="top-tabs"> <div class="top-tabs">
<p class="top-tabs-title">娱乐生活</p> <p class="top-tabs-title">娱乐生活</p>
......
...@@ -33,7 +33,7 @@ import RechargeTop from './components/RechargeTop.vue'; ...@@ -33,7 +33,7 @@ import RechargeTop from './components/RechargeTop.vue';
import RechargeList from './components/RechargeList.vue'; import RechargeList from './components/RechargeList.vue';
import RechargeInput from './components/RechargeInput.vue'; import RechargeInput from './components/RechargeInput.vue';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
import { throttle } from '@/service/utils.service'; import { throttle, checkPhoneFormat } from '@/service/utils.service';
const { getSpuList } = api; const { getSpuList } = api;
export default { export default {
components: { components: {
...@@ -54,7 +54,11 @@ export default { ...@@ -54,7 +54,11 @@ export default {
}, },
computed: { computed: {
disabled: function() { disabled: function() {
return this.rechargePhoneInfo.phoneNo && this.selectedRechargeInfo.salePrice; return (
this.rechargePhoneInfo.phoneNo &&
checkPhoneFormat(this.rechargePhoneInfo.phoneNo) &&
this.selectedRechargeInfo.salePrice
);
} }
}, },
created() { created() {
......
@import url('../../style/mixins'); @import url('../../style/mixins');
.pay { .pay {
// width: 100%;
padding: @padding-xs; padding: @padding-xs;
.cr-coupon-list__item{
.cr-coupon-list__icon{
position:absolute !important;
}
}
} }
.price-box { .price-box {
background-color: @white; background-color: @white;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
clearable clearable
class="Vl__account__field" class="Vl__account__field"
:type="info.type === 101 ? 'text' : 'number'" :type="info.type === 101 ? 'text' : 'number'"
@input="checkPhone"
> >
<template #button> <template #button>
<cr-image <cr-image
...@@ -17,23 +18,11 @@ ...@@ -17,23 +18,11 @@
/> />
</template> </template>
</cr-field> </cr-field>
<!-- <div class="Vl__list" :class="{ show: !inputBlur }">
<div
v-for="(item, index) in list"
:key="index"
class="Vl__list-item"
@click="handleSelectPhone(item)"
>
<span class="phone">{{ phoneFormat(item.phone) }}</span>
<span class="phone-home">{{ item.home }}</span>
<span v-if="index === 0" class="current">上次充值</span>
</div>
</div> -->
</div> </div>
</template> </template>
<script> <script>
import rechargeApi from '@/api/recharge.api'; import rechargeApi from '@/api/recharge.api';
import { phoneFormat } from '@/service/utils.service'; import { phoneFormat, phoneTrim } from '@/service/utils.service';
export default { export default {
name: 'AccountInput', name: 'AccountInput',
props: { props: {
...@@ -45,28 +34,20 @@ export default { ...@@ -45,28 +34,20 @@ export default {
}, },
data: function() { data: function() {
return { return {
// inputBlur: true accountMask: ''
// showList: false
// list: [
// {
// phone: '17165445433',
// home: '北京 移动'
// }
// ]
}; };
}, },
computed: { computed: {
maxLength() { maxLength() {
return this.info.type !== 101 ? 13 : 30; return this.info.type !== 101 ? 13 : 30;
}, },
accountMask: { phoneNo() {
get() { return phoneTrim(this.accountMask);
return this.info.type !== 101 ? this.phoneFormat(this.value) : this.value;
},
set(val) {
this.$emit('input', val.replace(/\s/g, ''));
// this.getPhoneHome();
} }
},
watch: {
info: function() {
this.checkPhone();
} }
}, },
methods: { methods: {
...@@ -77,6 +58,14 @@ export default { ...@@ -77,6 +58,14 @@ export default {
async getPhoneHome() { async getPhoneHome() {
const [res] = await rechargeApi({ phoneNo: this.value }); const [res] = await rechargeApi({ phoneNo: this.value });
this.phoneHome = res.phoneHome; this.phoneHome = res.phoneHome;
},
checkPhone() {
if (this.info.type !== 101) {
this.accountMask = this.phoneFormat(this.accountMask);
} else {
this.accountMask = this.phoneNo;
}
this.$emit('input', this.phoneNo);
} }
} }
}; };
......
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
disabled() { disabled() {
return ( return (
(this.spuInfo.rechargeAccountType !== 2 && !this.account) || (this.spuInfo.rechargeAccountType !== 2 && !this.account) ||
(this.spuInfo.type !== 101 && !isPhone(this.account)) ||
!this.skuList.length || !this.skuList.length ||
!this.skuInfo.hasStock !this.skuInfo.hasStock
); );
...@@ -162,11 +163,11 @@ export default { ...@@ -162,11 +163,11 @@ export default {
this.showLoading = false; this.showLoading = false;
}, },
goOrder: throttle(async function() { goOrder: throttle(async function() {
if (!this.account && this.spuInfo.rechargeAccountType !== 2) // if (!this.account && this.spuInfo.rechargeAccountType !== 2)
return this.$toast.fail('请填写账号!'); // return this.$toast.fail('请填写账号!');
if (this.spuInfo.type !== 101 && !isPhone(this.account)) { // if (this.spuInfo.type !== 101 && !isPhone(this.account)) {
return this.$toast.fail('请填写正确的手机号!'); // return this.$toast.fail('请填写正确的手机号!');
} // }
if (!this.skuInfo.skuNo) return this.$toast.fail('请选择类型!'); if (!this.skuInfo.skuNo) return this.$toast.fail('请选择类型!');
this.$track.registeredEvents('h5_OtherRechargePageRechargeNowClick', { this.$track.registeredEvents('h5_OtherRechargePageRechargeNowClick', {
classify_name: this.spuData[this.currentTab - 1].name, classify_name: this.spuData[this.currentTab - 1].name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment