diff --git a/src/api/mycar.js b/src/api/mycar.js index c8bc5c9..5a18ec8 100644 --- a/src/api/mycar.js +++ b/src/api/mycar.js @@ -18,7 +18,7 @@ export function boundCarNum(params) { return request({ url: '/personCarNumPc/boundCarNum', method: 'post', - params + data:params }) } @@ -26,10 +26,11 @@ export function boundCarNum(params) { * 解绑车牌 * @param params */ -export function unboundCarNum() { +export function unboundCarNum(params) { return request({ url: '/personCarNumPc/unboundCarNum', - method: 'post' + method: 'post', + data:params }) } diff --git a/src/views/mycar/index.vue b/src/views/mycar/index.vue index fab6962..b8e05c6 100644 --- a/src/views/mycar/index.vue +++ b/src/views/mycar/index.vue @@ -31,7 +31,7 @@ - 绑定车牌 + 绑定车牌 @@ -40,7 +40,7 @@ - +
解绑车牌
@@ -106,13 +106,46 @@ }, methods: { - /**绑定车牌*/ - bondCarNum:function(formName){ + /**校验是否已经绑定*/ + checkCarNum(formName){ + debugger + //checkBoundCarNum let that = this; let custId = this.form.custId; let carNum = this.bondform.carNum; + let existFlg = false; this.$refs[formName].validate((valid) => { if (valid) { + getPersonCarNumPC().then(response =>{ + if(response.code ='8888'){ + let data = response.data; + data.forEach(function(item,index){ + if(item.carNumber ==carNum){ + existFlg=true; + } + }); + if(data.length >=3){ + this.$message({ + type: 'error', + message: '最多只能绑定3个车牌' + }); + }else if(existFlg){ + this.$message({ + type: 'error', + message: '该车牌已经绑定!' + }); + }else { + that.bondCarNum(custId,carNum); + } + + } + }); + } + }); + }, + /**绑定车牌*/ + bondCarNum:function(custId,carNum){ + let that =this; let req ={ custId:custId, carNumber:carNum, @@ -126,14 +159,12 @@ type: 'success', message: '车牌绑定成功!' }); + that.getPersonCarNumPC(); } }); - } else { - console.log('error submit!!'); - return false; - } - }); + + }, /**获取车牌.*/ getPersonCarNumPC:function () { @@ -161,6 +192,7 @@ sysCode:'1001', carBindingStatus:2, //解绑 }; + debugger unboundCarNum(req).then(response =>{ if(response.code ='8888'){ this.$message({ diff --git a/src/views/order/index.vue b/src/views/order/index.vue index b2eb69c..d136d09 100644 --- a/src/views/order/index.vue +++ b/src/views/order/index.vue @@ -37,6 +37,9 @@

订单详情

{ if(response.code=='8888'){ + this.loading=false; this.orderData = response.data.dataList; this.total = response.data.pageTotals; }else{