Commit 4c199afe by 朱继来

添加自营对账

parent 8f5e01ff
......@@ -905,7 +905,20 @@ Class OrderController extends Controller
{
$data = $this->orderDetail($request, $id);
if ($request->input('tags') == 'self') {
if ($data['order_info']['order_goods_type'] == 2) {
if ($request->input('tags') != 'self') {
return redirect('self_order'); // URL重定向
} else {
$this->selfOtherData($data, $id);
}
}
return view($view_id, $data);
}
// 详情页自营其他数据
public function selfOtherData(&$data, $order_id)
{
$shipping = DB::connection('order')->table('lie_shipping')->select('shipping_id', 'shipping_name')->get();
if ($shipping) {
......@@ -916,12 +929,11 @@ Class OrderController extends Controller
$data['shippings'] = $shippingInfo;
}
$extend = DB::connection('order')->table('lie_order_extend')->where(['order_id' => $id, 'order_type' => 3])->first();
$extend = DB::connection('order')->table('lie_order_extend')->where(['order_id' => $order_id, 'order_type' => 3])->first();
$data['extend'] = $extend ? $extend : '';
}
return view($view_id, $data);
return $data;
}
// 外部引用
......@@ -1313,47 +1325,6 @@ Class OrderController extends Controller
}
}
/**
* webPower 短信商
* @param $mobile 手机号码
* @param $content 短信内容
* @return bool
*/
public function webpower_send_sms($mobile, $content, $campaignID = 1424)
{
//webservice
// $url = "http://lx.webpowerchina.cn/sms/rest/v1/sms"; //输出的链接地址
$url='https://sms.dmavip.com/rest/v2/single_sms';
$post_data = array(
'mobile' => $mobile,
'content' => $content,
'campaignID' => $campaignID,
); //填写参数,mobile手机号码,content短信内容,campaignID活动id(短信平台上面发送一般是在活动下面,跟邮件一样会有一个活动Id)
$data = webpower_curl($url, $post_data);
if(isset($data)){
//保存验证码
DB::connection('order')->table('lie_msg_send')->insert([
'mobile' => $mobile,
'code' => ' ',
'send_time' => time(),
'url' => $url.'?'.http_build_query($post_data),
'response' => $data
]);
$result = json_decode($data, true);
$status = strtoupper($result['status']);
if($status == 'OK'){
return true;
}else{
return false;
}
}else{
return false;
}
}
//取消订单(仅限审核通过,未付款前)
public function cancelPay(Request $request, $id)
{
......@@ -1706,26 +1677,37 @@ Class OrderController extends Controller
}
}
/**
* 锁定基石库存
* @return [type] [description]
*/
protected function unlockSku($order_id, $skus = array(), $reduce = false)
// 自营对账
public function selfCheckPay(Request $request, $id)
{
$datas = array(
'order_id' => $order_id,
'Items' => $skus,
'reduce' => $reduce,
);
$data['type'] = 'sku.unlock';
$data['data'] = urlencode(json_encode($datas));
$data['timestamp'] = time();
$res = webpower_curl(Config('website.SERVICE_DOMAIN').'/transpond/wmsapi/WebApiUnlockStock?token='.service_token($data['data'], $data['timestamp']), $data);
// $res = post_curl(STONE_DOMAIN.'/wmsapi/WebApiUnlockStock?token='.service_token($data['data'], $data['timestamp']), $data);
if (!empty($res)) {
$res = json_decode($res, true);
}
return $res;
if ($request->isMethod('post')) {
$order_id = $request->input('order_id', '');
$serial_number = $request->input('serial_number', '');
$operator_id = $request->user->userId;
$url = Config('website.api_domain').'order/selfcheckpay';
$data['order_id'] = $order_id;
$data['serial_number'] = $serial_number;
$data['operator_id'] = $operator_id;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$temp = json_decode(curlApi($url, $data, "POST"), true); // 连接API
if ($temp['err_code'] == 0) {
return array('errcode'=>0, 'errmsg'=>'操作成功');
} else {
errorLog(Error::E_UPDATE_FAILED, '操作失败');
return array('errcode'=>Error::E_UPDATE_FAILED, 'errmsg'=>'操作失败');
}
}
$info = $this->orderDetail($request, $id);
$this->selfOtherData($info, $id);
return view('detail', $info);
}
// 快递配置
......
......@@ -66,6 +66,7 @@ Route::group(['middleware' => 'web'], function () {
Route::get('/self_order', 'OrderController@selfOrder');
Route::post('/ajaxSelfCancel', 'OrderController@ajaxSelfCancel');
Route::post('/ajaxSelfExpress', 'OrderController@ajaxSelfExpress');
Route::match(['get', 'post'], '/self_check_pay/{id}', 'OrderController@selfCheckPay');
Route::match('post', '/ajaxDelayTime', 'OrderController@ajaxDelayTime');
......
......@@ -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_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_express_set_check'],
......
......@@ -1543,6 +1543,47 @@
}
});
})
// 自营对账
$('.self-sure-pay').click(function(){
var order_id = $('#order_id').val();
var serial_number = $('input[name="serial_number"]').val();
if (serial_number.length == 0) {
layer.alert('请输入流水号');
return false;
}
layer.open({
title: '收款确认',
content: '请仔细核对订单金额后确认',
btn:['确认', '取消'],
btn1:function(){
$.ajax({
url:'/self_check_pay/'+order_id,
data: {order_id : order_id, serial_number : serial_number},
type:'post',
dataType: 'json',
success:function(resp){
if(resp.errcode == 0){
layer.msg(resp.errmsg);
location.reload();
return false;
} else {
layer.alert(resp.errmsg);
}
},
error:function(){
layer.alert('网络异常');
}
});
},
btn2:function(){
return true;
}
})
})
},
}
......
......@@ -539,6 +539,11 @@
@include('detail.check')
@endif
@if ($action_name == 'selfCheckPay')
<!--自营对账-->
@include('detail.selfCheckPay')
@endif
<!-- 人工审单时去掉操作按钮 -->
@if (!isset($_REQUEST['tags']) && $action_name != 'changeOrder' && $action_name != 'sendSales')
<p style="padding-left: 5px;">操作</p>
......@@ -583,6 +588,10 @@
<a class="btn btn-default self_cancel" href="javascript:;" data-id="{{$order_info['order_id']}}" class="btn btn-default">取消订单</a>
@endif
@if ($order_info['status'] == 2 && in_array('self_check_pay', $userPerms))
<a href="/self_check_pay/{{$order_info['order_id']}}?tags=self" class="btn btn-default">对账</a>
@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>
@endif
......
<p style="margin-left: 5px;">对账操作</p>
<div class="tabs-box">
<!-- 判断订单类型 1.全款,2.预付款 -->
<?php
if ($order_info['status'] == 4) {
echo '<p>订单对账正常</p>
<p>流水号:'.$order_pay_log[0]['serial_number'].'</p>
<p class="error">订单总金额:'.$order_info['order_amount'].'</p>';
} else {
$serial_number = isset($order_pay_log[0]['serial_number']) ? $order_pay_log[0]['serial_number'] : '';
echo '<p><a class="btn btn-default self-sure-pay">确认收款</a></p>
<p> 流水号:
<input style="width: 200px;" type="text" name="serial_number" value="'.$serial_number.'">
<span style="color:orange;">请录入流水号,流水号为英文、数字</span>
</p>
<p class="error">订单总金额:'.$order_info['order_amount'].'</p>';
}
?>
</div>
<div class="hide" id="sure-pay">
<p><label><input type="radio" name="status" value="1" checked> 款项正常</label></p>
<p><label><input type="radio" name="status" value="2"> 款项异常</label></p>
<p><textarea name="info" placeholder="请填写异常原因"></textarea></p>
</div>
\ No newline at end of file
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