|
@@ -8,12 +8,12 @@
|
|
|
</label>
|
|
|
<div class="value-wrap">
|
|
|
<div class="value-name">
|
|
|
- <input type="text" placeholder="请输入姓名" v-myBlur v-model.trim="postData.orderUserName">
|
|
|
+ <input type="text" placeholder="请输入姓名" v-myBlur v-model.trim="postData.userName">
|
|
|
</div>
|
|
|
<div class="value-gender">
|
|
|
- <p v-for="str in ['男', '女']" :key="str" @click="postData.orderUserSex = str">
|
|
|
- <img src="./image/btn_xingbie_sel@2x.png" alt="" v-show="postData.orderUserSex === str">
|
|
|
- <img src="./image/btn_xingbie_nor@2x.png" alt="" v-show="postData.orderUserSex !== str">
|
|
|
+ <p v-for="str in ['男', '女']" :key="str" @click="postData.userSex = str">
|
|
|
+ <img src="./image/btn_xingbie_sel@2x.png" alt="" v-show="postData.userSex === str">
|
|
|
+ <img src="./image/btn_xingbie_nor@2x.png" alt="" v-show="postData.userSex !== str">
|
|
|
<span>{{ str }}</span>
|
|
|
</p>
|
|
|
</div>
|
|
@@ -28,8 +28,8 @@
|
|
|
type="tel"
|
|
|
placeholder="请输入手机号码"
|
|
|
v-myBlur
|
|
|
- v-model.trim="postData.orderUserPhone"
|
|
|
- @input="postData.orderUserPhone = postData.orderUserPhone.replace(/[^\d]/, '').replace(/^0/, '').replace(/(\d{11})(.*)/, '$1')">
|
|
|
+ v-model.trim="postData.userPhone"
|
|
|
+ @input="postData.userPhone = postData.userPhone.replace(/[^\d]/, '').replace(/^0/, '').replace(/(\d{11})(.*)/, '$1')">
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="form-item">
|
|
@@ -50,11 +50,11 @@
|
|
|
<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.orderProvince">{{
|
|
|
- postData.orderProvince + postData.orderCity +
|
|
|
- postData.orderDistrict
|
|
|
+ <p class="value-city" v-show="postData.provinceName">{{
|
|
|
+ postData.provinceName + postData.cityName +
|
|
|
+ postData.districtName
|
|
|
}}</p>
|
|
|
- <p class="value-city init" v-show="!postData.orderProvince">请选择所在城市</p>
|
|
|
+ <p class="value-city init" v-show="!postData.provinceName">请选择所在城市</p>
|
|
|
<img src="./image/btn_next@2x.png" alt="">
|
|
|
</div>
|
|
|
</li>
|
|
@@ -67,7 +67,7 @@
|
|
|
name=""
|
|
|
rows="1"
|
|
|
placeholder="请输入小区名称"
|
|
|
- v-model.trim="postData.orderAddress"
|
|
|
+ v-model.trim="postData.addressName"
|
|
|
v-myBlur
|
|
|
ref="myTextarea"></textarea>
|
|
|
</div>
|
|
@@ -78,12 +78,12 @@
|
|
|
</label>
|
|
|
<div class="value-wrap amount-wrap">
|
|
|
<input
|
|
|
- :class="{'opacity-0': postData.orderPrice * 1 > 0}"
|
|
|
+ :class="{'opacity-0': postData.applyPrice * 1 > 0}"
|
|
|
type="tel" placeholder="请输入需求金额"
|
|
|
v-myBlur
|
|
|
v-model.trim="amount"
|
|
|
@input="amount = amount.replace(/[^\d]/, '').replace(/^0/, '')">
|
|
|
- <p v-show="postData.orderPrice * 1 > 0">{{ postData.orderPrice * 1 | toThousands }}</p>
|
|
|
+ <p v-show="postData.applyPrice * 1 > 0">{{ postData.applyPrice * 1 | toThousands }}</p>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="form-item">
|
|
@@ -93,9 +93,9 @@
|
|
|
<div class="value-wrap">
|
|
|
<div class="value-name"></div>
|
|
|
<div class="value-gender">
|
|
|
- <p v-for="str in ['有', '无']" :key="str" @click="postData.orderUserSex = str">
|
|
|
- <img src="./image/btn_xingbie_sel@2x.png" alt="" v-show="postData.orderUserSex === str">
|
|
|
- <img src="./image/btn_xingbie_nor@2x.png" alt="" v-show="postData.orderUserSex !== str">
|
|
|
+ <p v-for="str in ['有', '无']" :key="str" @click="postData.isHouse = str">
|
|
|
+ <img src="./image/btn_xingbie_sel@2x.png" alt="" v-show="postData.isHouse === str">
|
|
|
+ <img src="./image/btn_xingbie_nor@2x.png" alt="" v-show="postData.isHouse !== str">
|
|
|
<span>{{ str }}</span>
|
|
|
</p>
|
|
|
</div>
|
|
@@ -129,6 +129,8 @@
|
|
|
import { Popup, Picker, Toast } from 'vant'
|
|
|
import { createOrder } from './api'
|
|
|
import { getChinaArea, sendSMS } from '../../../api/common'
|
|
|
+import { isMobile, isSmscode } from '../../../utils/validate'
|
|
|
+import { getQueryString } from '../../../utils/getQueryString'
|
|
|
|
|
|
export default {
|
|
|
name: 'onlineAct',
|
|
@@ -136,48 +138,40 @@ export default {
|
|
|
'van-popup': Popup,
|
|
|
'van-picker': Picker
|
|
|
},
|
|
|
- props: {
|
|
|
- partnerId: {
|
|
|
- type: String,
|
|
|
- default: ''
|
|
|
- },
|
|
|
- RId: {
|
|
|
- type: [String, Number],
|
|
|
- default: ''
|
|
|
- }
|
|
|
- },
|
|
|
data () {
|
|
|
return {
|
|
|
postData: {
|
|
|
- orderUserName: '', // 用户名称
|
|
|
- orderUserSex: '男',
|
|
|
- orderUserPhone: '', // 手机号码
|
|
|
- code: '', // 验证码
|
|
|
- capture: '',
|
|
|
- orderPrice: '', // 申请金额
|
|
|
- orderProvince: '', // 省份
|
|
|
- orderCity: '', // 城市
|
|
|
- orderDistrict: '', // 区域
|
|
|
- orderAddress: '' // 详细地址
|
|
|
+ userName: '潘勇', // 用户名称
|
|
|
+ userSex: '男', // 性别(0男1女)
|
|
|
+ userPhone: '13429176706', // 手机号码
|
|
|
+ code: '1212', // 验证码
|
|
|
+ applyPrice: '10', // 申请金额
|
|
|
+ provinceName: '', // 省份
|
|
|
+ cityName: '', // 城市
|
|
|
+ districtName: '', // 区域
|
|
|
+ addressName: '测试小区', // 详细地址
|
|
|
+ isHouse: '有' // 是否有房(0无1有)
|
|
|
},
|
|
|
numCount: 60,
|
|
|
arrErrorList: [],
|
|
|
showPicker: false,
|
|
|
columns: [],
|
|
|
- timer: null
|
|
|
+ timer: null,
|
|
|
+ channel: ''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
amount: {
|
|
|
get () {
|
|
|
- return this.postData.orderPrice * 1 ? this.postData.orderPrice : ''
|
|
|
+ return this.postData.applyPrice * 1 ? this.postData.applyPrice : ''
|
|
|
},
|
|
|
set (value) {
|
|
|
- this.postData.orderPrice = value
|
|
|
+ this.postData.applyPrice = value
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
async mounted () {
|
|
|
+ this.channel = getQueryString('channel') || ''
|
|
|
this.funGetChinaArea()
|
|
|
await this.$nextTick()
|
|
|
const textarea = this.$refs.myTextarea
|
|
@@ -194,7 +188,12 @@ export default {
|
|
|
funGetChinaArea () {
|
|
|
getChinaArea().then(res => {
|
|
|
if (res.status) {
|
|
|
- this.columns = res.data.filter(province => province.text === '浙江')
|
|
|
+ this.columns = res.data.filter(province => province.text === '浙江').map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ children: item.children.filter(city => city.text === '杭州' || city.text === '绍兴')
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
Toast(res.msg)
|
|
|
}
|
|
@@ -212,9 +211,9 @@ export default {
|
|
|
},
|
|
|
onConfirm (value) {
|
|
|
this.showPicker = false
|
|
|
- this.$set(this.postData, 'orderProvince', value[0])
|
|
|
- this.$set(this.postData, 'orderCity', value[1])
|
|
|
- this.$set(this.postData, 'orderDistrict', value[2])
|
|
|
+ this.$set(this.postData, 'provinceName', value[0])
|
|
|
+ this.$set(this.postData, 'cityName', value[1])
|
|
|
+ this.$set(this.postData, 'districtName', value[2])
|
|
|
},
|
|
|
funCutDown () {
|
|
|
clearInterval(this.timer)
|
|
@@ -230,18 +229,18 @@ export default {
|
|
|
// 获取验证码
|
|
|
funGetCode () {
|
|
|
const numCount = this.numCount
|
|
|
- const { orderUserPhone, capture } = this.postData
|
|
|
+ const { userPhone } = this.postData
|
|
|
if (numCount < 60 && numCount > 0) {
|
|
|
return
|
|
|
}
|
|
|
this.numCount = 60
|
|
|
- if (!(/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(orderUserPhone))) {
|
|
|
+ if (!isMobile(userPhone)) {
|
|
|
Toast('请输入手机号码')
|
|
|
return
|
|
|
}
|
|
|
|
|
|
this.funCutDown()
|
|
|
- sendSMS(orderUserPhone, 0, capture).then(res => {
|
|
|
+ sendSMS(userPhone, 0, '').then(res => {
|
|
|
if (res.status) {
|
|
|
Toast('发送成功')
|
|
|
} else {
|
|
@@ -257,47 +256,48 @@ export default {
|
|
|
},
|
|
|
verifyData () {
|
|
|
const {
|
|
|
- orderUserName,
|
|
|
- orderUserSex,
|
|
|
- orderUserPhone,
|
|
|
+ userName,
|
|
|
+ userSex,
|
|
|
+ userPhone,
|
|
|
code,
|
|
|
- orderProvince,
|
|
|
- orderCity,
|
|
|
- orderDistrict,
|
|
|
- orderAddress,
|
|
|
- orderPrice
|
|
|
+ provinceName,
|
|
|
+ cityName,
|
|
|
+ districtName,
|
|
|
+ addressName,
|
|
|
+ applyPrice
|
|
|
} = this.postData
|
|
|
this.arrErrorList = []
|
|
|
- if (!orderUserName) {
|
|
|
+ if (!userName) {
|
|
|
this.arrErrorList.push('请输入姓名')
|
|
|
}
|
|
|
- if (!orderUserSex) {
|
|
|
+ if (!userSex) {
|
|
|
this.arrErrorList.push('请选择性别')
|
|
|
}
|
|
|
- if (!/^1[2|3|4|5|6|7|8|9]\d{9}$/.test(orderUserPhone)) {
|
|
|
+ if (!isMobile(userPhone)) {
|
|
|
this.arrErrorList.push('请输入手机号码')
|
|
|
}
|
|
|
- if (!(/^\d{4}$/.test(code))) {
|
|
|
+ if (!isSmscode(code)) {
|
|
|
this.arrErrorList.push('请输入验证码')
|
|
|
}
|
|
|
- if (!orderProvince || !orderCity || !orderDistrict) {
|
|
|
+ if (!provinceName || !cityName || !districtName) {
|
|
|
this.arrErrorList.push('请选择所在城市')
|
|
|
}
|
|
|
- if (!orderAddress) {
|
|
|
+ if (!addressName) {
|
|
|
this.arrErrorList.push('请输入小区名称')
|
|
|
}
|
|
|
- if (orderPrice * 1 <= 0) {
|
|
|
+ if (applyPrice * 1 <= 0) {
|
|
|
this.arrErrorList.push('请输入需求金额')
|
|
|
}
|
|
|
return this.arrErrorList.length <= 0
|
|
|
},
|
|
|
funSubmit () {
|
|
|
const postData = {
|
|
|
- partnerId: this.partnerId,
|
|
|
- userNewId: this.RId,
|
|
|
- ...this.postData
|
|
|
+ ...this.postData,
|
|
|
+ userSex: this.postData.userSex === '男' ? 0 : 1,
|
|
|
+ isHouse: this.postData.isHouse === '有' ? 1 : 0,
|
|
|
+ applyPrice: this.postData.applyPrice * 10000, // 后端要求金额为元
|
|
|
+ channel: this.channel
|
|
|
}
|
|
|
- delete postData.capture
|
|
|
if (!this.verifyData()) {
|
|
|
Toast({
|
|
|
message: this.arrErrorList[0],
|