|
@@ -34,18 +34,18 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="docs_phone">
|
|
|
- <!-- <van-cell-group>
|
|
|
- <van-field v-model="tel" type="number" label="手机号码" placeholder="请输入手机号码" />
|
|
|
- </van-cell-group> -->
|
|
|
- <van-field
|
|
|
- class="editable"
|
|
|
- v-model="tel"
|
|
|
- name="phone"
|
|
|
- type="tel"
|
|
|
- label="手机号码"
|
|
|
- placeholder="请输入手机号码"
|
|
|
- :rules="phoneRules"
|
|
|
- />
|
|
|
+ <van-form validate-first>
|
|
|
+ <van-field
|
|
|
+ class="editable"
|
|
|
+ v-model="tel"
|
|
|
+ name="validator"
|
|
|
+ type="tel"
|
|
|
+ label="手机号码"
|
|
|
+ placeholder="请输入手机号码"
|
|
|
+ @input="iptValue()"
|
|
|
+ :rules="[{ validator, message: '手机号格式错误' }]"
|
|
|
+ />
|
|
|
+ </van-form>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="j-footer exchange_footer">
|
|
@@ -62,7 +62,7 @@
|
|
|
<van-checkbox v-model="checked" checked-color="#2ABED1" >我已阅读并同意<a href="javascript:;" class="clause" @click="clause()">《剑鱼文库线上购买及服务条款》</a><a href="javascript:;" class="clause" @click="clause2()">《剑鱼标讯产品与服务线上购买服务条款》</a></van-checkbox>
|
|
|
</div>
|
|
|
<div class="apply_footer">
|
|
|
- <button class="apply_button" :disabled="!this.checked" @click="exchange()">确定兑换</button>
|
|
|
+ <button class="apply_button" :disabled="!this.btnChecked" @click="exchange()">确定兑换</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -70,23 +70,24 @@
|
|
|
|
|
|
<script lang="ts">
|
|
|
import { Component, Vue } from 'vue-property-decorator'
|
|
|
-import { Checkbox, CheckboxGroup, Field, CellGroup } from 'vant'
|
|
|
+import { Checkbox, CheckboxGroup, Field, CellGroup, Form } from 'vant'
|
|
|
import { mapActions } from 'vuex'
|
|
|
// import { getDocPay } from '../../api/main'
|
|
|
-const regPhoneExg = /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57]|19[0-9])[0-9]{8}$/
|
|
|
@Component({
|
|
|
name: 'purchase-page',
|
|
|
components: {
|
|
|
[Checkbox.name]: Checkbox,
|
|
|
[CheckboxGroup.name]: CheckboxGroup,
|
|
|
[Field.name]: Field,
|
|
|
+ [Form.name]: Form,
|
|
|
[CellGroup.name]: CellGroup
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions({
|
|
|
getDocPay: 'main/getDocPay',
|
|
|
getDetails: 'main/getDetails',
|
|
|
- getListDetail: 'main/getListDetail'
|
|
|
+ getListDetail: 'main/getListDetail',
|
|
|
+ getAccountInfo: 'main/getAccountInfo'
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -94,8 +95,11 @@ export default class extends Vue {
|
|
|
protected getDocPay!: any
|
|
|
protected getDetails!: any
|
|
|
protected getListDetail!: any
|
|
|
+ protected getAccountInfo!: any
|
|
|
checked = false
|
|
|
+ btnChecked = true
|
|
|
tel = ''
|
|
|
+ regPhoneExg = /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57]|19[0-9])[0-9]{8}$/
|
|
|
query: any
|
|
|
$router: any
|
|
|
response = {
|
|
@@ -111,6 +115,38 @@ export default class extends Vue {
|
|
|
created () {
|
|
|
this.query = location.href.split('/')[location.href.split('/').length - 1] // 获取id
|
|
|
this.getWordInfor()
|
|
|
+ this.getBindPhone()
|
|
|
+ }
|
|
|
+
|
|
|
+ validator (val: any) {
|
|
|
+ console.log(val)
|
|
|
+ if (this.tel === '') {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return this.regPhoneExg.test(val)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断按钮是否可以点击
|
|
|
+ iptValue () {
|
|
|
+ let bool = this.validator(this.tel)
|
|
|
+ if (this.tel === '') {
|
|
|
+ bool = true
|
|
|
+ } else {
|
|
|
+ bool = false
|
|
|
+ }
|
|
|
+ if (this.checked === true && bool === true) {
|
|
|
+ this.btnChecked = true
|
|
|
+ } else {
|
|
|
+ this.btnChecked = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取绑定的手机号
|
|
|
+ getBindPhone () {
|
|
|
+ this.getAccountInfo().then((res: any) => {
|
|
|
+ console.log(res)
|
|
|
+ this.tel = res.data.phone
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
// 文档信息
|
|
@@ -147,18 +183,6 @@ export default class extends Vue {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- phoneRules = [{
|
|
|
- validator: (val: string) => {
|
|
|
- const status = regPhoneExg.test(val)
|
|
|
- if (val === '') {
|
|
|
- console.log(true)
|
|
|
- return true
|
|
|
- }
|
|
|
- return status
|
|
|
- },
|
|
|
- message: '手机号格式错误'
|
|
|
- }]
|
|
|
-
|
|
|
// 剑鱼文库线上购买及服务条款
|
|
|
clause () {
|
|
|
this.$router.push('/onlineterm')
|