Commit 73b5812b by 李伟康

提交代码

1 parent b14a73f7
......@@ -41,23 +41,13 @@
position="right"
class="popup"
>
<div :class="['car-view',{'text-center':!carTypeList.length}]">
<template v-if="carTypeList.length">
<template v-for="(i,index) in carTypeList">
<div
:key="index"
class="flex item"
@click="choose(i)"
>{{i.name}}</div>
</template>
</template>
<template v-else>
<van-loading
color="#282829"
size="40"
text-size="12"
vertical
>加载中...</van-loading>
<div class="car-view">
<template v-for="(i,index) in carTypeList">
<div
:key="index"
class="flex item"
@click="choose(i)"
>{{i.name}}</div>
</template>
</div>
</van-popup>
......@@ -107,6 +97,7 @@ export default {
})
},
showCarType (i, item) {
this.showLoading()
let { brandInfo } = this
this.brandInfo = {
...brandInfo,
......@@ -116,9 +107,11 @@ export default {
vehicleSeriesName: i.name
}
this.carTypeList = []
this.showType = true
carLifeApi.getCarTypeList(i.id).then(data => {
this.carTypeList = data || []
this.hideLoading()
if (!data || !data.length) this.showToast('暂无该车型')
else this.carTypeList = data || []
this.showType = (data && data.length) ? true : false
})
},
choose (i) {
......
......@@ -87,10 +87,17 @@ export default {
maxlength: 10,
name: '车牌号'
})
if (n.selectVehicleTypeFlag && n.selectVehicleTypeFlag == 2) formList.push({
route: 'carBrands',
name: '品牌车型'
})
if (n.selectVehicleTypeFlag && n.selectVehicleTypeFlag == 2) {
formList.push(...[{
route: 'carBrands',
name: '品牌',
key: 'carBrandsText'
}, {
route: 'carSeries',
name: '车型',
key: 'carTypeText'
}])
}
let list = [{
key: 'formDescribeFirst',
maxlength: 40,
......
......@@ -10,7 +10,7 @@
class="item flex"
:key="index"
>
<div class="label">
<div class="label text-hide">
<span>*</span>
{{i.name}}
</div>
......@@ -18,10 +18,11 @@
<template v-if="i.route">
<van-field
readonly
placeholder="请选择您的品牌车型"
:placeholder="`请选择您的${i.name}`"
@click="jumpCarBrands(i.route)"
v-model="carText"
v-model="params[i.key]"
class="readonly"
right-icon="arrow"
>
</van-field>
</template>
......@@ -95,13 +96,19 @@ export default {
})
this.params = params
if (!this.params.userPhone) this.params.userPhone = phone
let { hasDefaultBrands, brandInfo } = this.$parent.detail
if (hasDefaultBrands && !this.params.carBrandsText) {
this.params.carBrandsText = `${brandInfo.vehicleBrandName} ${brandInfo.vehicleSubBrandName}`
}
}
},
payStatus (n) {
this.payLoading = false
},
carInfo (n) {
this.carText = `${n.vehicleBrandName} ${n.vehicleSubBrandName} ${n.vehicleSeriesName} ${n.vehicleShapeName}`
console.log(n)
this.params.carBrandsText = `${n.vehicleBrandName} ${n.vehicleSubBrandName}`
this.params.carTypeText = `${n.vehicleSeriesName} ${n.vehicleShapeName}`
}
},
data () {
......@@ -110,22 +117,24 @@ export default {
payLoading: false,
items: [],
params: null,
carText: '',
hasCarBrand: false
}
},
mounted () {
},
methods: {
onCancel () {
this.$emit('cancel')
},
pay () {
let { params, items, hasCarBrand, carText, carInfo } = this,
let { params, items, hasCarBrand, carInfo } = this,
obj = {},
phoneRex = /^[1]([3-9])[0-9]{9}$/,
userInfo = this.getUserInfo(),
platNumberRex = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$)|([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/
console.log(params)
try {
items.map(e => {
Object.keys(params).map(key => {
......@@ -140,22 +149,19 @@ export default {
this.showToast('请填写正确的手机号')
return
}
if(params.plateNo && !platNumberRex.test(params.plateNo)){
this.showToast('请填写正确的车牌号')
if (params.plateNo && !platNumberRex.test(params.plateNo)) {
this.showToast('请填写正确的车牌号')
return
}
Object.keys(params).map(key => {
if (params[key]) obj[key] = params[key]
})
if (hasCarBrand) {
if (!carText) {
this.showToast('请选择品牌车型')
return
} else {
obj = {
...obj,
...carInfo
}
delete obj.carBrandsText
delete obj.carTypeText
obj = {
...obj,
...carInfo
}
}
if (userInfo.phone) this.emit(obj)
......@@ -179,22 +185,26 @@ export default {
this.$emit('pay', { obj, that: this.$parent })
},
jumpCarBrands (name) {
let { hasDefaultBrands, brandInfo } = this.$parent.detail
if (hasDefaultBrands) {
let list = [
{
id: brandInfo.vehicleSubBrandId,
name: brandInfo.vehicleSubBrandName,
let { hasDefaultBrands, brandInfo } = this.$parent.detail,
{ carInfo } = this
let chooseItem = Object.keys(carInfo).length
if (name == 'carSeries') {
if (chooseItem || hasDefaultBrands) {
let id = chooseItem ? carInfo.vehicleSubBrandId : brandInfo.vehicleSubBrandId
let name = chooseItem ? carInfo.vehicleSubBrandName : brandInfo.vehicleSubBrandName
let list = [{
id,
name,
childs: null
}
]
this.to('crowdfunding.carSeries', {
brandInfo,
list
})
} else {
this.to(`crowdfunding.${name}`)
}]
this.to('crowdfunding.carSeries', {
brandInfo: chooseItem ? carInfo : brandInfo,
list
})
return
}
}
this.to('crowdfunding.carBrands')
}
}
}
......
......@@ -55,7 +55,11 @@ export default {
goodsName: orderGoods.goodsName,
createdDate: activityJoin.createdDate,
payPrice,
orderStatus: 1
orderStatus: 1,
formContentFirst: activityJoin.formContentFirst,
formContentSecond: activityJoin.formContentSecond,
formDescribeFirst: activityJoin.formDescribeFirst,
formDescribeSecond: activityJoin.formDescribeSecond,
}
},
methods: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!