123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741 |
- @extends('admin/master')
- @section('content')
- <body>
- @if(count($errors) > 0)
- <div class="Huialert Huialert-info" id="error">
- @foreach($errors->all() as $error)
- <li>{{$error}}</li>
- @endforeach
- </div>
- @endif
- <style type="text/css">
- #good_sku{
- position: absolute;
- z-index: 9;
- background: #ffffff;
- box-shadow: 1px 1px 1px 1px #ccc;
- width: calc(100% - 30px);
- }
- #good_sku li{
- font-size: 12px;
- line-height: 24px;
- cursor: pointer;
- padding: 5px 10px;
- }
- #good_sku li:hover{
- background: #eaeaea;
- }
- </style>
- <div class="page-container">
- <form id='order-form' action="/admin/fxorder/update" method="post" class="form form-horizontal" enctype="multipart/form-data" onkeypress="return event.keyCode != 13;">
- <input type="hidden" name="_token" value="{{ csrf_token() }}" />
- <input type='hidden' name='str_query' value="{{$str_query}}"/>
- <input type='hidden' name='last_url' value="{{$last_url}}"/>
- @if($order)
- <input type="hidden" name="id" value="{{$order['id']}}" />
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>买家姓名:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['customerName']}}" placeholder="请输入名称" name="customerName">
- </div>
- </div>
-
-
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>收件人姓名:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['receiverName']}}" placeholder="" name="receiverName">
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>收件人手机号:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['receiverMobile']}}" placeholder="" name="receiverMobile">
- </div>
- </div>
-
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>省/直辖市:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['receiverState']}}" placeholder="" name="receiverState">
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>市:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['receiverCity']}}" placeholder="" name="receiverCity">
- </div>
- </div>
- <!--div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- 区:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['receiverDistrict']}}" placeholder="" name="receiverDistrict">
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- 街道:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['receiverStreet']}}" placeholder="" name="receiverStreet">
- </div>
- </div-->
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>详细地址:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['receiverAddress']}}" placeholder="" name="receiverAddress">
- </div>
- </div>
- @if($self_role !='分销销售' && $self_role != '分销管理员' )
- @if( $order['status']>1 && $self_role !='超级管理员')
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>商品信息:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <textarea class="textarea" placeholder="填写商品详细信息,A或B仓必填" readonly="true" >{{$order['goods_note']}}</textarea>
- <input type="hidden" name="goods_note" value="{{$order['goods_note']}}" />
- </div>
- </div>
- @else
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>商品信息:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <textarea class="textarea" placeholder="填写商品详细信息,A或B仓必填" name="goods_note">{{$order['goods_note']}}</textarea>
- </div>
- </div>
- @endif
- @endif
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>预发货时间:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input id="delivery" type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd' })" class="input-text Wdate" style="width:22%;text-align:center;" name="delivery_date" value="{{$order['delivery_date']}}"><font color='red'> </font>
- </div>
- </div>
- @if($self_role !='分销销售' && $self_role != '分销管理员' )
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- 物流单号:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['logistics_id']}}" placeholder="" name="logistics_id">
- </div>
- </div>
- @endif
- @if($self_role == '超级管理员' || $self_role == '售后管理员')
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>发货仓库:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <span class="select-box">
- <select size="1" name="warehouse" id='warehouse'>
- <option value="0" @if($order['warehouse']=='0') selected @endif>- 请选择 -</option>
- <option value="1" @if($order['warehouse']=='1') selected @endif>A仓库</option>
- <option value="2" @if($order['warehouse']=='2') selected @endif>B仓库</option>
- <option value="3" @if($order['warehouse']=='3') selected @endif>C仓库</option>
- </select>
- </span>
- </div>
- </div>
- @else
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>发货仓库:</label>
- <div class="formControls col-xs-6 col-sm-6">
- @if($order['warehouse']=='1') A仓库 @endif
- @if($order['warehouse']=='2') B仓库 @endif
- @if($order['warehouse']=='3') C仓库 @endif
- <input type="hidden" name="warehouse" id='warehouse' value="{{$order['warehouse']}}"/>
- </div>
- </div>
- @endif
- @if($self_role !='销售' && $self_role != '分销销售' && $self_role != '分销管理员' )
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- 成本:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['cost']}}" placeholder="" name="cost">
- </div>
- </div>
- @endif
- @if( $order['status'] <2 || !$order['goods'] )
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">搜索选择商品:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type='text' class="input-text" autocomplete="off" name='goods_name' placeholder="输入关键词搜索商品,C仓必须选择" value=''/>
- <ul id="good_sku"></ul>
- </div>
- </div><br>
- @endif
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>已选择商品:</label>
- <div id='goods_o' class="formControls col-xs-6 col-sm-6">
- <input class="input-text" id='g_info' type='hidden' name='g_info' value=''/>
- @if($order['goods'])
- @foreach($order['goods'] as $k=>$good)
- <p>{{$good['name']}} 【 规格:{{$good['props_name']}} 价格:¥{{$good['price']}} 库存:{{$good['quantity_str']}}】 <input type='hidden' name='skus[]' value="{{$good['sku_id']}}" /><font style="font-weight: bold;"> @if($good['is_weigh']==0) 数量 @else重量 @endif</font> @if($order['status'] < 2)<button style='width:14px;' type='button' onclick="cut_num({{$good['sku_id']}},{{$good['price']}})">-</button><input style='width:45px;' id='gnum{{$good["sku_id"]}}' class='gnums' price='{{$good["price"]}}' is_weigh='{{$good["is_weigh"]}}' quantity='{{$good["quantity"]}}' is_white='{{$good["is_white"]}}' type='text' name='gnum[]' value='{{$good["num"]}}' /><button style='width:14px;' type='button' onclick="add_num({{$good['sku_id']}},{{$good['price']}})">+</button>@if($good['is_weigh']==1)(斤) @endif <button type='button' onclick="del_sku(this,{{$good['sku_id']}},{{$good['price']}})"> 移除</button>@if($good['is_weigh']==1) <font color='red'>(称重商品,至少0.5斤) </font> @endif @else :{{$good["num"]}} @if($good['is_weigh']==1)斤【称重商品】 @endif<input type='hidden' id='gnum{{$good["sku_id"]}}' class='gnums' price='{{$good["price"]}}' name='gnum[]' value='{{$good["num"]}}' /> @endif </p>
- @endforeach
- @endif
- </div>
-
- </div><br>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- 应收金额:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <span id='should_amount_show'>{{$order['should_amount']}}</span>
- <input id='should_amount' type="hidden" class="input-text" value="{{$order['should_amount']}}" placeholder="" name="should_amount">
- </div>
- </div>
- @if( $order['status']>1 && $self_role !='超级管理员')
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>实付金额:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['receivedAmount']}}" placeholder="" readonly />
- <input type="hidden" id='receivedAmount' class="input-text" value="{{$order['receivedAmount']}}" name="receivedAmount"/>
- </div>
- </div>
- @else
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>实付金额:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" id='receivedAmount' class="input-text" value="{{$order['receivedAmount']}}" placeholder="" name="receivedAmount">
- </div>
- </div>
- @endif
- @if($order['payment_type']=='4')
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>支付方式:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="radio" name="payment_type" value="4" checked >
- <label for="status-0" style="margin-right: 27px;">充值卡支付</label>
- </div>
- </div>
- @else
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>支付方式:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="radio" name="payment_type" value="1" @if($order['payment_type']=='1') checked @endif>
- <label for="status-1" style="margin-right: 27px;">微信支付</label>
- @if($order['payment_type']=='2')
- <input type="radio" name="payment_type" value="2" checked >
- <label for="status-0" style="margin-right: 27px;">付款码支付</label>
- @endif
- <input type="radio" name="payment_type" value="3" @if($order['payment_type']=='3') checked @endif>
- <label for="status-0" style="margin-right: 27px;">个体户支付</label>
- @if($self_role != '分销销售' && $self_role != '分销管理员')
- <input type="radio" name="payment_type" value="4" @if($order['payment_type']=='4') checked @endif>
- <label for="status-0" style="margin-right: 27px;">充值卡支付</label>
- @endif
- </div>
- </div>
- @endif
- @if($order['payment_type'] != 4)
- <div class="row cl" style="display: none" id='deposit_div'>
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'> </font>充值卡号:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input id='deposit_phone_i' type="text" class="input-text" value="{{old('deposit_phone')}}" placeholder="*默认收货人手机号" disabled name="deposit_phone_i">
- <input id='deposit_phone' type="hidden" class="input-text" value="{{old('deposit_phone')}}" placeholder="" name="deposit_phone">
- <font color='red' id='vip_pay'></font>
- </div>
- </div>
- @else
- <div class="row cl" id='deposit_div'>
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'> </font>充值卡号:</label>
- <div class="formControls col-xs-6 col-sm-6">
- {{$deposit_phone}}
- <input type="hidden" name='deposit_phone' value="{{$deposit_phone}}" />
- <font color='red' id='vip_pay'></font>
- </div>
- </div>
- @endif
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>是否退补单:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="radio" name="is_refund" value="0" @if($order['is_refund']=='0') checked @else checked @endif>
- <label for="status-1" style="margin-right: 27px;">否</label>
- <input type="radio" name="is_refund" value="1" @if($order['is_refund']=='1') checked @endif>
- <label for="status-0">是</label>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- 应该退补差价:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="text" class="input-text" value="{{$order['refund_price']}}" placeholder="" name="refund_price">
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>是否退款:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input type="radio" name="order_status" value="0" @if($order['order_status']=='0') checked @else checked @endif>
- <label for="status-1" style="margin-right: 27px;">否</label>
- <input type="radio" name="order_status" value="2" @if($order['order_status']=='2') checked @endif>
- <label for="status-2">是</label>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- <font color='red'>* </font>下单时间:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <input id="createTime" type="text" class="input-text" style="width:22%;text-align:center;" name="createTime" value="{{$order['createTime']}}" disabled> <font color='red'> *不可变更 </font>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- 买家备注:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <textarea class="textarea" placeholder="填写买家备注..." name="buyerMemo">{{$order['buyerMemo']}}</textarea>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- 卖家备注:</label>
- <div class="formControls col-xs-6 col-sm-6">
- <textarea class="textarea" placeholder="填写卖家备注..." name="sellerMemo">{{$order['sellerMemo']}}</textarea>
- </div>
- </div>
- @if(0)
- @if($self_role !='销售' && $self_role != '分销销售' )
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">
- 选择销售员(不选默认当前用户):</label>
- <div class="formControls col-xs-6 col-sm-6">
- <span class="select-box">
- <select size="1" name="team" id='team'>
- <option value="0" @if($order['team_id']=='') selected @endif>选择团队</option>
- @foreach($teamlist as $v)
- <option value="{{$v['id']}}" @if($order['team_id']==$v['id']) selected @endif>{{$v['name']}}</option>
- @endforeach
- </select>
- <select id='admins' size="1" name="admin_id">
- <option value="0" @if($order['admin_id']=='') selected @endif>-- 选择销售 --</option>
- @foreach($adminlist as $v)
- <option value="{{$v['id']}}" @if($order['admin_id']==$v['id']) selected @endif>{{$v['realname']}}</option>
- @endforeach
- </select>
-
- </span>
- </div>
- </div>
- @endif
- @endif
-
- @endif
- <div class="row cl">
- <div class="col-9 col-offset-2">
- <button class="btn btn-primary radius" type="button" onclick="to_submit()" value=" 提交 "> 提交 </button>
- <button class="btn btn-default" type="reset" onclick="return_index();"> 返回 </button>
- </div>
- </div>
- </form>
- </div>
- <!--_footer 作为公共模版分离出去-->
- <script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
- <script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
- <script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
- <script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
- <!--/_footer 作为公共模版分离出去-->
- <!--请在下方写此页面业务相关的脚本-->
- <script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
- <script type="text/javascript">
- $(function(){
- setTimeout("$('#error').hide()",3000);
- $('#team').change(function(){
- team = $('#team').val();
- if(team==''){
- return false;
- }
- $.ajax({
- 'url':'/admin/fxorder/teamAdmins/'+team,
- 'type': 'get',
- 'dataType':'json',
- 'success' : function(data){
- str = '<option value=\'0\'>-- 选择销售 --<\/option>';
- $.each(data, function(i, va){
- str += '<option value="'+va.id+'">' + va.realname +'<\/option>';
- })
-
- $('#admins').html(str);
- }
- });
- })
- $('input[type=radio][name=payment_type]').change(function () {
- var payment_type = $("input[type='radio'][name='payment_type']:checked").val();
- if(payment_type==4){
- var phone = "{{$order['deposit_phone']}}";
- $("#deposit_phone").val(phone);
- $("#deposit_phone_i").val(phone);
- //获取充值卡余额
- var reg = /^1\d{10}$/
- if(!reg.test(phone)){
- return false;
- }
- $.ajax({
- 'url':'/admin/cust/getBalance/'+phone,
- 'type': 'get',
- 'success' : function(data){
- var str = '【充值卡余额为:'+data+'元】';
- $("#vip_pay").html(str);
- }
- });
- $("#deposit_div").show();
- }else{
- $("#deposit_div").hide();
- }
- })
- });
- function getBalance(){
- var phone = $("input[name=deposit_phone]").val();
- var reg = /^1\d{10}$/
- if(!reg.test(phone)){
- $("#vip_pay").html('【充值卡余额为:0元】');
- return false;
- }
- //获取充值卡余额
- $.ajax({
- 'url':'/admin/cust/getBalance/'+phone,
- 'type': 'get',
- 'success' : function(data){
- var str = '【充值卡余额为:'+data+'元】';
- $("#vip_pay").html(str);
- }
- });
- }
- /*返回*/
- function return_index(){
- location.href='/admin/fxorder/index';
- }
- function add_goods(goods_id,sku_id,name,props_name,price,is_weigh,quantity,is_white){
- var gnum = $("#gnum"+sku_id).val();
- var weigh_unit = '数量';
- var weigh_note = '';
- var weigh_unit_name = '';
- if(is_weigh == 1){
- weigh_unit = '重量';
- weigh_unit_name = '(斤)';
- weigh_note = '<font color=\'red\'> (称重商品,至少0.5斤) <\/font>';
- }
- if(gnum){
- var n = gnum;
- n = parseFloat(n)+1
- $("#gnum"+sku_id).val(n);
- }
- else{
- var quantity_str = '库存:'+quantity;
- if(is_white==1){
- quantity_str = '虚拟库存';
- }
- var str = "<div>"+name+' 【 规格:'+props_name+' 价格:¥'+price+' '+quantity_str+" 】 <input type='hidden' name='skus[]' value="+sku_id+" \/><font style=\"font-weight: bold;\">"+weigh_unit+" <\/font><button style='width:14px;' type='button' onclick=\"cut_num("+sku_id+","+ price + ","+ is_weigh +")\">-<\/button><div style=\"display:inline-block\" id='gnum_con"+ sku_id +"' ><input style='width:40px;' id='gnum"+ sku_id +"' class='gnums' onkeyup='sync_money();' price="+price+" is_weigh="+is_weigh+" quantity="+quantity+" is_white="+is_white+" type=\'text\' name=\'gnum[]\' value=1 \/><\/div><button style='width:14px;' type='button' onclick=\"add_num("+sku_id+","+ price + ","+ is_weigh +")\">+<\/button>"+weigh_unit_name+" <button type='button' onclick='del_sku(this, "+sku_id+","+ price + ")'> 移除<\/button> "+weigh_note+"<\/div>";
- $("#goods_o").append(str);
- sessionStorage.setItem('goods_o_con',$("#goods_o").html());
- }
- sync_money()
- document.getElementById('good_sku').style.display='none'
- return false;
- }
- function add_num(sku_id, price){
- var gnum = $("#gnum"+sku_id).val();
- var n = gnum;
- n = parseFloat(n)+1
- $("#gnum"+sku_id).val(n);
- sync_money()
- return false;
- }
- function cut_num(sku_id, price){
- var gnum = $("#gnum"+sku_id).val();
- var n = gnum;
- if(n <= 1){
- return false;
- }
- n = parseFloat(n)-1;
- $("#gnum"+sku_id).val(n);
- sync_money()
- return false;
- }
- function del_sku(obj, sku_id, price){
- var gnum = $("#gnum"+sku_id).val();
- $(obj).parent().remove();
- sync_money();
- }
- function sync_money(){
- var gnums = new Array();
- var total = 0;
- $('.gnums').each(function(key, value){
- var gnum = $(this).val();
- var price = $(this).attr('price');
- total = total + parseFloat(price) * parseFloat(gnum);
- });
- if(total>0){
- $("#should_amount").val(total);
- $("#should_amount_show").html(total);
- }else{
- $("#should_amount").val('');
- $("#should_amount_show").html('');
- }
- return false;
- }
- function getGoods(){
- var name = $('input[name=goods_name]').val();
- if(!name){
- return false;
- }
- $.ajax({
- 'url': '/admin/goods/searchSkus?name='+name,
- 'type': 'get',
- 'dateType': 'json',
- success:function(data){
- if(data != '0'){
- data = eval("("+data+")");
- }
- }
- })
- }
- $('input[name=goods_name]').on('keyup focus', function(){
- var name = $('input[name=goods_name]').val();
- if(!name){
- return false;
- }
- $.ajax({
- 'url': '/admin/goods/searchSkus',
- 'type': 'get',
- 'data':{name:name},
- 'dateType': 'json',
- success:function(data){
- if(data != '0'){
- data = eval("("+data+")");
- var str = '';
- for (var i = 0, l = data.length; i < l; i++) {
- var item = data[i];
- var weigh_t = '';
- if(item.is_weigh==1){
- weigh_t = '【按半斤称重】';
- }
- if(item.is_white == 0 && item.quantity <= 0){
- weigh_t += '<font color="red">【库存不足】<\/font>';
- str += '<li>'+ item.name+'【 规格:'+item.propsName+' 价格:¥'+item.price +' 】'+weigh_t+'<\/li>'
- }
- else{
- str += '<li onclick=\'add_goods('+item.goods_id+','+item.sku_id+',"'+item.name+'","'+item.propsName+'",'+item.price+','+item.is_weigh+','+item.quantity+','+item.is_white+');\'>'+ item.name+'【 规格:'+item.propsName+' 价格:¥'+item.price +' 】'+weigh_t+'<\/li>'
- }
- // '<p onclick=\'add_goods('+item.goods_id+','+item.sku_id+',"'+item.name+'","'+item.propsName+'",'+item.price+');\'>'+ item.name+' '+item.propsName+' ¥'+item.price +'<\/p>';
- }
- document.getElementById('good_sku').innerHTML = str;
- document.getElementById('good_sku').style.display='block'
-
- // layer.open({
- // type: 1,
- // area: ['600px', '360px'],
- // shadeClose: true, //点击遮罩关闭
- // content: str
- // });
- }
- }
- })
-
-
- });
- $('body').on('click', function(){
- $('input[name=goods_name]').on('click',function(e){
- e.stopPropagation();
- });
- document.getElementById('good_sku').style.display='none'
- })
- function to_submit(){
- if(!form_verify()){
- return false;
- }
- var warehouse = $("#warehouse").val();
- if(warehouse == 3){
- var if_good = $('.gnums');
- if(!if_good.length){
- layer.msg('仓库C必须选择商品!',{icon:2,time:1000});
- return false;
- }
- }
- $(".btn").attr("disabled",true);
- $("#order-form").submit();
- return true;
- }
- function weigh_verify(){
- var if_no = 0;
- $('.gnums').each(function(key, value){
- var gnum = $(this).val();
- gnum = parseFloat(gnum);
- var is_weigh = $(this).attr('is_weigh');
- if(gnum<0.5){
- if_no = 1;
- return;
- }
- if(is_weigh == 0 && gnum%1 != 0){
- if_no = 2;
- return;
- }
- if(is_weigh == 1 && gnum%0.5 != 0){
- if_no = 3;
- return;
- }
- var quantity = $(this).attr('quantity');
- var is_white = $(this).attr('is_white');
- if(is_white==0 && gnum>quantity){
- if_no=4;
- return;
- }
- });
- return if_no;
- }
- function form_verify(){
- //验证称重>0.5
- var if_no = weigh_verify();
- if(if_no > 0){
- if(if_no == 1){
- layer.msg('商品数量填写有误!',{icon:2,time:1500});
- }
- if(if_no == 2){
- layer.msg('非称重商品数量必须为整数!',{icon:2,time:1500});
- }
- if(if_no == 3){
- layer.msg('称重商品重量必须为0.5的倍数!',{icon:2,time:1500});
- }
- if(if_no == 4){
- layer.msg('商品数量不得大于库存量!',{icon:2,time:1500});
- }
- return false;
- }
- //验证充值卡
- var old_payment_type = "{{$order['payment_type']}}";
- var old_receivedAmount = "{{$order['receivedAmount']}}";
- old_receivedAmount = parseFloat(old_receivedAmount);
- var is_ok = 1;
- var receivedAmount = $("input[name=receivedAmount]").val();
- var payment_type = $("input[type='radio'][name='payment_type']:checked").val();
- if( payment_type==4 && old_payment_type != 4 ){
- var phone = $("input[name=deposit_phone]").val();
- if(!phone){
- is_ok = 0;
- }
- //获取充值卡余额
- $.ajax({
- url:'/admin/cust/getBalance/'+phone,
- type: 'get',
- async:false,
- success : function(data){
- data=parseFloat(data);
- receivedAmount=parseFloat(receivedAmount);
- if(data<receivedAmount){
- is_ok = 0;
- }else{
- is_ok = 1;
- }
- }
- });
- if(is_ok==0){
- layer.msg('充值卡余额不足,请充值后再进行该操作!',{icon:2,time:1500});
- return false;
- }
- }
- if( payment_type==4 && old_payment_type==4 && old_receivedAmount != receivedAmount ){
- var phone = "{{$deposit_phone}}"
- if(old_receivedAmount < receivedAmount){
- //金额增加,判断余额
- var money = receivedAmount - old_receivedAmount;
- //获取充值卡余额
- $.ajax({
- url:'/admin/cust/getBalance/'+phone,
- type: 'get',
- async:false,
- success : function(data){
- data=parseFloat(data);
- money=parseFloat(money);
- if(data<money){
- is_ok = 0;
- }else{
- is_ok = 1;
- }
- }
- });
- }
- if(is_ok==0){
- layer.msg('充值卡余额不足,请充值后再进行该操作!',{icon:2,time:1500});
- return false;
- }
- }
- return true;
- }
- </script>
- </body>
- @endsection
|