| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- @extends('layouts.app')
- @section('title')查询-承运商@endsection
- @section('content')
- <div class="container-fluid">
- <div class="card">
- <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" id="list">
- <tr>
- <th>ID</th>
- <th>承运商名称</th>
- <th>承运商英文名称</th>
- <th>承运商代码</th>
- <th>承运商联系方式</th>
- <th>承运商类型</th>
- <th>承运商送货费</th>
- <th>隶属公司</th>
- <th>标签</th>
- <th>备注</th>
- <th>创建时间</th>
- <th>操作</th>
- </tr>
- <tr v-for="(logistic,i) in logistics" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
- <td class="text-muted">@{{logistic.id}}</td>
- <td>@{{logistic.name}} <span class="badge badge-success" v-if="logistic.is_bunched=='Y'">子母单</span></td>
- <td>@{{logistic.english_name}}</td>
- <td>@{{logistic.code}}</td>
- <td>@{{logistic.mobile}}</td>
- <td>@{{logistic.type}}</td>
- <td>@{{logistic.delivery_fee}}</td>
- <td>@{{logistic.belong_company}}</td>
- <td>@{{logistic.tag}}</td>
- <td>@{{logistic.remark}}</td>
- <td class="text-muted">@{{logistic.created_at}}</td>
- <td>
- @can('承运商-编辑')
- <button class="btn btn-sm btn-outline-primary" @click="edit(logistic.id)">改</button> @endcan
- @can('承运商-删除')
- <button class="btn btn-sm btn-outline-dark" @click="destroy(logistic)">删</button> @endcan
- </td>
- </tr>
- </table>
- {{$logistics->links()}}
- </div>
- </div>
- </div>
- @endsection
- @section('lastScript')
- <script>
- new Vue({
- el:"#list",
- data:{
- logistics:[
- @foreach( $logistics as $logistic )
- {id:'{{$logistic->id}}',name:'{{$logistic->name}}',code:'{{$logistic->code}}',
- mobile:"{{$logistic->mobile}}",type:"{{$logistic->type}}",delivery_fee:"{{$logistic->delivery_fee}}",
- tag:"{{$logistic->tag}}",
- remark:"{{$logistic->remark}}",belong_company:"{{$logistic->belong_company}}",created_at:'{{$logistic->created_at}}',is_bunched:"{{$logistic->is_bunched}}"},
- @endforeach
- ],
- selectTr:0
- },
- methods:{
- edit:function(id){
- location.href = "{{url('maintenance/logistic')}}/"+id+"/edit";
- },
- destroy:function(logistic){
- if(!confirm('确定要删除物流公司“' + logistic.name + '”吗?')){return};
- let data=this;
- let url = "{{url('maintenance/logistic')}}/"+logistic.id;
- axios.delete(url,{id:logistic.id})
- .then(function (response) {
- if(response.data.success){
- for (let i = 0; i < data.logistics.length; i++) {
- if (data.logistics[i].id===logistic.id){
- data.logistics.splice(i,1);
- break;
- }
- }
- tempTip.setDuration(1000);
- tempTip.showSuccess('删除物流公司"'+logistic.name+'"成功!')
- }else{
- tempTip.setDuration(1000);
- tempTip.show('删除物流公司"'+logistic.name+'"失败!')
- }
- })
- .catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('删除物流公司失败!'+'网络错误:' + err)
- });
- },
- }
- });
- </script>
- @endsection
|