|
@@ -9,12 +9,12 @@
|
|
|
</label>
|
|
|
<div class="value-wrap">
|
|
|
<div class="value-name">
|
|
|
- <input type="text" placeholder="请输入姓名" v-model.trim="postData.name">
|
|
|
+ <input type="text" placeholder="请输入姓名" v-model.trim="postData.orderUserName">
|
|
|
</div>
|
|
|
<div class="value-gender">
|
|
|
- <p v-for="(str, index) in ['男', '女']" :key="index" @click="postData.gender = index">
|
|
|
- <img src="./image/btn_xingbie_sel@2x.png" alt="" v-show="postData.gender === index">
|
|
|
- <img src="./image/btn_xingbie_nor@2x.png" alt="" v-show="postData.gender !== index">
|
|
|
+ <p v-for="(str, index) in ['男', '女']" :key="index" @click="postData.orderUserSex = index">
|
|
|
+ <img src="./image/btn_xingbie_sel@2x.png" alt="" v-show="postData.orderUserSex === index">
|
|
|
+ <img src="./image/btn_xingbie_nor@2x.png" alt="" v-show="postData.orderUserSex !== index">
|
|
|
<span>{{ str }}</span>
|
|
|
</p>
|
|
|
</div>
|
|
@@ -25,7 +25,7 @@
|
|
|
<span v-for="(str, index) in '手机号码:'" :key="index">{{ str }}</span>
|
|
|
</label>
|
|
|
<div class="value-wrap">
|
|
|
- <input type="number" placeholder="请输入手机号码" v-model.trim="postData.phone" @input="funLimitLength">
|
|
|
+ <input type="number" placeholder="请输入手机号码" v-model.trim="postData.orderUserPhone" @input="funLimitLength">
|
|
|
</div>
|
|
|
</li>
|
|
|
<li>
|
|
@@ -51,8 +51,8 @@
|
|
|
<span v-for="(str, index) in '所在城市:'" :key="index">{{ str }}</span>
|
|
|
</label>
|
|
|
<div class="value-wrap" @click="showPicker = true">
|
|
|
- <p class="value-city" v-show="postData.province">{{ postData.province + postData.city}}</p>
|
|
|
- <p class="value-city init" v-show="!postData.province">请选择所在城市</p>
|
|
|
+ <p class="value-city" v-show="postData.orderProvince">{{ postData.orderProvince + postData.orderCity}}</p>
|
|
|
+ <p class="value-city init" v-show="!postData.orderProvince">请选择所在城市</p>
|
|
|
<img src="./image/btn_next@2x.png" alt="">
|
|
|
</div>
|
|
|
</li>
|
|
@@ -61,7 +61,8 @@
|
|
|
<span v-for="(str, index) in '房产地址:'" :key="index">{{ str }}</span>
|
|
|
</label>
|
|
|
<div class="value-wrap">
|
|
|
- <textarea name="" rows="1" placeholder="请输入房产地址" v-model.trim="postData.address" ref="myTextarea"></textarea>
|
|
|
+ <textarea name="" rows="1" placeholder="请输入房产地址" v-model.trim="postData.orderAddress"
|
|
|
+ ref="myTextarea"></textarea>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li>
|
|
@@ -69,9 +70,9 @@
|
|
|
<span v-for="(str, index) in '需求金额:'" :key="index">{{ str }}</span>
|
|
|
</label>
|
|
|
<div class="value-wrap amount-wrap">
|
|
|
- <input :class="{'opacity-0': postData.amount * 1 > 0}" type="number" placeholder="请输入需求金额"
|
|
|
+ <input :class="{'opacity-0': postData.orderPrice * 1 > 0}" type="number" placeholder="请输入需求金额"
|
|
|
v-model.trim="amount">
|
|
|
- <p v-show="postData.amount * 1 > 0">{{ postData.amount * 1 | toThousands }}.00</p>
|
|
|
+ <p v-show="postData.orderPrice * 1 > 0">{{ postData.orderPrice * 1 | toThousands }}.00</p>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -96,6 +97,8 @@
|
|
|
<script>
|
|
|
import Flow from './components/flow'
|
|
|
import { Popup, Picker, Toast } from 'vant'
|
|
|
+ import { createOrder } from './api'
|
|
|
+ import { getChinaArea, sendSMS } from '../../../api/common'
|
|
|
|
|
|
const STRCAPTURE = '//daikuanapi.codedreamit.com/captcha'
|
|
|
export default {
|
|
@@ -105,63 +108,47 @@
|
|
|
'van-popup': Popup,
|
|
|
'van-picker': Picker
|
|
|
},
|
|
|
+ props: {
|
|
|
+ // 产品ID
|
|
|
+ orderProductId: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
postData: {
|
|
|
- name: '',
|
|
|
- gender: -1,
|
|
|
- phone: '',
|
|
|
- code: '',
|
|
|
+ orderUserName: '', // 用户名称
|
|
|
+ orderUserSex: '',
|
|
|
+ orderUserPhone: '', // 手机号码
|
|
|
+ code: '', // 验证码
|
|
|
capture: '',
|
|
|
- province: '',
|
|
|
- city: '',
|
|
|
- address: '',
|
|
|
- amount: ''
|
|
|
+ orderPrice: '', // 申请金额
|
|
|
+ orderProvince: '', // 省份
|
|
|
+ orderCity: '', // 城市
|
|
|
+ orderDistrict: '', // 区域
|
|
|
+ orderAddress: '' // 详细地址
|
|
|
},
|
|
|
numCount: 60,
|
|
|
arrErrorList: [],
|
|
|
strCapture: STRCAPTURE,
|
|
|
showPicker: false,
|
|
|
- columns: [
|
|
|
- {
|
|
|
- text: '浙江',
|
|
|
- children: [
|
|
|
- {
|
|
|
- text: '杭州'
|
|
|
- // children: [{ text: '西湖区' }, { text: '余杭区' }]
|
|
|
- },
|
|
|
- {
|
|
|
- text: '温州'
|
|
|
- // children: [{ text: '鹿城区' }, { text: '瓯海区' }]
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- text: '福建',
|
|
|
- children: [
|
|
|
- {
|
|
|
- text: '福州'
|
|
|
- // children: [{ text: '鼓楼区' }, { text: '台江区' }]
|
|
|
- },
|
|
|
- {
|
|
|
- text: '厦门'
|
|
|
- // children: [{ text: '思明区' }, { text: '海沧区' }]
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
+ columns: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
amount: {
|
|
|
get () {
|
|
|
- return this.postData.amount ? this.postData.amount * 1 : ''
|
|
|
+ return this.postData.orderPrice ? this.postData.orderPrice * 1 : ''
|
|
|
},
|
|
|
set (value) {
|
|
|
- this.postData.amount = value
|
|
|
+ this.postData.orderPrice = value
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ created () {
|
|
|
+ this.funGetChinaArea()
|
|
|
+ },
|
|
|
async mounted () {
|
|
|
await this.$nextTick()
|
|
|
const textarea = this.$refs.myTextarea
|
|
@@ -175,6 +162,13 @@
|
|
|
this.$refreshTitle('中行贷')
|
|
|
},
|
|
|
methods: {
|
|
|
+ funGetChinaArea () {
|
|
|
+ getChinaArea().then(res => {
|
|
|
+ if (res.status) {
|
|
|
+ this.columns = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
handleTextarea (el, auto) {
|
|
|
return () => {
|
|
|
if (auto) {
|
|
@@ -185,12 +179,12 @@
|
|
|
},
|
|
|
onConfirm (value) {
|
|
|
this.showPicker = false
|
|
|
- this.$set(this.postData, 'province', value[0])
|
|
|
- this.$set(this.postData, 'city', value[1])
|
|
|
+ this.$set(this.postData, 'orderProvince', value[0])
|
|
|
+ this.$set(this.postData, 'orderCity', value[1])
|
|
|
},
|
|
|
funLimitLength () {
|
|
|
- const { phone, code } = this.postData
|
|
|
- this.postData.phone = phone.length > 11 ? phone.slice(0, 11) : phone
|
|
|
+ const { orderUserPhone, code } = this.postData
|
|
|
+ this.postData.orderUserPhone = orderUserPhone.length > 11 ? orderUserPhone.slice(0, 11) : orderUserPhone
|
|
|
this.postData.code = code.length > 4 ? code.slice(0, 4) : code
|
|
|
},
|
|
|
funCutDown () {
|
|
@@ -208,12 +202,12 @@
|
|
|
// 获取验证码
|
|
|
funGetCode () {
|
|
|
const numCount = this.numCount
|
|
|
- const { phone, capture } = this.postData
|
|
|
+ const { orderUserPhone, capture } = this.postData
|
|
|
if (numCount < 60 && numCount > 0) {
|
|
|
return
|
|
|
}
|
|
|
this.numCount = 60
|
|
|
- if (!(/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(phone))) {
|
|
|
+ if (!(/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(orderUserPhone))) {
|
|
|
Toast('请输入手机号码')
|
|
|
return
|
|
|
}
|
|
@@ -223,31 +217,35 @@
|
|
|
return
|
|
|
}
|
|
|
this.funCutDown()
|
|
|
- this.funUpdateCapture()
|
|
|
- // todo ajax
|
|
|
+ sendSMS(orderUserPhone, 0, capture).then(res => {
|
|
|
+ Toast(res.msg)
|
|
|
+ }).catch(err => {
|
|
|
+ Toast(err.msg)
|
|
|
+ this.funUpdateCapture()
|
|
|
+ })
|
|
|
},
|
|
|
verifyData () {
|
|
|
- const { name, gender, phone, code, province, city, address, amount } = this.postData
|
|
|
+ const { orderUserName, orderUserSex, orderUserPhone, code, orderProvince, orderCity, orderAddress, orderPrice } = this.postData
|
|
|
this.arrErrorList = []
|
|
|
- if (!name) {
|
|
|
+ if (!orderUserName) {
|
|
|
this.arrErrorList.push('请输入姓名')
|
|
|
}
|
|
|
- if (gender < 0) {
|
|
|
+ if (orderUserSex < 0) {
|
|
|
this.arrErrorList.push('请选择性别')
|
|
|
}
|
|
|
- if (!/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(phone)) {
|
|
|
+ if (!/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(orderUserPhone)) {
|
|
|
this.arrErrorList.push('请输入手机号码')
|
|
|
}
|
|
|
if (!(/^\d{4}$/.test(code))) {
|
|
|
this.arrErrorList.push('请输入验证码')
|
|
|
}
|
|
|
- if (!province || !city) {
|
|
|
+ if (!orderProvince || !orderCity) {
|
|
|
this.arrErrorList.push('请选择所在城市')
|
|
|
}
|
|
|
- if (!address) {
|
|
|
+ if (!orderAddress) {
|
|
|
this.arrErrorList.push('请输入房产地址')
|
|
|
}
|
|
|
- if (amount * 1 <= 0) {
|
|
|
+ if (orderPrice * 1 <= 0) {
|
|
|
this.arrErrorList.push('请输入需求金额')
|
|
|
}
|
|
|
return this.arrErrorList.length <= 0
|
|
@@ -262,7 +260,11 @@
|
|
|
forbidClick: true
|
|
|
})
|
|
|
}
|
|
|
- this.$router.replace({ path: '/loan/detail' })
|
|
|
+ createOrder().then(() => {
|
|
|
+ this.$router.replace({ path: '/loan/detail' })
|
|
|
+ }).catch(err => {
|
|
|
+ Toast(err)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|