按钮防重复点击
This commit is contained in:
@ -57,68 +57,28 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="serviceType">
|
||||
<div class="trailerService">
|
||||
<div class="trailerService" v-for="(item,index) in supplierServiceList" :key="index">
|
||||
<div class="serviceline">
|
||||
<span class="service">拖车服务:</span>
|
||||
<span class="service">{{ item.name }}:</span>
|
||||
<span class="line"></span>
|
||||
</div>
|
||||
<van-radio-group v-model="trailerService" @change="change" class="radioWrap">
|
||||
<van-radio name="故障——平板拖车" class="item">
|
||||
故障——平板拖车
|
||||
<img
|
||||
slot="icon"
|
||||
slot-scope="props"
|
||||
:src="props.checked ? activeIcon : inactiveIcon"
|
||||
>
|
||||
</van-radio>
|
||||
<van-radio name=" 事故——平板拖车" class="item">
|
||||
事故——平板拖车
|
||||
<img
|
||||
slot="icon"
|
||||
slot-scope="props"
|
||||
:src="props.checked ? activeIcon : inactiveIcon"
|
||||
>
|
||||
</van-radio>
|
||||
</van-radio-group>
|
||||
</div>
|
||||
<div class="smallRepairService">
|
||||
<div class="serviceline">
|
||||
<span class="service">小修服务:</span>
|
||||
<span class="line"></span>
|
||||
</div>
|
||||
<van-radio-group v-model="smallRepairService" @change="change2" class="radioWrap">
|
||||
<van-radio name="换胎" class="item">
|
||||
换胎
|
||||
<img
|
||||
slot="icon"
|
||||
slot-scope="props"
|
||||
:src="props.checked ? activeIcon : inactiveIcon"
|
||||
>
|
||||
</van-radio>
|
||||
<van-radio name="搭电" class="item">
|
||||
搭电
|
||||
<img
|
||||
slot="icon"
|
||||
slot-scope="props"
|
||||
:src="props.checked ? activeIcon : inactiveIcon"
|
||||
>
|
||||
</van-radio>
|
||||
<van-radio name="送油" class="item">
|
||||
送油
|
||||
<img
|
||||
slot="icon"
|
||||
slot-scope="props"
|
||||
:src="props.checked ? activeIcon : inactiveIcon"
|
||||
>
|
||||
</van-radio>
|
||||
<van-radio name="送水" class="item">
|
||||
送水
|
||||
<van-radio :name="item2.name" class="item" v-for="(item2,index2) in item.children" :key="index2">
|
||||
{{item2.name }}
|
||||
<img
|
||||
slot="icon"
|
||||
slot-scope="props"
|
||||
:src="props.checked ? activeIcon : inactiveIcon"
|
||||
>
|
||||
</van-radio>
|
||||
<!-- <van-radio name=" 事故——平板拖车" class="item">-->
|
||||
<!-- 事故——平板拖车-->
|
||||
<!-- <img-->
|
||||
<!-- slot="icon"-->
|
||||
<!-- slot-scope="props"-->
|
||||
<!-- :src="props.checked ? activeIcon : inactiveIcon"-->
|
||||
<!-- >-->
|
||||
<!-- </van-radio>-->
|
||||
</van-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
@ -129,7 +89,7 @@
|
||||
|
||||
<script>
|
||||
import {myMixins} from "@/utils/myMixins"
|
||||
import {vehicleTypeList,saveVehicle,getInfoById} from "@/api/mine"
|
||||
import {vehicleTypeList,saveVehicle,getInfoById,supplierServiceTree} from "@/api/mine"
|
||||
import TwoCommonBtn from "@/components/twoBtnCommon.vue"
|
||||
import CellGroup from "@/components/cellGroup.vue";
|
||||
export default {
|
||||
@ -146,7 +106,8 @@ export default {
|
||||
typeList:[],//车辆类型列表
|
||||
selectedOption:'1',//车辆类型
|
||||
id:'',//车辆Id
|
||||
serviceIds:''//车辆服务种类
|
||||
serviceIds:'',//车辆服务种类,
|
||||
supplierServiceList:[]
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
@ -159,7 +120,10 @@ export default {
|
||||
this.selectedOption=selectElement.value;
|
||||
});
|
||||
await this.getTypeList();
|
||||
await this.vehicleInfo()
|
||||
if( this.id){
|
||||
await this.vehicleInfo()
|
||||
}
|
||||
await this.getSupplierServiceTree();
|
||||
},
|
||||
methods:{
|
||||
async getTypeList() {
|
||||
@ -168,21 +132,26 @@ export default {
|
||||
this.typeList=result.data
|
||||
}
|
||||
},
|
||||
async getSupplierServiceTree(){
|
||||
let res = await supplierServiceTree();
|
||||
this.supplierServiceList=res.data
|
||||
},
|
||||
async vehicleInfo(){
|
||||
let res= await getInfoById({
|
||||
vehicleId:this.id
|
||||
})
|
||||
if(res.code === 200){
|
||||
// if(res.code === 200){
|
||||
let result=res.data;
|
||||
this.id=result.vehicleId
|
||||
this.carNum=result.plateNumber
|
||||
this.isJoin=result.hasPolymerization.code
|
||||
this.selectedOption=result.vehicleType;
|
||||
this.serviceIds=result.serviceIds
|
||||
}
|
||||
// }
|
||||
},
|
||||
change(e) {
|
||||
this.trailerService=e
|
||||
console.log(" this.trailerService", this.trailerService)
|
||||
},
|
||||
change2(e) {
|
||||
this.smallRepairService=e
|
||||
@ -194,17 +163,18 @@ export default {
|
||||
this.$router.back()
|
||||
},
|
||||
async submitBtn(){
|
||||
let res=await saveVehicle({
|
||||
vehicleId:this.id ? this.id : '',
|
||||
plateNumber:this.carNum ? this.carNum :'',
|
||||
vehicleType:this.selectedOption ? this.selectedOption : '',
|
||||
hasPolymerization:Number(this.isJoin ? this.isJoin : '') ,
|
||||
serviceIds:this.serviceIds ? this.serviceIds : []
|
||||
})
|
||||
if(res.code === 200){
|
||||
if(!(this.carNum && this.selectedOption && this.isJoin)){
|
||||
this.$toast('必填字段未填写')
|
||||
}else{
|
||||
await saveVehicle({
|
||||
vehicleId:this.id ? this.id : '',
|
||||
plateNumber:this.carNum ? this.carNum :'',
|
||||
vehicleType:this.selectedOption ? this.selectedOption : '',
|
||||
hasPolymerization:Number(this.isJoin ? this.isJoin : '') ,
|
||||
serviceIds:this.serviceIds ? this.serviceIds : []
|
||||
})
|
||||
if(this.id){
|
||||
this.$toast('修改成功')
|
||||
|
||||
}else{
|
||||
this.$toast('添加成功')
|
||||
}
|
||||
@ -229,6 +199,7 @@ export default {
|
||||
}
|
||||
.wrap{
|
||||
@include wh(100%,100%);
|
||||
overflow-y: auto;
|
||||
}
|
||||
.addContentWrap{
|
||||
margin-left: 16px;
|
||||
@ -301,10 +272,11 @@ export default {
|
||||
}
|
||||
}
|
||||
.btn{
|
||||
margin-left: 8px;
|
||||
//margin-left: 8px;
|
||||
width: 90%;
|
||||
position: fixed;
|
||||
bottom: 30px;
|
||||
margin: 40px 0 30px 8px;
|
||||
//position: fixed;
|
||||
//bottom: 30px;
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user