157 lines
5.1 KiB
Vue
157 lines
5.1 KiB
Vue
<template>
|
|
<view class="flex-col padding">
|
|
<view class="response flex-col align-center">
|
|
<view class="response flex-row justify-between bg-white margin-top padding">
|
|
<view class="flex-row align-center">
|
|
<text class="text-red margin-right-xs">*</text>
|
|
<text class="text-black">品牌</text>
|
|
</view>
|
|
<view class="w250">
|
|
<u--input inputAlign="right" placeholder="请输入品牌" border="none"
|
|
v-model.trim="postData.carBrand"></u--input>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="response flex-row justify-between bg-white margin-top padding">
|
|
<view class="flex-row align-center">
|
|
<text class="text-red margin-right-xs">*</text>
|
|
<text class="text-black">型号</text>
|
|
</view>
|
|
<view class="w250">
|
|
<u--input inputAlign="right" placeholder="请输入型号" border="none"
|
|
v-model.trim="postData.carModel"></u--input>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="response flex-col align-start bg-white margin-top padding-sm">
|
|
<view class="flex-row align-center">
|
|
<text class="text-red margin-right-xs">*</text>
|
|
<text class="text-black">车龄在几年之内</text>
|
|
</view>
|
|
<view style="width: 650rpx;">
|
|
<u-slider v-model="postData.carAge" min="0" max="30" :showValue="true" blockColor="#242a38"
|
|
activeColor="#242a38" inactiveColor="#c0c4cc"></u-slider>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="response flex-col align-start bg-white margin-top padding-sm">
|
|
<view class="flex-row align-center">
|
|
<text class="text-red margin-right-xs">*</text>
|
|
<text class="text-black">里程在多少Km之内</text>
|
|
</view>
|
|
<view style="width: 650rpx;">
|
|
<u-slider v-model="postData.kilometersRange" min="0" step="10000" max="150000" :showValue="true"
|
|
blockColor="#242a38" activeColor="#242a38" inactiveColor="#c0c4cc"></u-slider>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="response flex-col align-start bg-white margin-top padding-sm">
|
|
<view class="flex-row align-center">
|
|
<text class="text-red margin-right-xs">*</text>
|
|
<text class="text-black">价格在多少万元之内</text>
|
|
</view>
|
|
<view style="width: 650rpx;">
|
|
<u-slider v-model="postData.priceRange" min="0" step="5" max="50" :showValue="true"
|
|
blockColor="#242a38" activeColor="#242a38" inactiveColor="#c0c4cc"></u-slider>
|
|
</view>
|
|
</view>
|
|
<view class="response flex-row justify-between bg-white margin-top padding">
|
|
<view class="flex-row align-center">
|
|
<text class="text-red margin-right-xs">*</text>
|
|
<text class="text-black">姓名</text>
|
|
</view>
|
|
<view class="w250">
|
|
<u--input inputAlign="right" placeholder="请输入姓名" border="none"
|
|
v-model.trim="postData.realName"></u--input>
|
|
</view>
|
|
</view>
|
|
<view class="response flex-row justify-between bg-white margin-top padding">
|
|
<view class="flex-row align-center">
|
|
<text class="text-red margin-right-xs">*</text>
|
|
<text class="text-black">电话</text>
|
|
</view>
|
|
<view class="w250">
|
|
<u--input inputAlign="right" placeholder="请输入电话" border="none"
|
|
v-model.trim="postData.phonenumber"></u--input>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="response margin-top">
|
|
<u-button text="提交" :customStyle="{color:'#8a6e4b'}" @click="addWx" throttleTime="3000"
|
|
color="linear-gradient(to right, rgb(244, 230, 186), rgb(252, 236, 210))"></u-button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</template>
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
postData: {
|
|
realName: null,
|
|
carBrand: null,
|
|
carModel: null,
|
|
carAge: null,
|
|
kilometersRange: null,
|
|
phonenumber: null,
|
|
priceRange: null,
|
|
carType: null
|
|
},
|
|
user: {},
|
|
};
|
|
},
|
|
onShow() {
|
|
this.getUserInfo()
|
|
},
|
|
methods: {
|
|
// 获取用户信息
|
|
async getUserInfo() {
|
|
const res = await this.$request({
|
|
url: '/getInfo',
|
|
})
|
|
if (res.code == 200 && res.hasOwnProperty('user')) {
|
|
this.user = res.user
|
|
this.postData.phonenumber = res.user.phonenumber
|
|
this.postData.realName = res.user.realName
|
|
}
|
|
console.log(res);
|
|
},
|
|
//提交数据
|
|
async addWx() {
|
|
if (uni.$u.test.isEmpty(this.postData.carBrand)) {
|
|
return this.$modal.msgError('请填写品牌')
|
|
}
|
|
if (uni.$u.test.isEmpty(this.postData.carModel)) {
|
|
return this.$modal.msgError('请填写型号')
|
|
}
|
|
if (uni.$u.test.isEmpty(this.postData.carAge)) {
|
|
return this.$modal.msgError('请选择车龄')
|
|
}
|
|
if (uni.$u.test.isEmpty(this.postData.kilometersRange)) {
|
|
return this.$modal.msgError('请选择里程')
|
|
}
|
|
if (uni.$u.test.isEmpty(this.postData.priceRange)) {
|
|
return this.$modal.msgError('请选择预期价格')
|
|
}
|
|
if (uni.$u.test.isEmpty(this.postData.realName)) {
|
|
return this.$modal.msgError('请填写姓名')
|
|
}
|
|
if (uni.$u.test.isEmpty(this.postData.phonenumber)) {
|
|
return this.$modal.msgError('请填写电话')
|
|
}
|
|
const res = await this.$request({
|
|
url: '/system/buy/addWx',
|
|
method: 'POST',
|
|
data: this.postData
|
|
})
|
|
this.$modal.msgSuccess('提交成功')
|
|
setTimeout(() => {
|
|
this.$tab.navigateBack()
|
|
}, 2500)
|
|
}
|
|
},
|
|
};
|
|
</script>
|
|
<style>
|
|
</style> |