Commit 0b174978 by 朱继来

fix

parent c712b775
......@@ -329,6 +329,24 @@ Class AddOrderController extends Controller
}
}
// 切换销售类型
public function switchSaleType(Request $request)
{
if ($request->isMethod('post')) {
$data['sale_type'] = $request->input('sale_type');
$data['cart_ids'] = $request->input('cart_ids');
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'cart/switchSaleType';
$response = json_decode(curlApi($url, $data), true);
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
}
}
// 获取购物车列表
public function cartList(Request $request)
{
......@@ -423,6 +441,40 @@ Class AddOrderController extends Controller
}
}
// 检查期货库存
public function checkStock(Request $request)
{
if ($request->isMethod('post')) {
$cart_info = json_decode($request->input('cart_info', ''), true);
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'goods/detail';
$warning_arr = array();
foreach ($cart_info as $k=>$v) {
$data['id'] = $v['gid'];
$response = json_decode(curlApi($url, $data), true);
// 判断下单数量是否小于库存,若小于则弹出提示信息
if ($v['num'] < $response['data']['goods_number']) {
$temp['goods_name'] = $response['data']['goods_name']; // 型号
$temp['stock'] = $response['data']['goods_number']; // 可用库存
$warning_arr[] = $temp;
}
}
if (!empty($warning_arr)) {
return ['errcode' => -1, 'errmsg' => '所购商品数量小于可用库存', 'data'=>json_encode($warning_arr)];
}
return ['errcode' => 0, 'errmsg' => ''];
}
}
// 提交订单
public function create(Request $request)
{
......@@ -442,12 +494,16 @@ Class AddOrderController extends Controller
$data['user_coupon_id'] = $request->input('user_coupon_id');
}
$data['sale_type'] = $request->input('sale_type', ''); // 自营线上选择销售类型
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
// $url = Config('website.api_domain').'order/createByOrderSystem';
$url = Config('website.api_domain').'order/create';
// echo '<pre>';
// print_r(curlApi($url, $data));die;
$response = json_decode(curlApi($url, $data), true);
if ($response['err_code'] == 0) {
......
......@@ -10,7 +10,7 @@
],
'自营订单' => [
'订单列表' => ['self_order_check', 'self_order_export', 'self_order_cancel', 'self_order_express', 'self_order_invoice_express', 'self_order_update_address', 'self_order_update_invoice', 'self_check_test_order', 'self_order_download_contract', 'self_check_pay'],
'订单列表' => ['self_order_check', 'self_order_export', 'self_order_cancel', 'self_order_express', 'self_order_invoice_express', 'self_order_update_address', 'self_order_update_invoice', 'self_check_test_order', 'self_order_download_contract', 'self_check_pay', 'self_check_order'],
'快递配置' => ['self_order_express_set_check'],
......@@ -28,5 +28,8 @@
'账期管理' => [
'申请列表' => ['order_account_apply_check'],
],
<<<<<<< HEAD
=======
>>>>>>> zjl_qihuo_20181015
];
\ No newline at end of file
......@@ -65,4 +65,7 @@ return [
// 新增自营线上订单付款地址
'pay_online_url' => 'http://www.liexin.com/v3/pay/online?id=',
// 获取自营商品库存
'self-stock-url' => 'http://footstone.liexin.net/webapi/goods_details?sku_id=',
];
......@@ -480,6 +480,39 @@
loading.confirm(user_id, address_id, cart_ids, coupon_id, goods_type); // 确认订单信息
})
// 切换销售类型
$('#sale_type').change(function() {
var coupon_id = $('.user_coupon_id').val();
var address_id = $('.address_id').val();
var user_id = $('.user_id').val();
var sale_type = $(this).val();
var cart_ids = [];
$('.shop-table tbody').find('tr').each(function() {
var cid = $(this).data('cid');
cart_ids.push(cid);
})
if (cart_ids.length > 0) {
$.ajax({
type: "POST",
url: '/ajax/switchSaleType',
data: {sale_type: sale_type, cart_ids: cart_ids},
dataType: "json",
success: function(resp){
if (resp.errcode == 0) {
layer.msg(resp.errmsg);
loading.lists(user_id, goods_type, is_online); // 加载购物车列表
return false;
}
layer.msg(resp.errmsg);
},
})
}
})
// 提交订单
$('.submit-order').click(function() {
var address_id = $('input[name=address_id]').val();
......@@ -531,6 +564,68 @@
datax.user_coupon_id = user_coupon_id;
}
// 自营线上
if (type == 2) {
var sale_type = $('#sale_type').val();
if (sale_type == 2) { // 选择期货
var cart_info = [];
$('.shop-table tbody tr').each(function() {
var gid = $(this).find('.goods_id').text();
var num = $(this).find('.goods_num').val();
cart_info.push({'gid':gid, 'num':num});
})
$.ajax({
type: "POST",
url: '/ajax/checkStock',
data: {cart_info: JSON.stringify(cart_info), num: 11},
dataType: "json",
success: function(resp){
if (resp.errcode == -1) {
var data = eval(resp.data);
var content = '<p>确定设置以下型号为期货吗?</p>';
for (var i = 0; i < data.length; i++) {
content += '<p><span>'+(i+1)+'、</span>'+data[i]['goods_name']+',可用库存:'+data[i]['stock']+'</p>';
}
// 弹出提示
layer.open({
area: ['500px', '300px'],
title: '提示信息',
content: content,
btn:['确定', '取消'],
yes: function(index, layero){
$.ajax({
type: "POST",
url: '/ajax/create',
data: datax,
dataType: "json",
success: function(resp){
if (resp.errcode == 0) {
layer.msg(resp.errmsg);
location.href = '/addorder/success?order_id='+resp.data.order_id+'&type='+resp.data.type;
}
layer.msg(resp.errmsg);
},
})
},
btn2: function(index, layero){
layer.close(index);
}
});
}
},
})
return false;
}
}
$.ajax({
type: "POST",
url: '/ajax/create',
......@@ -576,7 +671,7 @@
// 购物车列表
for (var i = 0; i < len; i++) {
html += '<tr data-cid="'+list[i].cart_id+'">'+
'<td>'+list[i].goods_id+'</td>'+
'<td class="goods_id">'+list[i].goods_id+'</td>'+
'<td>'+list[i].goods_name+'</td>'+
'<td>'+list[i].brand_name+'</td>'+
'<td><input type="text" class="goods_num" name="goods_num" value="'+list[i].goods_number+'"></td>'+
......@@ -593,6 +688,8 @@
$('.shop-lists').show();
$('.shop-table tbody').empty().append(html);
$('#sale_type').val(list[0].sale_type); // 自营线上订单选择销售类型
var address_id = $('.address_id').val();
self.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息
}
......
......@@ -1083,7 +1083,7 @@
$(this).find('.sup_amount_val').text(supplier[sup]);
})
var fee = parseFloat($('input[name="extra_fee"]').val());
var fee = $('input[name="extra_fee"]').val() ? parseFloat($('input[name="extra_fee"]').val()) : 0;
var total = parseFloat(goods_total + fee).toFixed(2);
goods_total = goods_total.toFixed(2);
......@@ -1227,13 +1227,15 @@
var is_newClient = $('input[name=is_newClient]:checked').val();
var client_source = $('input[name=client_source]:checked').val();
var order_status = $('input[name=order_status]:checked').val();
var pay_type = $('input[name=order_pay_type]:checked').val(); // 订单类型
var pay_type = $('input[name=order_pay_type]:checked').val(); // 订单付款类型
var reason = $('input[name=reason]:checked').val();
var payTime = $('.payTime').val();
var payTimeOther = $('.payTimeOther').val();
var sale_id = $('input[name=sale_id]').val();
var order_goods_type = $('input[name=order_goods_type]').val();
if (sale_id == 0) {
// 联营订单需要先指派业务员
if (order_goods_type == 1 && sale_id == 0) {
layer.alert('请先将订单推送给业务员', function(){
location.href = '/sendSales/'+$('input[name=order_id]').val();
});
......@@ -1325,11 +1327,6 @@
}
}
var currencySign = currency == 1 ? '¥' : '$';
var goods_amount = currencySign+$('input[name=goods_amount]').val();
var order_amount = currencySign+$('input[name=order_amount]').val();
var extra_fee = $('input[name=extra_fee]').val() == '' ? '' : currencySign+$('input[name=extra_fee]').val();
if (!is_manager) {
// 设置默认值false
$('input[name=check_failed]').val(0);
......@@ -1358,10 +1355,21 @@
}
}
var currencySign = currency == 1 ? '¥' : '$';
var goods_amount = currencySign+$('input[name=goods_amount]').val();
var order_amount = currencySign+$('input[name=order_amount]').val();
if (order_goods_type == 1) {
var extra_fee = $('input[name=extra_fee]').val() ? currencySign+'0' : currencySign+$('input[name=extra_fee]').val();
var content = '<div><p class="error">请核对订单金额,谨慎操作!</p><div><p>商品总金额:'+goods_amount+'</p><p>附加费金额:'+extra_fee+'</p><p>订单总金额:<span class="error">'+order_amount+'</span></p></div></div>';
} else {
var content = '<div><p class="error">请核对订单金额,谨慎操作!</p><div><p>商品总金额:'+goods_amount+'</p><p>订单总金额:<span class="error">'+order_amount+'</span></p></div></div>';
}
// 弹出提示
layer.open({
title: '提醒',
content: '<div><p class="error">请核对订单金额,谨慎操作!</p><div><p>商品总金额:'+goods_amount+'</p><p>附加费金额:'+extra_fee+'</p><p>订单总金额:<span class="error">'+order_amount+'</span></p></div></div>',
content: content,
btn:['取消','确定'],
yes: function(index, layero){
layer.close(index);
......
......@@ -12,6 +12,7 @@
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
order_status = $('#order_status').data('default'),
sale_type = $('#sale_type').data('default'),
order_send = $('#order_send').data('default'),
order_source_pf = $('#order_source_pf').data('default'),
order_payment_mode = $('#order_payment_mode').data('default'),
......@@ -44,6 +45,10 @@
listUrl += '&order_status=' + order_status;
}
if (sale_type) {
listUrl += '&sale_type=' + sale_type;
}
if (order_send) {
listUrl += '&order_send=' + order_send;
}
......@@ -76,7 +81,7 @@
listUrl += '&test_order=' + 1;
}
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && (is_new === '') && !test_order.is(':checked')) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && (is_new === '') && !test_order.is(':checked')) {
listUrl = '/self_order';
}
......@@ -90,6 +95,7 @@
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
order_status = $('#order_status').data('default'),
sale_type = $('#sale_type').data('default'),
order_send = $('#order_send').data('default'),
order_source_pf = $('#order_source_pf').data('default'),
order_payment_mode = $('#order_payment_mode').data('default'),
......@@ -99,12 +105,12 @@
test_order = $('input[name=test_order]');
if (test_order.length) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && !test_order.is(':checked')) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && !test_order.is(':checked')) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
} else {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
......@@ -124,7 +130,7 @@
test_order = '';
}
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_payment_mode='+order_payment_mode+'&order_status='+order_status+'&order_invoice_status='+order_invoice_status+'&order_send='+order_send+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&test_order='+test_order+'&order_goods_type='+2;
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_payment_mode='+order_payment_mode+'&order_status='+order_status+'&sale_type='+sale_type+'&order_invoice_status='+order_invoice_status+'&order_send='+order_send+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&test_order='+test_order+'&order_goods_type='+2;
})
// 选择查看测试订单
......
......@@ -355,13 +355,23 @@
<div class="ibox-content">
<div class="row">
<p class="con-title"><span style="margin-top: 5px;">订单类型:</span></p>
<p class="con-val">
<select name="sale_type" id="sale_type">
<option value="1" selectd>自营现货</option>
<option value="2">自营期货</option>
</select>
</p>
</div>
<div class="row">
<p class="con-title"><span>商品总额:</span></p>
<p class="con-val goods_amount_val"></p>
</div>
<div class="row">
<input type="hidden" class="user_coupon_id" name="user_coupon_id" value="">
<p class="con-title"><span>选择优惠券:</span></p>
<p class="con-title"><span style="margin-top: 5px;">选择优惠券:</span></p>
<p class="con-val">
<select name="user_coupon" id="user_coupon">
<option value="">请选择</option>
......
......@@ -381,7 +381,7 @@
<div class="row">
<input type="hidden" class="user_coupon_id" name="user_coupon_id" value="">
<p class="con-title"><span>选择优惠券:</span></p>
<p class="con-title"><span style="margin-top: 5px;">选择优惠券:</span></p>
<p class="con-val">
<select name="user_coupon" id="user_coupon">
<option value="">请选择</option>
......
......@@ -6,6 +6,7 @@
<input type="hidden" name="order_sn" value="{{$order_info['order_sn']}}">
<input type="hidden" name="user_id" value="{{$order_info['user_id']}}">
<input type="hidden" name="order_id" value="{{$order_info['order_id']}}">
<input type="hidden" name="order_goods_type" value="{{$order_info['order_goods_type']}}">
<input type="hidden" name="sale_id" value="{{$order_info['sale_id']}}">
<input type="hidden" name="goods_amount" value="{{$order_price_info['goods_price']}}">
<input type="hidden" name="order_amount" value="{{$order_info['order_amount']}}">
......@@ -49,7 +50,10 @@
<td class="check-select">
<label><input class="order_all_pay" type="radio" name="order_pay_type" value="1">全额付款</label>
<label><input class="order_advance_pay" type="radio" name="order_pay_type" value="2">预付首款</label>
<!-- 销售类型为现卖时展示 -->
@if ($order_info['sale_type'] == 1)
<label><input class="order_account_period" type="radio" name="order_pay_type" value="3">账期</label>
@endif
</td>
</tr>
<tr>
......@@ -86,6 +90,11 @@
<th>型号</th>
<th>调整数量</th>
<th>调整单价</th>
<!-- 销售类型为预售时展示 -->
@if ($order_info['sale_type'] == 2)
<th>交期时间/天</th>
<th>锁定库存</th>
@endif
</thead>
<tbody>
......@@ -105,6 +114,19 @@
<span>{{$currency}}</span>
<input class="price only_number" name="change_info[{{$v['rec_id']}}][goods_price]" data-origin="{{$v['original_price']}}" value="{{$v['goods_price']}}">
</td>
<!-- 销售类型为预售时展示 -->
@if ($order_info['sale_type'] == 2)
<td>
<input type="text" class="only_number" name="change_info[{{$v['rec_id']}}][delivery_time]" value="" placeholder="请填写天数">
</td>
<td>
<label>
<input type="checkbox" name="change_info[{{$v['rec_id']}}][is_lock]" value="{{$v['goods_id']}}">
<span>锁定库存,可用库存:<b class="text-danger">{{ App\Http\Controllers\getSelfStock($v['goods_id']) }}</b></span>
</label>
</td>
@endif
</tr>
@endforeach
</tbody>
......@@ -112,6 +134,7 @@
<?php $extend_fee_items = json_decode($order_temp_info['extend_fee_items'], true); ?>
<!-- 供应商附加费 -->
@if ($extend_fee_items)
<hr/>
<p>附加费设置</p>
......@@ -165,6 +188,8 @@
<td><p class="text-danger">{{$currency}}<span class="goods_total">{{$order_price_info['goods_price']}}</span></p></td>
</tr>
<!-- 销售类型为现卖时展示 -->
@if ($order_info['sale_type'] == 1)
<tr>
<th width="20%">附加费金额</th>
<td>
......@@ -173,6 +198,7 @@
</td>
<!-- <td><input type="text" name="extra_fee" autocomplete="off" value="{{$order_price_info['ext_price']}}" class="only_number"></td> -->
</tr>
@endif
<!-- <tr>
<th>说明</th>
......@@ -216,11 +242,15 @@
<p>付款时间</p>
<table class="table table-bordered table-hover change-table">
<tr>
<th>选择付款时间</th>
<th width="20%">选择付款时间</th>
<td>
<select name="payTime" class="payTime">
<option value="">请选择</option>
<option value="1">1天</option>
<!-- 预售订单默认2天 -->
@if ($order_info['sale_type'] == 2)
<option value="2" selected>2天</option>
@endif
<option value="3">3天</option>
<option value="7">7天</option>
<option value="15">15天</option>
......@@ -252,8 +282,16 @@
@endif
</p>
<?php
if ($order_info['order_goods_type'] == 2) {
$adjustPriceUrl = "/adjustPrice/".$order_info['order_id']."?tags=self";
} else {
$adjustPriceUrl = "/adjustPrice/".$order_info['order_id'];
}
?>
@if ($order_info['adjust_count'] < 2)
<a class="btn btn-default" href="{{URL('adjustPrice', ['order_id'=>$order_info['order_id']])}}">再次调价</a><span class="warn-tip">每笔订单仅有一次“再次调价”机会</span>
<a class="btn btn-default" href="{{$adjustPriceUrl}}">再次调价</a><span class="warn-tip">每笔订单仅有一次“再次调价”机会</span>
@endif
</div>
......
......@@ -581,7 +581,7 @@
<div class="tabs-box">
<!-- 判断操作权限 -->
@if ($order_info['status'] == 1 && in_array('check_order', $userPerms))
<a class="btn btn-success" href="{{URL('change', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">人工审单</a>
<a class="btn btn-success" href="{{URL('change', ['order_id'=>$order_info['order_id']])}}">人工审单</a>
@endif
@if ($order_info['status'] == 2 && in_array('cancel_order', $userPerms))
......@@ -607,16 +607,21 @@
@endif
</div>
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'self')
@elseif (isset($_REQUEST['tags']) && $_REQUEST['tags'] == 'self' && $action_name != 'changeOrder')
<p style="padding-left: 5px;">操作</p>
<div class="tabs-box">
<!-- 判断状态和权限 -->
@if ($order_info['status'] == 1 && in_array('add_offline_audit', $userPerms))
<a class="btn btn-success self-check" data-id="{{$order_info['order_id']}}" class="btn btn-default">审单</a>
<a class="btn btn-success self-check" data-id="{{$order_info['order_id']}}">内部订单审核</a>
@endif
<!-- 预售订单审单 -->
@if ($order_info['status'] == 1 && $order_info['sale_type'] == 2 && in_array('self_check_order', $userPerms))
<a class="btn btn-success" href="/change/{{$order_info['order_id']}}?tags=self">人工审单</a>
@endif
@if (in_array($order_info['status'], [2, 3, 4]) && !$extend && in_array('self_order_cancel', $userPerms))
<a class="btn btn-default self_cancel" href="javascript:;" data-id="{{$order_info['order_id']}}" class="btn btn-default">取消订单</a>
<a class="btn btn-default self_cancel" href="javascript:;" data-id="{{$order_info['order_id']}}">取消订单</a>
@endif
@if ($order_info['status'] == 2 && in_array('self_check_pay', $userPerms))
......@@ -624,12 +629,12 @@
@endif
@if ($order_info['status'] == 4 && in_array('self_order_express', $userPerms))
<a class="btn btn-default self_express" href="javascript:;" data-id="{{$order_info['order_id']}}" class="btn btn-default">填写快递单</a>
<a class="btn btn-default self_express" href="javascript:;" data-id="{{$order_info['order_id']}}">填写快递单</a>
@endif
<!-- 订单状态大于4,且处于开票状态,且存在权限 -->
@if ($order_info['status'] >= 4 && $order_invoice_info['inv_type'] > 1 && in_array('self_order_invoice_express', $userPerms))
<a class="btn btn-default self_invoice_express" data-id="{{$order_info['order_id']}}" href="javascript:;" class="btn btn-default">填写发票快递</a>
<a class="btn btn-default self_invoice_express" data-id="{{$order_info['order_id']}}" href="javascript:;">填写发票快递</a>
@endif
</div>
......
......@@ -48,6 +48,21 @@
</div>
</dd>
</dl>
<dl>
<dt>销售类型:</dt>
<dd style="width: 115px;">
<div class="droplist" data-default="{{$condition['sale_type']}}" id="sale_type" name="sale_type">
<ul class="dropdown-menu">
<li data-val="" class="active">全部</li>
<li data-val="1">现卖</li>
<li data-val="2">预售</li>
</ul>
</div>
</dd>
</dl>
<dl>
<!-- <dl>
<dt>客服:</dt>
<dd style="width: 115px;">
......@@ -167,6 +182,7 @@
<th class="pl30">订单编号</th>
<th class="pl30">应付金额</th>
<th class="pl30">订单状态</th>
<th class="pl30">销售类型</th>
<th class="pl30">支付方式</th>
<th class="pl30">订单来源</th>
<th class="pl30">发货状态</th>
......@@ -207,6 +223,7 @@
}
?>
</td>
<td>{{$v['sale_type'] == 1 ? '现卖' : '预售'}}</td>
<td class="show-list"><?php print_r(App\Http\Controllers\getPayName($v['order_id'])); ?></td>
......@@ -243,6 +260,10 @@
<div class="btn-group btn-group-xs">
<a class="btn btn-primary" href="/details/{{$v['order_id']}}?tags=self" target="_blank">详情</a>
@if (in_array('self_check_order', $userPerms) && in_array($v['status'], [1, 2, 3]) && $v['sale_type'] == 2)
<a class="btn btn-success" href="/change/{{$v['order_id']}}?tags=self" target="_blank">人工审单</a>
@endif
@if (in_array('self_order_download_contract', $userPerms))
<a class="btn btn-default download-contract" data-id="{{$v['order_id']}}" href="javascript:;">下载合同</a>
@endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment