|
|
@@ -597,39 +597,29 @@
|
|
|
});
|
|
|
},
|
|
|
destination_city_id:function (e) {
|
|
|
- let _this=this;
|
|
|
- let $val=e.target.value;
|
|
|
- if($val==='')_this.waybill.destination_city_id='';
|
|
|
- else
|
|
|
- _this.cities.forEach(function (city) {
|
|
|
- if (city.name.includes($val)){
|
|
|
- _this.waybill.destination_city_id=city.id;
|
|
|
+ let val=e.target.value;
|
|
|
+ if (!val)this. waybill.destination_city_id='';
|
|
|
+ else this.cities.some((city)=> {
|
|
|
+ if (city.name.includes(val)){
|
|
|
+ this.waybill.destination_city_id=city.id;
|
|
|
+ return true;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
addCounty:function () {
|
|
|
- let _this=this;
|
|
|
- if (!_this.waybill.destination_city) {
|
|
|
- tempTip.setDuration(2000);
|
|
|
- tempTip.show('您未输入市/县!');
|
|
|
+ if (!this.waybill.destination_city) {
|
|
|
+ window.tempTip.setDuration(2000);
|
|
|
+ window.tempTip.show('您未输入市/县!');
|
|
|
return;
|
|
|
}
|
|
|
- tempTip.confirm("您确认添加该市/县?", function () {
|
|
|
- let url = '{{url('waybill/addCounty?destination_city=')}}' + _this.waybill.destination_city;
|
|
|
- axios.post(url)
|
|
|
- .then(function (response) {
|
|
|
- if (response.data && response.data.destination_city) {
|
|
|
- tempTip.setDuration(3000);
|
|
|
- tempTip.show(response.data.destination_city[0]);
|
|
|
- return;
|
|
|
- }
|
|
|
- _this.cities.push(response.data);
|
|
|
- _this.waybill.destination_city_id = response.data.id;
|
|
|
- }).catch(function (err) {
|
|
|
- tempTip.setDuration(3000);
|
|
|
- tempTip.show("网络错误!" + err);
|
|
|
+ window.tempTip.postBasicRequest("{{url('waybill/addCounty')}}",{name:this.waybill.destination_city},res=>{
|
|
|
+ this.cities.push({
|
|
|
+ id:res.id,
|
|
|
+ name:res.name,
|
|
|
+ type:res.type
|
|
|
});
|
|
|
- })
|
|
|
+ this.waybill.destination_city_id = res.id;
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
});
|