| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- @extends('layouts.base')
- @section('content')
- @section('title', trans('配送模板详情'))
- <div class="rightlist">
- <!-- 新增加右侧顶部三级菜单 -->
- <div class="right-titpos">
- <ul class="add-snav">
- <li class="active"><a href="#">配送方式设置</a></li>
- </ul>
- </div>
- <!-- 新增加右侧顶部三级菜单结束 -->
- <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data"
- onsubmit='return formcheck()'>
- <div class="panel panel-default">
- <div class="panel-body">
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
- <div class="col-sm-9 col-xs-12">
- <input type="text" name="dispatch[display_order]" class="form-control"
- value="{{ $dispatch['sort'] }}"/>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>配送方式名称</label>
- <div class="col-sm-9 col-xs-12">
- <input type="text" id='dispatchname' name="dispatch[dispatch_name]" class="form-control"
- value="{{ $dispatch['name'] }}"/>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否为默认快递模板</label>
- <div class="col-sm-9 col-xs-12">
- <label class='radio-inline'>
- <input type='radio' name='dispatch[is_default]' id="isdefault1" value='1'
- @if ( $dispatch['is_default'] == 1 )checked @endif /> 是
- </label>
- <label class='radio-inline'>
- <input type='radio' name='dispatch[is_default]' id="isdefault0" value='0'
- @if ( $dispatch['is_default'] == 0 )checked @endif /> 否
- </label>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">计费方式</label>
- <div class="col-sm-9 col-xs-12">
- <label class='radio-inline'>
- <input type='radio' name='dispatch[calculate_type]' value='1'
- @if ( $dispatch['charge_type'] == 1 || empty($dispatch['charge_type']) )checked @endif /> 按重量计费
- </label>
- <label class='radio-inline'>
- <input type='radio' name='dispatch[calculate_type]' value='2'
- @if ( $dispatch['charge_type'] == 2 ) checked @endif /> 按件计费
- </label>
- </div>
- </div>
- <div class="form-group dispatch0">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">配送区域</label>
- <div class="col-sm-9 col-xs-12">
- <table class="show_h" areas="1">
- <thead>
- <tr>
- <th style="height:40px;width:400px;">运送到</th>
- <th style="width:120px;">首重(克)</th>
- <th style="width:120px;">首费(元)</th>
- <th style="width:120px;">续重(克)</th>
- <th style="width:120px;">续费(元)</th>
- </tr>
- </thead>
- <tbody class='tbody-areas'>
- <tr>
- <td style="padding:10px;">
- 全国 [默认运费]
- <input type="hidden" value="全国 [默认运费]" class="form-control"
- name="dispatch[areas]">
- </td>
- <td class=" text-center">
- <input type="number" value="{{ $dispatch['default']['f'] ? $dispatch['default']['f'] :0 }}" class="form-control"
- name="dispatch[first_weight]" style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $dispatch['default']['fp'] ? $dispatch['default']['fp']/100 : 0 }}"
- class="form-control" name="dispatch[first_weight_price]"
- style="width:100px;"></td>
- <td class=" text-center">
- <input type="number" value="{{ $dispatch['default']['n'] ? $dispatch['default']['n'] : 0 }}"
- class="form-control" name="dispatch[another_weight]"
- style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $dispatch['default']['np'] ? $dispatch['default']['np']/100 : 0 }}"
- class="form-control" name="dispatch[another_weight_price]"
- style="width:100px;"></td>
- <td class=""></td>
- </tr>
- @foreach($dispatch['other'] as $key=>$weight)
- <tr>
- <td style="padding:10px;" class="{{$key}}">
- <span class="areas">{{$weight['a']}}</span>
- <input type="hidden" value="{{$weight['a']}}" class="form-control areas-name"
- name="dispatch[weight][{{$key}}][areas]">
- <input type="hidden" value="{{$weight['area_ids']}}" class="form-control areas-ids"
- name="dispatch[weight][{{$key}}][area_ids]">
- <a href='javascript:;' onclick='editArea(this)' random="{{$key}}">编辑</a>
- </td>
- <td class=" text-center">
- <input type="number" value="{{ $weight['f'] ? $weight['f'] : 0 }}"
- class="form-control"
- name="dispatch[weight][{{$key}}][first_weight]" style="width:100px;">
- </td>
- <td class=" text-center">
- <input type="text" value="{{ $weight['fp'] ? $weight['fp']/100 : 0}}"
- class="form-control"
- name="dispatch[weight][{{$key}}][first_weight_price]"
- style="width:100px;"></td>
- <td class=" text-center">
- <input type="number" value="{{ $weight['n'] ? $weight['n'] : 0}}"
- class="form-control"
- name="dispatch[weight][{{$key}}][another_weight]"
- style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $weight['np'] ? $weight['np']/100 :0}}"
- class="form-control"
- name="dispatch[weight][{{$key}}][another_weight_price]"
- style="width:100px;">
- </td>
- <td><a href="javascript:;" onclick="$(this).parent().parent().remove()"><i class='fa fa-remove'></i></td>
- </tr>
- @endforeach
- </tbody>
- </table>
- <!--=================================================-->
- <table class='show_n' areas="2">
- <thead>
- <tr>
- <th style="height:40px;width:400px;">运送到</th>
- <th class="show_n" style="width:120px;">首件(个)</th>
- <th class="show_n" style="width:120px;">运费(元)</th>
- <th class="show_n" style="width:120px;">续件(个)</th>
- <th class="show_n" style="width:120px;">续费(元)</th>
- </tr>
- </thead>
- <tbody class='tbody-areas'>
- <tr>
- <td style="padding:10px;">
- 全国 [默认运费]
- <input type="hidden" value="全国 [默认运费]" class="form-control"
- name="dispatch[areas]">
- </td>
- <td class=" text-center">
- <input type="number" value="{{ $dispatch['default']['f'] ? $dispatch['default']['f'] : 0 }}" class="form-control"
- name="dispatch[first_piece]" style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $dispatch['default']['fp'] ? $dispatch['default']['fp']/100 : 0 }}"
- class="form-control" name="dispatch[first_piece_price]"
- style="width:100px;"></td>
- <td class=" text-center">
- <input type="number" value="{{ $dispatch['default']['n'] ? $dispatch['default']['n'] : 0 }}" class="form-control"
- name="dispatch[another_piece]" style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $dispatch['default']['np'] ? $dispatch['default']['np']/100 : 0 }}"
- class="form-control" name="dispatch[another_piece_price]"
- style="width:100px;"></td>
- <td></td>
- </tr>
- @foreach($dispatch['other'] as $key=>$piece)
- <tr>
- <td style="padding:10px;" class="{{$key}}">
- <span class="areas">{{$piece['a']}}</span>
- <input type="hidden" value="{{$piece['a']}}" class="form-control areas-name"
- name="dispatch[piece][{{$key}}][areas]">
- <input type="hidden" value="{{$piece['area_ids']}}" class="form-control areas-ids"
- name="dispatch[piece][{{$key}}][area_ids]">
- <a href='javascript:;' onclick='editArea(this)' random="{{$key}}">编辑</a>
- </td>
- <td class=" text-center">
- <input type="number" value="{{ $piece['f'] ? $piece['f'] :0 }}"
- class="form-control"
- name="dispatch[piece][{{$key}}][first_piece]" style="width:100px;">
- </td>
- <td class=" text-center">
- <input type="text" value="{{ $piece['fp'] ? $piece['fp']/100 :0 }}"
- class="form-control"
- name="dispatch[piece][{{$key}}][first_piece_price]"
- style="width:100px;"></td>
- <td class=" text-center">
- <input type="number" value="{{ $piece['n'] ? $piece['n'] :0 }}"
- class="form-control" name="dispatch[piece][{{$key}}][another_piece]"
- style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $piece['np'] ? $piece['np']/100 :0 }}"
- class="form-control"
- name="dispatch[piece][{{$key}}][another_piece_price]"
- style="width:100px;">
- </td>
- <td>
- <a href='javascript:;' onclick='$(this).parent().parent().remove()'>
- <i class='fa fa-remove'></i>
- </td>
- </tr>
- @endforeach
- </tbody>
- </table>
- <!--====================================================================================================-->
- <a class='btn btn-default' href="javascript:;" onclick='selectAreas()'><span
- class="fa fa-plus"></span> 新增配送区域</a>
- <span class='help-block show_h'
- @if ( $dispatch['charge_type'] == 1 ) style='display:block' @endif>根据重量来计算运费,当物品不足《首重重量》时,按照《首重费用》计算,超过部分按照《续重重量》和《续重费用》乘积来计算</span>
- <span class='help-block show_n'
- @if ( $dispatch['charge_type'] == 2 ) style='display:block' @endif>根据件数来计算运费,当物品不足《首件数量》时,按照《首件费用》计算,超过部分按照《续件数量》和《续件费用》乘积来计算</span>
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否启用</label>
- <div class="col-sm-9 col-xs-12">
- <label class='radio-inline'>
- <input type='radio' name='dispatch[enabled]' value='1'
- @if ( $dispatch['publish'] == 1 ) checked @endif /> 是
- </label>
- <label class='radio-inline'>
- <input type='radio' name='dispatch[enabled]' value='0'
- @if ( $dispatch['publish'] == 0 ) checked @endif /> 否
- </label>
- </div>
- </div>
- <div class="form-group"></div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
- <div class="col-sm-9 col-xs-12">
- <input type="submit" name="submit" value="提交" class="btn btn-success "
- onclick="return formcheck()"/>
- <input type="button" name="back" onclick='history.back()' value="返回列表"
- class="btn btn-default back"/>
- </div>
- </div>
- </div>
- </form>
- </div>
- <script>
- var calculateType = '{{ $dispatch['ChargeType'] ?: 1 }}';
- var random = "{{$random}}";
- function show_type(flag) {
- calculateType = flag;
- if (flag == 2) {
- $('.weight').css("display", "none");
- $('.fnum').css("display", "");
- $('.show_h').hide();
- $('.show_n').show();
- } else {
- $('.weight').css("display", "");
- $('.fnum').css("display", "none");
- $('.show_h').show();
- $('.show_n').hide();
- }
- }
- $(function () {
- show_type(calculateType);
- $(':radio[name="dispatch[calculate_type]"]').click(function () {
- var val = $(this).val();
- show_type(val);
- })
- });
- function clearSelects() {
- $('.city').attr('checked', false).removeAttr('disabled');
- $('.cityall').attr('checked', false).removeAttr('disabled');
- $('.citycount').html('');
- }
- function selectAreas() {
- clearSelects();
- $("#modal-areas").modal();
- var citystrs = '';
- var citystrIds = '';
- $('#btnSubmitArea').unbind('click').click(function () {
- random++;
- $('.city:checked').each(function () {
- citystrs += $(this).attr('city') + ";";
- citystrIds += $(this).attr('city_id') + ";";
- });
- if (calculateType == 1) {
- var content = `
- <tr class="show_h">
- <td style="padding:10px;" name="areas" class="${random}">
- <span class="areas">${citystrs}</span>
- <input type="hidden" value="${citystrs}" class="form-control areas-name" name="dispatch[weight][${random}][areas]">
- <input type="hidden" value="${citystrIds}" class="form-control areas-ids" name="dispatch[weight][${random}][area_ids]">
- <a href='javascript:;' onclick='editArea(this)' random="${random}">编辑</a>
- </td>
- <td class=" text-center">
- <input type="number" value="{{ $dispatch->first_weight }}" class="form-control" name="dispatch[weight][${random}][first_weight]" style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $dispatch->first_weight_price }}" class="form-control" name="dispatch[weight][${random}][first_weight_price]" style="width:100px;"></td>
- <td class=" text-center">
- <input type="number" value="{{ $dispatch->another_weight }}" class="form-control" name="dispatch[weight][${random}][another_weight]" style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $dispatch->another_weight_price }}" class="form-control" name="dispatch[weight][${random}][another_weight_price]" style="width:100px;"></td>
- <td><a href='javascript:;' onclick='$(this).parent().parent().remove()'><i class='fa fa-remove'></i></td>
- </tr>
- `;
- $("[areas=" + calculateType + "]").children(".tbody-areas").append(content);
- } else {
- var content = `
- <tr class="show_n" class="${random}">
- <td style="padding:10px;">
- <span class="areas">${citystrs}</span>
- <input type="hidden" value="${citystrs}" class="form-control areas-name" name="dispatch[piece][${random}][areas]">
- <input type="hidden" value="${citystrIds}" class="form-control areas-ids" name="dispatch[piece][${random}][area_ids]">
- <a href='javascript:;' onclick='editArea(this)' random="${random}">编辑</a>
- </td>
- <td class=" text-center">
- <input type="number" value="{{ $dispatch->first_piece }}" class="form-control" name="dispatch[piece][${random}][first_piece]" style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $dispatch->first_piece_price }}" class="form-control" name="dispatch[piece][${random}][first_piece_price]" style="width:100px;"></td>
- <td class=" text-center">
- <input type="number" value="{{ $dispatch->another_piece }}" class="form-control" name="dispatch[piece][${random}][another_piece]" style="width:100px;"></td>
- <td class=" text-center">
- <input type="text" value="{{ $dispatch->another_piece_price }}" class="form-control" name="dispatch[piece][${random}][another_piece_price]" style="width:100px;"></td>
- <td><a href='javascript:;' onclick='$(this).parent().parent().remove()'><i class='fa fa-remove'></i></td>
- </tr>
- `;
- $("[areas=" + calculateType + "]").children(".tbody-areas").append(content);
- }
- })
- }
- function editArea(btn){
- current = $(btn).attr('random');
- clearSelects();
- var old_citys = $(btn).prev().val().split(';');
- $('.city').each(function(){
- var parentcheck = false;
- for(var i in old_citys){
- if(old_citys[i]==$(this).attr('city_id')){
- parentcheck = true;
- $(this).get(0).checked = true;
- break;
- }
- }
- if(parentcheck){
- $(this).parent().parent().parent().parent().find('.cityall').get(0).checked= true;
- }
- });
- $("#modal-areas").modal();
- var citystrs = '';
- var citystrIds = '';
- $('#btnSubmitArea').unbind('click').click(function(){
- $('.city:checked').each(function(){
- citystrs += $(this).attr('city') + ";";
- citystrIds += $(this).attr('city_id') + ";";
- });
- $('.' + current + ' .areas').html(citystrs);
- $('.' + current + ' .areas-name').val(citystrs);
- $('.' + current + ' .areas-ids').val(citystrIds);
- });
- var currents = getCurrents(current);
- currents = currents.split(';');
- var citys = "";
- $('.city').each(function(){
- var parentdisabled =false;
- for(var i in currents){
- if(currents[i]!='' && currents[i]==$(this).attr('city_id')){
- $(this).attr('disabled',true);
- $(this).parent().parent().parent().parent().find('.cityall').attr('disabled',true);
- }
- }
- });
- }
- function getCurrents(withOutRandom){
- var citys = "";
- $('.citys').each(function(){
- var crandom = $(this).prev().val();
- if(withOutRandom && crandom==withOutRandom){
- return true;
- }
- citys+=$(this).val();
- });
- return citys;
- }
- </script>
- @include('area.dispatchselectprovinces')
- @endsection
|