| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- @extends('layouts.app')
- @section('title')运输价格模型@endsection
- @section('content')
- <span id="nav2">
- @component('maintenance.menu')@endcomponent
- @component('maintenance.waybillPriceModel.menu')@endcomponent
- </span>
- <div id="list">
- <div class="container-fluid mt-3">
- <div class="card">
- <div>
- <form method="GET" action="{{url('maintenance/waybillPriceModel')}}" style="margin-top: 1%" id="optionSubmit">
- <table class="table table-sm table-bordered table-hover text-nowrap ">
- <tr>
- <td > <label style="margin-left: 2%" class="form-inline">页显示条数:
- <select name="paginate" v-model="filterData.paginate" class="form-control" @change="setPaginate">
- <option value="50">50行</option>
- <option value="100">100行</option>
- <option value="200">200行</option>
- <option value="500">500行</option>
- <option value="1000">1000行</option>
- </select></label></td>
- <td > <label class="form-inline" style="margin-left: 2%">承运商:
- <select name="carrier_id" v-model="filterData.carrier_id" class="form-control" @change="setCarrier">
- <option > </option>
- @foreach($carriers as $carrier)
- <option value="{{$carrier->id}}">{{$carrier->name}}</option>
- @endforeach
- </select></label></td>
- <td><label class="form-inline" style="margin-left: 2%">省份:
- <select name="province_id" v-model="filterData.province_id" class="form-control" @change="setProvince">
- <option> </option>
- @foreach($provinces as $province)
- <option value="{{$province->id}}">{{$province->name}}</option>
- @endforeach
- </select><input hidden type="submit" value="kk"></label></td>
- </tr>
- </table>
- </form>
- </div>
- <div class="card-body">
- @if(Session::has('successTip'))
- <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
- @endif
- <table class="table table-striped table-sm">
- <tr>
- <th>代码</th>
- <th>承运商名称</th>
- <th>省份</th>
- <th>城市</th>
- <th>计重单位</th>
- <th>区间</th>
- <th>单价(元)</th>
- <th>起步费(元)</th>
- <th>最低计数</th>
- <th>录入时间</th>
- </tr>
- <tr v-for="waybillPriceModel in waybillPriceModels">
- <td class="text-muted">@{{waybillPriceModel.id}}</td>
- <td>@{{waybillPriceModel.carrier}}</td>
- <td>@{{waybillPriceModel.province}}</td>
- <td>@{{waybillPriceModel.city}}</td>
- <td>@{{waybillPriceModel.unit}}</td>
- <td>@{{waybillPriceModel.range_min}}<a v-if="waybillPriceModel.range_min&&waybillPriceModel.range_max"> -- </a> @{{waybillPriceModel.range_max}}</td>
- <td>@{{waybillPriceModel.unit_price}}</td>
- <td>@{{waybillPriceModel.base_fee}}</td>
- <td>@{{waybillPriceModel.initial_weight}}</td>
- <td class="text-muted">@{{waybillPriceModel.created_at}}</td>
- <td>
- @can('计费模型-编辑')
- <button class="btn btn-sm btn-outline-primary" @click="edit(waybillPriceModel.id)">改</button> @endcan
- @can('计费模型-删除')
- <button class="btn btn-sm btn-outline-dark" @click="destroy(waybillPriceModel)">删</button> @endcan
- </td>
- </tr>
- </table>
- {{$waybillPriceModels->appends($filterData)->links()}}
- </div>
- </div>
- </div>
- </div>
- @endsection
- @section('lastScript')
- <script>
- new Vue({
- el:"#list",
- data:{
- waybillPriceModels:[
- @foreach( $waybillPriceModels as $waybillPriceModel )
- {id:'{{$waybillPriceModel->id}}',carrier:'{{$waybillPriceModel->logistic_name}}',
- province:'{{$waybillPriceModel->province_name}}',city:'{{$waybillPriceModel->city_name}}',
- unit:'{{$waybillPriceModel->unit_name}}',range_min:'{{$waybillPriceModel->range_min}}',range_max:'{{$waybillPriceModel->range_max}}',
- unit_price:'{{$waybillPriceModel->unit_price}}',base_fee:'{{$waybillPriceModel->base_fee}}',initial_weight:'{{$waybillPriceModel->initial_weight}}',
- created_at:'{{$waybillPriceModel->created_at}}'},
- @endforeach
- ],
- filterData:
- {paginate:'50',carrier_id:'',province_id: ''},
- },
- mounted:function(){
- this.initInputs();
- },
- methods:{
- edit:function(id){
- location.href = "{{url('maintenance/waybillPriceModel')}}/"+id+"/edit";
- },
- destroy:function(waybillPriceModel){
- if(!confirm('确定要删除该计费模型吗?')){return};
- let data=this;
- let url = "{{url('maintenance/waybillPriceModel')}}/"+waybillPriceModel.id;
- axios.delete(url,{id:waybillPriceModel.id})
- .then(function (response) {
- if(response.data.success){
- for (let i = 0; i < data.waybillPriceModels.length; i++) {
- if (data.waybillPriceModels[i].id===waybillPriceModel.id){
- data.waybillPriceModels.splice(i,1);
- break;
- }
- }
- tempTip.setDuration(1000);
- tempTip.showSuccess('删除计费模型成功!')
- }else{
- tempTip.setDuration(1000);
- tempTip.show('删除计费模型失败!')
- }
- })
- .catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('删除计费模型失败!'+'网络错误:' + err);
- console.log(err);
- });
- },
- initInputs:function(){
- let data=this;
- let uriParts =decodeURI(location.href).split("?");
- if(uriParts.length>1){
- let params = uriParts[1].split('&');
- params.forEach(function(paramPair){
- let pair=paramPair.split('=');
- let key = pair[0], val = pair[1];
- $('input[name="'+key+'"]').val(val);
- $('select[name="'+key+'"]').val(val);
- decodeURI(data.filterData[key]=val);
- });
- }
- },
- setPaginate:function(e){
- this.filterData.paginate=e.target.value;
- var form = document.getElementById("optionSubmit");
- form.submit();
- },
- setCarrier:function (e){
- this.filterData.carrier_id=e.target.value;
- var form = document.getElementById("optionSubmit");
- form.submit();
- },
- setProvince:function (e){
- this.filterData.province_id=e.target.value;
- var form = document.getElementById("optionSubmit");
- form.submit();
- },
- }
- });
- </script>
- @endsection
|