Commit 41e5bbb1 authored by 程新智's avatar 程新智 👽

优化

parent 78df98d1
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
{{addressInfo.address}} {{addressInfo.detailInfo}} {{addressInfo.address}} {{addressInfo.detailInfo}}
</div> </div>
<div class="right__phone"> <div class="right__phone">
<span>{{addressInfo.userName}}</span> <span>{{addressInfo.telNumber}}</span>
<span v-if="addressInfo.defaultFlag">默认</span> <span v-if="addressInfo.defaultFlag">默认</span>
<span>{{addressInfo.userName}}</span> <span>{{addressInfo.telNumber}}</span>
</div> </div>
</div> </div>
<div class="address__right" @click="goAddress"> <div class="address__right" @click="goAddress">
...@@ -329,7 +329,9 @@ export default { ...@@ -329,7 +329,9 @@ export default {
/deep/ .u-modal__content__text { /deep/ .u-modal__content__text {
text-align: center !important; text-align: center !important;
} }
/deep/ .u-input__content__field-wrapper__field {
text-align: right !important;
}
.price__bottom { .price__bottom {
width: 100%; width: 100%;
height: 156rpx; height: 156rpx;
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<u-gap bgColor="transparent" height="30"></u-gap> <u-gap bgColor="transparent" height="30"></u-gap>
<div class="content__code"> <div class="content__code">
<div class="code__img"> <div class="code__img">
<image :src="freeCode.mainImgUrl" class="code__img"></image> <image :src="freeCode.mainImgUrl" class="code__img"></image>
</div> </div>
<div class="code__money"> <div class="code__money">
<div class="money__title"> <div class="money__title">
<text>{{freeCode.title}}</text> <text>{{freeCode.title}}</text>
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
<u--input v-model="model1.carInfo.carModel" placeholder="请输入" border="none"></u--input> <u--input v-model="model1.carInfo.carModel" placeholder="请输入" border="none"></u--input>
</u-form-item> </u-form-item>
<u-form-item label="行驶里程" prop="carInfo.mileage" borderBottom ref="item3"> <u-form-item label="行驶里程" prop="carInfo.mileage" borderBottom ref="item3">
<div class="self__input__km"> <div class="self__input__km">
<u--input v-model="model1.carInfo.mileage" placeholder="请输入" border="none"></u--input>KM <u--input v-model="model1.carInfo.mileage" placeholder="请输入" border="none"></u--input>KM
</div> </div>
</u-form-item> </u-form-item>
<u-form-item label="车牌号" prop="carInfo.carNo" ref="item1"> </u-form-item> <u-form-item label="车牌号" prop="carInfo.carNo" ref="item1"> </u-form-item>
<car-number v-model="model1.carInfo.carNo"></car-number> <car-number v-model="model1.carInfo.carNo"></car-number>
...@@ -88,22 +88,29 @@ export default { ...@@ -88,22 +88,29 @@ export default {
message: "请填写品牌", message: "请填写品牌",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carModel": { "carInfo.carModel": {
type: "string", type: "string",
required: true, required: true,
message: "请填写车型", message: "请填写车型",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carNo": { "carInfo.carNo": [{
type: "string", min: 7,
required: true, max: 8,
message: "请填写车牌号", message: '车牌长度在7-8个字符之间'
trigger: ["blur", "change"], },
},
{
type: "string",
required: true,
message: "请填写车牌号",
trigger: ["blur", "change"],
},
]
}, },
carId: '', carId: '',
//免费挪车码 //免费挪车码
freeCode: {}, freeCode: {},
}; };
}, },
watch: { watch: {
...@@ -112,61 +119,70 @@ export default { ...@@ -112,61 +119,70 @@ export default {
}, },
}, },
methods: { methods: {
goLoveCar(){ goLoveCar() {
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/pages/move-car/loveCar?price=1' url: '/pagesB/pages/move-car/loveCar?price=1'
}); });
}, },
getCarCode() { getCarCode() {
//跳转到获取挪车码页面 //跳转到获取挪车码页面
this.$refs.form1.validate().then(res => { this.$refs.form1.validate().then(res => {
if(!this.model1.carInfo.id){ if (!this.model1.carInfo.id) {
let opts = { url: '/app/vehicleAdmin/add', method: 'post' }; let opts = {
this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => { url: '/app/vehicleAdmin/add',
if (res.data.code == 200) { method: 'post'
};
} this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => {
}) if (res.data.code == 200) {
}
}
})
}
uni.navigateTo({ uni.navigateTo({
url: '/pagesA/pages/index/getCarCode?carNo=' + this.model1.carInfo.carNo url: '/pagesA/pages/index/getCarCode?carNo=' + this.model1.carInfo.carNo
}); });
}).catch(errors => { }).catch(errors => {
uni.$u.toast('校验失败') uni.$u.toast('校验失败')
}) })
}, },
getCarInfo(){ getCarInfo() {
if(this.carId){ if (this.carId) {
let opts = { url: '/app/vehicleAdmin/' + this.carId, method: 'get' }; let opts = {
this.http.httpTokenRequest(opts, {}).then(res => { url: '/app/vehicleAdmin/' + this.carId,
if (res.data.code == 200) { method: 'get'
this.model1.carInfo = res.data.data };
} this.http.httpTokenRequest(opts, {}).then(res => {
}) if (res.data.code == 200) {
} this.model1.carInfo = res.data.data
}
}, })
getMoveCode(){ }
let opts = { url: '/app/mall/free/code', method: 'get' };
this.http.httpTokenRequest(opts, {}).then(res => { },
if (res.data.code == 200) { getMoveCode() {
this.freeCode = res.data.data let opts = {
} url: '/app/mall/free/code',
}) method: 'get'
}, };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
this.freeCode = res.data.data
}
})
},
},
onReady() {
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this.$refs.form1.setRules(this.rules)
},
onShow() {
this.getCarInfo()
this.getMoveCode()
},
onLoad(e) {
this.orderId = e.orderId
}, },
onReady() {
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this.$refs.form1.setRules(this.rules)
},
onShow() {
this.getCarInfo()
this.getMoveCode()
},
onLoad(e) {
this.orderId = e.orderId
},
}; };
</script> </script>
...@@ -175,16 +191,21 @@ export default { ...@@ -175,16 +191,21 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
/deep/.uni-input-input, /deep/.uni-input-input,
.uni-input-placeholder { .uni-input-placeholder {
text-align: right; text-align: right;
} }
/deep/ .u-input__content__field-wrapper__field {
text-align: right !important;
}
.self__input__km { .self__input__km {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
span{
span {
text-align: right; text-align: right;
display: inline-block; display: inline-block;
width: 100rpx; width: 100rpx;
...@@ -287,7 +308,8 @@ export default { ...@@ -287,7 +308,8 @@ export default {
color: #f1251b; color: #f1251b;
text-align: right; text-align: right;
margin-top: 40rpx; margin-top: 40rpx;
margin-bottom: 200rpx; margin-bottom: 200rpx;
image { image {
width: 10rpx; width: 10rpx;
height: 20rpx; height: 20rpx;
......
...@@ -4,39 +4,39 @@ ...@@ -4,39 +4,39 @@
--> -->
<template> <template>
<view class="appCotent"> <view class="appCotent">
<div class="addCar"> <div class="addCar">
<div class="add__content"> <div class="add__content">
<div class="add__title"> <div class="add__title">
填写车辆信息 填写车辆信息
</div>
<div>
<u--form labelPosition="left" :model="model1" :rules="rules" ref="form1" labelWidth="100">
<u-form-item label="品牌" prop="carInfo.brand" borderBottom ref="item1">
<u--input v-model="model1.carInfo.brand" placeholder="请输入" border="none"></u--input>
</u-form-item>
<u-form-item label="车型" prop="carInfo.carModel" borderBottom ref="item1">
<u--input v-model="model1.carInfo.carModel" placeholder="请输入" border="none"></u--input>
</u-form-item>
<u-form-item label="行驶里程" prop="carInfo.mileage" borderBottom ref="item1">
<div class="self__input__km">
<u--input v-model="model1.carInfo.mileage" placeholder="请输入" border="none"></u--input>KM
</div>
</u-form-item>
<u-form-item label="车牌号" prop="carInfo.carNo" ref="item1"> </u-form-item>
<car-number v-model="model1.carInfo.carNo"></car-number>
</u--form>
</div>
</div> </div>
<div> <div class="add__user">
<u--form labelPosition="left" :model="model1" :rules="rules" ref="form1" labelWidth="100"> <u-checkbox-group placement="row">
<u-form-item label="品牌" prop="carInfo.brand" borderBottom ref="item1"> <u-checkbox :checked='checked' @change="changeBtn"></u-checkbox>
<u--input v-model="model1.carInfo.brand" placeholder="请输入" border="none"></u--input> </u-checkbox-group>
</u-form-item> 勾选同意<span>《用户服务协议》</span>
<u-form-item label="车型" prop="carInfo.carModel" borderBottom ref="item1"> </div>
<u--input v-model="model1.carInfo.carModel" placeholder="请输入" border="none"></u--input> <div class="add__btn add__no__bind" @click="addCarInfo()">
</u-form-item> 完成
<u-form-item label="行驶里程" prop="carInfo.mileage" borderBottom ref="item1">
<div class="self__input__km">
<u--input v-model="model1.carInfo.mileage" placeholder="请输入" border="none"></u--input>KM
</div>
</u-form-item>
<u-form-item label="车牌号" prop="carInfo.carNo" ref="item1"> </u-form-item>
<car-number v-model="model1.carInfo.carNo"></car-number>
</u--form>
</div> </div>
</div> </div>
<div class="add__user">
<u-checkbox-group placement="row">
<u-checkbox :checked='checked' @change="changeBtn" ></u-checkbox>
</u-checkbox-group>
勾选同意<span>《用户服务协议》</span>
</div>
<div class="add__btn add__no__bind" @click="addCarInfo()">
完成
</div>
</div>
</view> </view>
</template> </template>
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
}, },
data() { data() {
return { return {
checked:false, checked: false,
model1: { model1: {
carInfo: { carInfo: {
brand: '', brand: '',
...@@ -61,18 +61,25 @@ export default { ...@@ -61,18 +61,25 @@ export default {
message: "请填写品牌", message: "请填写品牌",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carModel": { "carInfo.carModel": {
type: "string", type: "string",
required: true, required: true,
message: "请填写车型", message: "请填写车型",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carNo": { "carInfo.carNo": [{
type: "string", min: 7,
required: true, max: 8,
message: "请填写车牌号", message: '车牌长度在7-8个字符之间'
trigger: ["blur", "change"], },
},
{
type: "string",
required: true,
message: "请填写车牌号",
trigger: ["blur", "change"],
},
]
}, },
items: [{ items: [{
title: "挪车码编号", title: "挪车码编号",
...@@ -97,7 +104,7 @@ export default { ...@@ -97,7 +104,7 @@ export default {
}; };
}, },
methods: { methods: {
changeBtn(){ changeBtn() {
this.checked = !this.checked; this.checked = !this.checked;
}, },
goBack() { goBack() {
...@@ -105,33 +112,45 @@ export default { ...@@ -105,33 +112,45 @@ export default {
delta: 1 delta: 1
}) })
}, },
addCarInfo(){ addCarInfo() {
//表单验证 //表单验证
this.$refs.form1.validate().then(res => { this.$refs.form1.validate().then(res => {
let opts = { url: '/app/vehicleAdmin/add', method: 'post' }; if (!this.checked) {
this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => { uni.showToast({
if (res.data.code == 200) { title: "请同意用户协议",
//添加成功 icon: 'none',
uni.$u.toast('添加成功') duration: 2000,
this.goBack() });
} return
}) }
}).catch(errors => { let opts = {
uni.$u.toast('校验失败') url: '/app/vehicleAdmin/add',
}) method: 'post'
}, };
this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => {
if (res.data.code == 200) {
//添加成功
uni.$u.toast('添加成功')
this.goBack()
}
})
}).catch(errors => {
uni.$u.toast('校验失败')
})
},
},
onReady() {
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this.$refs.form1.setRules(this.rules)
}, },
onReady() {
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this.$refs.form1.setRules(this.rules)
},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.addCar { .addCar {
padding: 40rpx 0rpx; padding: 40rpx 0rpx;
/deep/.u-input__content__field-wrapper__field{
/deep/.u-input__content__field-wrapper__field {
text-align: right !important; text-align: right !important;
padding-right: 30rpx; padding-right: 30rpx;
} }
......
...@@ -4,39 +4,38 @@ ...@@ -4,39 +4,38 @@
--> -->
<template> <template>
<view class="appCotent"> <view class="appCotent">
<div class="editCar"> <div class="editCar">
<div class="add__content"> <div class="add__content">
<div class="add__title"> <div class="add__title">
填写车辆信息 填写车辆信息
</div>
<div>
<u--form labelPosition="left" :model="model1" :rules="rules" ref="form1" labelWidth="100">
<u-form-item label="品牌" prop="carInfo.brand" borderBottom ref="item1">
<u--input v-model="model1.carInfo.brand" placeholder="请输入" border="none"></u--input>
</u-form-item>
<u-form-item label="车型" prop="carInfo.carModel" borderBottom ref="item2">
<u--input v-model="model1.carInfo.carModel" placeholder="请输入" border="none"></u--input>
</u-form-item>
<u-form-item label="行驶里程" prop="carInfo.mileage" borderBottom ref="item3">
<div class="self__input__km">
<u--input v-model="model1.carInfo.mileage" placeholder="请输入" border="none"></u--input>KM
</div>
</u-form-item>
<u-form-item label="车牌号" prop="carInfo.carNo" ref="item1"> </u-form-item>
<car-number v-if="model1.carInfo.carNo" v-model="model1.carInfo.carNo"></car-number>
</u--form>
</div>
</div> </div>
<div>
<u--form labelPosition="left" :model="model1" :rules="rules" ref="form1" labelWidth="100">
<u-form-item label="品牌" prop="carInfo.brand" borderBottom ref="item1">
<u--input v-model="model1.carInfo.brand" placeholder="请输入" border="none"></u--input>
</u-form-item>
<u-form-item label="车型" prop="carInfo.carModel" borderBottom ref="item2">
<u--input v-model="model1.carInfo.carModel" placeholder="请输入" border="none"></u--input>
</u-form-item>
<u-form-item label="行驶里程" prop="carInfo.mileage" borderBottom ref="item3">
<div class="self__input__km">
<u--input v-model="model1.carInfo.mileage" placeholder="请输入" border="none"></u--input>KM
</div>
</u-form-item>
<u-form-item label="车牌号" prop="carInfo.carNo" ref="item1"> </u-form-item>
<car-number v-model="model1.carInfo.carNo"></car-number>
</u--form>
</div>
</div>
<div class="add__btn add__no__bind" @click="editCarInfo"> <div class="add__btn add__no__bind" @click="editCarInfo">
保存 保存
</div> </div>
<div class="add__btn add__back" @click="delModal"> <div class="add__btn add__back" @click="delModal">
删除 删除
</div>
<u-modal :show="deleteShow" :title="deleteTitle" :content='deleteContent' @confirm="confirmModal" @cancel="cancelModal" showCancelButton="true"></u-modal>
</div> </div>
<u-modal :show="deleteShow" :title="deleteTitle" :content='deleteContent'
@confirm="confirmModal" @cancel="cancelModal" showCancelButton="true"></u-modal>
</div>
</view> </view>
</template> </template>
...@@ -51,11 +50,13 @@ export default { ...@@ -51,11 +50,13 @@ export default {
//车辆id //车辆id
id: '', id: '',
model1: { model1: {
carInfo: {}, carInfo: {
carNo: '',
},
}, },
deleteShow: false, deleteShow: false,
deleteTitle: '删除车辆', deleteTitle: '删除车辆',
deleteContent: '确定删除车辆?', deleteContent: '确定删除车辆?',
rules: { rules: {
"carInfo.brand": { "carInfo.brand": {
type: "string", type: "string",
...@@ -63,18 +64,25 @@ export default { ...@@ -63,18 +64,25 @@ export default {
message: "请填写品牌", message: "请填写品牌",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carModel": { "carInfo.carModel": {
type: "string", type: "string",
required: true, required: true,
message: "请填写车型", message: "请填写车型",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carNo": { "carInfo.carNo": [{
type: "string", min: 7,
required: true, max: 8,
message: "请填写车牌号", message: '车牌长度在7-8个字符之间'
trigger: ["blur", "change"], },
},
{
type: "string",
required: true,
message: "请填写车牌号",
trigger: ["blur", "change"],
},
]
}, },
items: [{ items: [{
title: "挪车码编号", title: "挪车码编号",
...@@ -104,64 +112,77 @@ export default { ...@@ -104,64 +112,77 @@ export default {
delta: 1 delta: 1
}) })
}, },
getCarInfo(){ getCarInfo() {
let opts = { url: '/app/vehicleAdmin/' + this.id, method: 'get' }; let opts = {
this.http.httpTokenRequest(opts, {}).then(res => { url: '/app/vehicleAdmin/' + this.id,
if (res.data.code == 200) { method: 'get'
this.model1.carInfo = res.data.data };
this.http.httpTokenRequest(opts, {}).then(res => {
} if (res.data.code == 200) {
}) this.$nextTick(() => {
this.model1.carInfo = res.data.data;
this.model1.carInfo.carNo = res.data.data.carNo;
this.$set(this.model1.carInfo, 'carNo', res.data.data.carNo);
});
}
})
},
editCarInfo() {
this.$refs.form1.validate().then(res => {
let opts = {
url: '/app/vehicleAdmin/edit',
method: 'put'
};
this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => {
if (res.data.code == 200) {
//添加成功
uni.$u.toast('修改成功')
this.goBack()
}
})
}).catch(errors => {
uni.$u.toast('校验失败')
})
}, },
editCarInfo(){ //确认删除车辆
this.$refs.form1.validate().then(res => { confirmModal() {
let opts = { url: '/app/vehicleAdmin/edit', method: 'put' }; let opts = {
this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => { url: '/app/vehicleAdmin/remove/' + this.id,
if (res.data.code == 200) { method: 'delete'
//添加成功 };
uni.$u.toast('修改成功') this.http.httpTokenRequest(opts, {}).then(res => {
this.goBack() if (res.data.code == 200) {
} uni.showToast({
}) title: '删除成功',
}).catch(errors => { icon: "success",
uni.$u.toast('校验失败') });
}) this.goBack()
} else {
uni.showToast({
title: res.data.msg,
icon: "error",
});
}
})
this.deleteShow = false
},
cancelModal() {
this.deleteShow = false
},
delModal() {
this.deleteShow = true
}, },
//确认删除车辆
confirmModal(){
let opts = { url: '/app/vehicleAdmin/remove/' + this.id, method: 'delete' };
this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) {
uni.showToast({
title: '删除成功',
icon: "success",
});
this.goBack()
}else{
uni.showToast({
title: res.data.msg,
icon: "error",
});
}
})
this.deleteShow = false
},
cancelModal(){
this.deleteShow = false
},
delModal(){
this.deleteShow = true
},
}, },
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
}, },
onReady() { onReady() {
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则 // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this.$refs.form1.setRules(this.rules) this.$refs.form1.setRules(this.rules)
}, },
onShow(){ onShow() {
this.getCarInfo() this.getCarInfo()
}, },
} }
</script> </script>
...@@ -169,15 +190,18 @@ export default { ...@@ -169,15 +190,18 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.editCar { .editCar {
padding: 40rpx 0rpx; padding: 40rpx 0rpx;
/deep/ .u-input__content__field-wrapper__field{
/deep/ .u-input__content__field-wrapper__field {
text-align: right !important; text-align: right !important;
padding-right: 30rpx; padding-right: 30rpx;
justify-content: space-evenly; justify-content: space-evenly;
} }
.u-checkbox-group { .u-checkbox-group {
display: inline-block !important; display: inline-block !important;
} }
/deep/.u-checkbox-group--row {
/deep/.u-checkbox-group--row {
display: inline-block !important; display: inline-block !important;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<u-modal :show="deleteShow" :title="deleteTitle" :content='deleteContent' <u-modal :show="deleteShow" :title="deleteTitle" :content='deleteContent'
@confirm="confirmModal" @cancel="cancelModal" showCancelButton="true"></u-modal> @confirm="confirmModal" @cancel="cancelModal" showCancelButton="true"></u-modal>
</div> </div>
<u-gap bgColor="transparent" height="60"></u-gap>
<div class="love__btn" @click="addCar"> <div class="love__btn" @click="addCar">
<image src="@/static/move-car/love-car5.png"> 添加车辆 <image src="@/static/move-car/love-car5.png"> 添加车辆
</div> </div>
...@@ -193,7 +194,7 @@ export default { ...@@ -193,7 +194,7 @@ export default {
} }
} }
.love__btn { .love__btn {
height: 76rpx; height: 76rpx;
background: url('@/static/move-car/love-car4.png') no-repeat; background: url('@/static/move-car/love-car4.png') no-repeat;
background-size: contain; background-size: contain;
...@@ -203,7 +204,9 @@ export default { ...@@ -203,7 +204,9 @@ export default {
color: #FFFFFF; color: #FFFFFF;
line-height: 76rpx; line-height: 76rpx;
text-align: center; text-align: center;
position: fixed;
width: 670rpx;
bottom: 60rpx;
image { image {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment