订单批量支付

This commit is contained in:
devil 2020-07-28 21:15:47 +08:00
parent d9ecaa7da3
commit 8943da086e
15 changed files with 803 additions and 583 deletions

View File

@ -43,6 +43,7 @@ class Paylog
'key_field' => 'id',
'is_search' => 1,
'search_url' => MyUrl('admin/paylog/index'),
'is_middle' => 0,
],
// 表单配置
'form' => [
@ -60,6 +61,15 @@ class Paylog
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],
[
'label' => '支付单号',
'view_type' => 'field',
'view_key' => 'log_no',
'search_config' => [
'form_type' => 'input',
'where_type' => '=',
],
],
[
'label' => '支付方式',
'view_type' => 'module',
@ -89,6 +99,24 @@ class Paylog
'is_multiple' => 1,
],
],
[
'label' => '业务订单金额(元)',
'view_type' => 'field',
'view_key' => 'total_price',
'search_config' => [
'form_type' => 'section',
'is_point' => 1,
],
],
[
'label' => '支付金额(元)',
'view_type' => 'field',
'view_key' => 'pay_price',
'search_config' => [
'form_type' => 'section',
'is_point' => 1,
],
],
[
'label' => '业务类型',
'view_type' => 'field',
@ -115,24 +143,6 @@ class Paylog
'where_handle_custom' => 'WhereValueBusinessInfo',
],
],
[
'label' => '业务订单金额(元)',
'view_type' => 'field',
'view_key' => 'total_price',
'search_config' => [
'form_type' => 'section',
'is_point' => 1,
],
],
[
'label' => '支付金额(元)',
'view_type' => 'field',
'view_key' => 'pay_price',
'search_config' => [
'form_type' => 'section',
'is_point' => 1,
],
],
[
'label' => '支付平台交易号',
'view_type' => 'field',

View File

@ -1,6 +1,6 @@
<!-- 关联业务数据 -->
{{if !empty($module_data) and !empty($module_data['business_list']) and is_array($module_data['business_list'])}}
<dl class="dl-content dl-content-dd-only">
<dl class="dl-content dl-content-dd-only dl-content-dd-compact">
{{foreach $module_data.business_list as $v}}
<dd>
<div class="am-nbfc">

View File

@ -74,6 +74,9 @@ class Order extends Common
];
$ret = OrderService::OrderList($data_params);
// 发起支付 - 支付方式
$this->assign('buy_payment_list', PaymentService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1]));
// 加载百度地图api
$this->assign('is_load_baidu_map_api', 1);
@ -100,7 +103,7 @@ class Order extends Common
$data = $this->OrderFirst();
if(!empty($data))
{
// 发起支付 - 支付方式
// 发起支付 - 支付方式
$this->assign('buy_payment_list', PaymentService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1]));
// 虚拟销售配置
@ -111,7 +114,7 @@ class Order extends Common
$this->assign('is_load_baidu_map_api', 1);
// 浏览器名称
$this->assign('home_seo_site_title', SeoService::BrowserSeoTitle('订单详情', 1));
$this->assign('home_seo_site_title', SeoService::BrowserSeoTitle('订单详情', 1));
// 数据赋值
$this->assign('data', $data);
@ -212,7 +215,7 @@ class Order extends Common
*/
public function Pay()
{
$params = input();
$params = $this->data_request;
$params['user'] = $this->user;
$ret = OrderService::Pay($params);
if($ret['code'] == 0)
@ -235,7 +238,7 @@ class Order extends Common
public function Respond()
{
// 参数
$params = input();
$params = $this->data_request;
// 是否自定义状态
if(isset($params['appoint_status']))

View File

@ -219,7 +219,7 @@
<button type="button" class="am-btn am-btn-warning am-btn-xs am-radius am-icon-paint-brush submit-ajax submit-cancel" data-url="{{:MyUrl('index/order/cancel')}}" data-id="{{$data.id}}" data-view="reload"> 取消</button>
{{/if}}
{{if in_array($data['status'], [1])}}
<button class="am-btn am-btn-primary am-btn-xs am-radius am-icon-paypal submit-pay" data-id="{{$data.id}}" data-payment-id="{{$data.payment_id}}" data-am-modal="{target: '#order-pay-popup'}" data-is-auto="{{if isset($params['is_pay_auto']) and $params['is_pay_auto'] eq 1}}1{{else /}}0{{/if}}" data-is-pay="{{if isset($params['is_pay_submit']) and $params['is_pay_submit'] eq 1}}1{{else /}}0{{/if}}"> {{if $data['is_under_line'] eq 1}}切换{{/if}}支付</button>
<button class="am-btn am-btn-primary am-btn-xs am-radius am-icon-paypal submit-pay" data-id="{{$data.id}}" data-payment-id="{{$data.payment_id}}"> {{if $data['is_under_line'] eq 1}}切换{{/if}}支付</button>
{{/if}}
{{if in_array($data['status'], [3])}}
<button type="button" class="am-btn am-btn-secondary am-btn-xs am-radius am-icon-check-circle-o submit-ajax submit-confirm" data-url="{{:MyUrl('index/order/collect')}}" data-id="{{$data.id}}" data-view="reload" data-msg="请仔细确认已收到货物、确认继续吗?"> 收货</button>
@ -321,7 +321,7 @@
</div>
<div>
<span>{{$data.address_data.province_name}} {{$data.address_data.city_name}} {{$data.address_data.county_name}} {{$data.address_data.address}}</span>
{{if $data.order_model eq 2 and $data.address_data.lng gt 0 and $data.address_data.lat gt 0}}
{{if $data.address_data.lng gt 0 and $data.address_data.lat gt 0}}
<button type="button" class="am-btn am-btn-success am-radius am-icon-map-marker submit-map-popup" data-lng="{{$data.address_data.lng}}" data-lat="{{$data.address_data.lat}}"> 查看位置</button>
{{/if}}
</div>
@ -377,24 +377,19 @@
</thead>
<tbody>
{{foreach $data.items as $goods}}
<tr id="data-list-{{$goods.id}}" data-id="{{$goods.id}}" data-goods-id="{{$goods.goods_id}}">
<td class="base">
<div class="goods-detail">
<tr>
<td>
<div class="am-nbfc am-text-left">
<a href="{{$goods.goods_url}}" target="_blank">
<img src="{{$goods.images}}" alt="{{$goods.title}}" class="am-img-thumbnail am-radius" />
<img src="{{$goods.images}}" class="am-img-thumbnail am-radius am-margin-right-xs am-fl" width="60" height="60" />
</a>
<div class="goods-base">
<a href="{{$goods.goods_url}}" target="_blank" class="goods-title">{{$goods.title}}</a>
{{if !empty($goods.spec) or !empty($goods['model'])}}
<ul class="am-margin-top-xs am-text-left goods-attr">
{{if !empty($goods['model'])}}
<li>型号:{{$goods.model}}</li>
{{/if}}
{{if !empty($goods.spec)}}
{{foreach $goods.spec as $spec}}
<li>{{$spec.type}}{{$spec.value}}</li>
{{/foreach}}
{{/if}}
<div class="am-nbfc">
<a href="{{$goods.goods_url}}" target="_blank" class="am-nowrap-initial">{{$goods.title}}</a>
{{if !empty($goods.spec)}}
<ul class="goods-spec am-margin-top-xs">
{{foreach $goods.spec as $spec}}
<li>{{$spec.type}}{{$spec.value}}</li>
{{/foreach}}
</ul>
{{/if}}
</div>
@ -403,7 +398,9 @@
{{if $goods['original_price'] gt 0}}
<span class="original-price">{{$price_symbol}}{{$goods.original_price}}</span>
{{/if}}
<strong class="total-price-content">{{$price_symbol}}{{$goods.price}}</strong>
<span class="price">
<strong>{{$price_symbol}}{{$goods.price}}</strong>
</span>
<span class="wap-number">x{{$goods.buy_number}}</span>
{{if isset($goods['returned_quantity']) and $goods['returned_quantity'] gt 0}}
<span class="am-badge am-round am-badge-warning-plain">已退 {{$goods.returned_quantity}}</span>
@ -422,7 +419,7 @@
<br /><span class="am-badge am-round am-badge-warning-plain">已退 {{$goods.returned_quantity}}</span>
{{/if}}
</td>
<td class="total-price am-hide-sm-only">
<td class="price am-hide-sm-only">
<strong class="total-price-content">{{$price_symbol}}{{$goods.total_price}}</strong>
{{if isset($goods['refund_price']) and $goods['refund_price'] gt 0}}
<br /><span class="am-badge am-round am-badge-warning-plain">已退 {{$goods.refund_price}}</span>
@ -491,43 +488,7 @@
</div>
<!-- 支付弹窗 -->
<div class="am-popup am-radius" id="order-pay-popup">
<div class="am-popup-inner">
<div class="am-popup-hd">
<h4 class="am-popup-title">支付</h4>
<span data-am-modal-close class="am-close">&times;</span>
</div>
<div class="am-popup-bd">
<form class="am-form pay-form" method="post" action="{{:MyUrl('index/order/pay')}}">
<!-- 支付方式 -->
<div class="business-item">
<h3>选择支付</h3>
{{if !empty($buy_payment_list)}}
<ul class="payment-list" data-type="payment">
{{foreach $buy_payment_list as $payment}}
<li class="payment-items-{{$payment.id}}" data-value="{{$payment.id}}">
{{if !empty($payment.logo)}}
<img src="{{$payment.logo}}" />
{{/if}}
<span>{{$payment.name}}</span>
<i class="icon-active"></i>
</li>
{{/foreach}}
</ul>
{{/if}}
{{if empty($buy_payment_list)}}
<div class="table-no"><i class="am-icon-warning"></i> 没有支付方式</div>
{{/if}}
</div>
<div class="am-form-group am-form-group-refreshing">
<input type="hidden" name="id" value="0" />
<input type="hidden" name="payment_id" value="0" />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">确认支付</button>
</div>
</form>
</div>
</div>
</div>
{{include file="order/payment_popup" /}}
</div>
<!-- content end -->
</div>

View File

@ -3,7 +3,13 @@
<!-- 表单顶部操作栏 -->
{{block name="form_operate_top"}}
<button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-paypal batch-pay-submit"> 批量支付</button>
<button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-paypal batch-pay-submit" data-url="{{:MyUrl('index/order/pay')}}"> 批量支付</button>
<!-- 父级内容 -->
{__block__}
{{/block}}
<!-- 底部 -->
{{block name="form_page_bottom"}}
<!-- 支付弹窗 -->
{{include file="order/payment_popup" /}}
{{/block}}

View File

@ -11,10 +11,10 @@
</button>
{{/if}}
{{if in_array($module_data['status'], [1])}}
<a class="am-btn am-btn-primary am-btn-xs am-radius am-btn-block" href="{{:MyUrl('index/order/detail', ['id'=>$module_data['id'], 'is_pay_auto'=>1])}}" target="_blank">
<button type="button" class="am-btn am-btn-primary am-btn-xs am-radius am-btn-block submit-pay" data-id="{{$module_data.id}}" data-payment-id="{{$module_data.payment_id}}">
<i class="am-icon-paypal"></i>
<span>支付</span>
</a>
</button>
{{/if}}
{{if in_array($module_data['status'], [3])}}
<button type="button" class="am-btn am-btn-secondary am-btn-xs am-radius am-btn-block submit-ajax submit-confirm" data-url="{{:MyUrl('index/order/collect')}}" data-id="{{$module_data.id}}" data-view="reload" data-msg="请仔细确认已收到货物、确认继续吗?">

View File

@ -0,0 +1,37 @@
<div class="am-popup am-radius" id="order-pay-popup" data-is-auto="{{if isset($params['is_pay_auto']) and $params['is_pay_auto'] eq 1}}1{{else /}}0{{/if}}" data-is-pay="{{if isset($params['is_pay_submit']) and $params['is_pay_submit'] eq 1}}1{{else /}}0{{/if}}">
<div class="am-popup-inner">
<div class="am-popup-hd">
<h4 class="am-popup-title">支付</h4>
<span data-am-modal-close class="am-close">&times;</span>
</div>
<div class="am-popup-bd">
<form class="am-form pay-form" method="post" action="{{:MyUrl('index/order/pay')}}">
<!-- 支付方式 -->
<div class="business-item">
<h3>选择支付</h3>
{{if !empty($buy_payment_list)}}
<ul class="payment-list" data-type="payment">
{{foreach $buy_payment_list as $payment}}
<li class="payment-items-{{$payment.id}}" data-value="{{$payment.id}}">
{{if !empty($payment.logo)}}
<img src="{{$payment.logo}}" />
{{/if}}
<span>{{$payment.name}}</span>
<i class="icon-active"></i>
</li>
{{/foreach}}
</ul>
{{/if}}
{{if empty($buy_payment_list)}}
<div class="table-no"><i class="am-icon-warning"></i> 没有支付方式</div>
{{/if}}
</div>
<div class="am-form-group am-form-group-refreshing">
<input type="hidden" name="ids" value="{{if !empty($params['ids'])}}{{:urldecode($params.ids)}}{{/if}}" />
<input type="hidden" name="payment_id" value="{{if !empty($params['payment_id'])}}{{$params.payment_id}}{{/if}}" />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">确认支付</button>
</div>
</form>
</div>
</div>
</div>

View File

@ -157,4 +157,7 @@
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
<!-- footer end -->
<!-- page buttom -->
{{block name="form_page_bottom"}}{{/block}}

View File

@ -46,7 +46,7 @@ class OrderService
$p = [
[
'checked_type' => 'empty',
'key_name' => 'id',
'key_name' => 'ids',
'error_msg' => '订单id有误',
],
[
@ -61,28 +61,76 @@ class OrderService
return DataReturn($ret, -1);
}
// 获取订单信息
$where = ['id'=>intval($params['id']), 'user_id' => $params['user']['id']];
$order = Db::name('Order')->where($where)->find();
if(empty($order))
// 支付订单id
$ids = is_array($params['ids']) ? $params['ids'] : explode(',', urldecode($params['ids']));
if(empty($ids))
{
return DataReturn('资源不存在或已被删除', -1);
}
if($order['status'] != 1)
{
$status_text = lang('common_order_user_status')[$order['status']]['name'];
return DataReturn('状态不可操作['.$status_text.']', -1);
return DataReturn('订单支付id有误', -1);
}
// 订单支付前校验
$ret = BuyService::OrderPayBeginCheck(['order_id'=>$order['id'], 'order_data'=>$order]);
if($ret['code'] != 0)
// 支付基础信息
$order_payment_id = 0;
$client_type = '';
$total_price = 0;
$success_count = 0;
$order_ids = [];
$order_nos = [];
// 循环处理
foreach($ids as $k=>$order_id)
{
return $ret;
// 获取订单信息
$where = ['id'=>intval($order_id), 'user_id' => $params['user']['id']];
$order = Db::name('Order')->where($where)->find();
if(empty($order))
{
return DataReturn('资源不存在或已被删除', -1);
}
if($order['status'] != 1)
{
$status_text = lang('common_order_user_status')[$order['status']]['name'];
return DataReturn('状态不可操作['.$status_text.']'.$order['order_no'], -1);
}
// 订单支付前校验
$ret = BuyService::OrderPayBeginCheck(['order_id'=>$order['id'], 'order_data'=>$order]);
if($ret['code'] != 0)
{
return $ret;
}
// 金额为0、走直接支付成功
if($order['total_price'] <= 0.00)
{
$params['user']['user_name_view'] = '用户-'.$params['user']['user_name_view'];
$pay_result = self::OrderDirectSuccess([
'order' => $order,
'payment' => $payment[0],
'user' => $params['user'],
'params' => $params,
]);
if($pay_result['code'] == 0)
{
$success_count++;
}
return $pay_result;
}
// 订单id/号集合
$order_ids[] = $order['id'];
$order_nos[] = $order['order_no'];
$total_price += $order['total_price'];
// 仅第一个订单获取的数据
if($k == 0)
{
$client_type = $order['client_type'];
$order_payment_id = $order['payment_id'];
}
}
// 支付方式
$payment_id = empty($params['payment_id']) ? $order['payment_id'] : intval($params['payment_id']);
$payment_id = empty($params['payment_id']) ? $order_payment_id : intval($params['payment_id']);
$payment = PaymentService::PaymentList(['where'=>['id'=>$payment_id]]);
if(empty($payment[0]))
{
@ -90,30 +138,19 @@ class OrderService
}
// 更新订单支付方式信息
if(!empty($params['payment_id']) && $params['payment_id'] != $order['payment_id'])
if($payment_id != $order_payment_id)
{
Db::name('Order')->where(['id'=>$order['id']])->update([
Db::name('Order')->where(['id'=>$ids])->update([
'payment_id' => $payment_id,
'is_under_line' => in_array($payment[0]['payment'], config('shopxo.under_line_list')) ? 1 : 0,
'upd_time' => time(),
]);
}
// 金额为0、走直接支付成功
if($order['total_price'] <= 0.00)
// 是否直接跳转
if($success_count > 0 && $success_count == count($ids))
{
$params['user']['user_name_view'] = '用户-'.$params['user']['user_name_view'];
$pay_result = self::OrderDirectSuccess([
'order' => $order,
'payment' => $payment[0],
'user' => $params['user'],
'params' => $params,
]);
if($pay_result['code'] == 0)
{
return DataReturn('支付成功', 0, ['data'=>MyUrl('index/order/respond', ['appoint_status'=>0])]);
}
return $pay_result;
return DataReturn('支付成功', 0, ['data'=>MyUrl('index/order/respond', ['appoint_status'=>0])]);
}
// 支付入口文件检查
@ -148,18 +185,32 @@ class OrderService
}
}
// 新增支付日志
$pay_log = self::OrderPayLogInsert([
'user_id' => $params['user']['id'],
'business_ids' => $order_ids,
'business_nos' => $order_nos,
'total_price' => $total_price,
'payment' => $payment[0]['payment'],
'payment_name' => $payment[0]['name'],
]);
if($pay_log['code'] != 0)
{
return $pay_log;
}
// 发起支付数据
$pay_data = array(
'user' => $params['user'],
'out_user' => md5($params['user']['id']),
'order_id' => $order['id'],
'order_no' => $order['order_no'],
'order_id' => $pay_log['data']['id'],
'order_no' => $pay_log['data']['log_no'],
'name' => '订单支付',
'total_price' => $order['total_price'],
'client_type' => $order['client_type'],
'total_price' => $total_price,
'client_type' => $client_type,
'notify_url' => $url.'_notify.php',
'call_back_url' => $call_back_url,
'redirect_url' => MyUrl('index/order/detail', ['id'=>$order['id']]),
'redirect_url' => MyUrl('index/order/index'),
'site_name' => MyC('home_site_name', 'ShopXO', true),
'ajax_url' => MyUrl('index/order/paycheck'),
);
@ -169,8 +220,7 @@ class OrderService
$ret = HookReturnHandle(Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'order_id' => $order['id'],
'order' => &$order,
'order_ids' => $order_ids,
'params' => &$params,
'pay_data' => &$pay_data,
]));
@ -185,7 +235,21 @@ class OrderService
if(!empty($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false && empty($pay_data['user']['weixin_web_openid']))
{
// 授权成功后回调订单详情页面重新自动发起支付
$url = MyUrl('index/order/detail', ['id'=>$pay_data['order_id'], 'is_pay_auto'=>1, 'is_pay_submit'=>1]);
// 单个订单进入详情,则进入列表
$weixin_params = [
'is_pay_auto' => 1,
'is_pay_submit' => 1,
'payment_id' => $payment_id,
];
if(count($order_ids) == 1)
{
$weixin_params['id'] = $order_ids[0];
$weixin_params['ids'] = $order_ids[0];
$url = MyUrl('index/order/detail', $weixin_params);
} else {
$weixin_params['ids'] = urldecode(implode(',', $order_ids));
$url = MyUrl('index/order/index', $weixin_params);
}
session('plugins_weixinwebauth_pay_callback_view_url', $url);
}
}
@ -221,6 +285,31 @@ class OrderService
return DataReturn(empty($ret['msg']) ? '支付接口异常' : $ret['msg'], -1);
}
/**
* 新增订单支付日志
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-07-28
* @desc description
* @param [array] $params [输入参数]
*/
public static function OrderPayLogInsert($params = [])
{
$business_ids = isset($params['business_ids']) ? $params['business_ids'] : [];
$business_nos = isset($params['business_nos']) ? $params['business_nos'] : [];
return PayLogService::PayLogInsert([
'user_id' => isset($params['user_id']) ? intval($params['user_id']) : 0,
'business_ids' => is_array($business_ids) ? $business_ids : [$business_ids],
'business_nos' => is_array($business_nos) ? $business_nos : [$business_nos],
'total_price' => isset($params['total_price']) ? PriceNumberFormat($params['total_price']) : 0.00,
'subject' => '订单支付',
'payment' => isset($params['payment']) ? $params['payment'] : '',
'payment_name' => isset($params['payment_name']) ? $params['payment_name'] : '',
'business_type' => '订单',
]);
}
/**
* 管理员订单支付
* @author Devil
@ -303,11 +392,29 @@ class OrderService
{
if($params['order']['total_price'] <= 0.00)
{
// 新增支付日志
$pay_log = self::OrderPayLogInsert([
'user_id' => $params['user']['id'],
'business_ids' => $params['order']['id'],
'business_nos' => $params['order']['order_no'],
'total_price' => $params['order']['total_price'],
'payment' => $params['payment']['payment'],
'payment_name' => $params['payment']['name'],
]);
if($pay_log['code'] != 0)
{
return $pay_log;
}
// 新增日志订单
$pay_log_data = [];
// 支付处理
$pay_params = [
'order' => $params['order'],
'payment' => $params['payment'],
'pay' => [
'order' => [$params['order']],
'payment' => $params['payment'],
'pay_log_data' => $pay_log['data'],
'pay' => [
'trade_no' => '',
'subject' => isset($params['params']['subject']) ? $params['params']['subject'] : '订单支付',
'buyer_user' => $params['user']['user_name_view'],
@ -336,11 +443,26 @@ class OrderService
{
if(in_array($params['payment']['payment'], config('shopxo.under_line_list')))
{
// 新增支付日志
$pay_log = self::OrderPayLogInsert([
'user_id' => $params['user']['id'],
'business_ids' => $params['order']['id'],
'business_nos' => $params['order']['order_no'],
'total_price' => $params['order']['total_price'],
'payment' => $params['payment']['payment'],
'payment_name' => $params['payment']['name'],
]);
if($pay_log['code'] != 0)
{
return $pay_log;
}
// 支付处理
$pay_params = [
'order' => $params['order'],
'payment' => $params['payment'],
'pay' => [
'order' => $params['order'],
'payment' => $params['payment'],
'pay_log_data' => $pay_log['data'],
'pay' => [
'trade_no' => '',
'subject' => isset($params['params']['subject']) ? $params['params']['subject'] : '订单支付',
'buyer_user' => $params['user']['user_name_view'],
@ -433,31 +555,64 @@ class OrderService
// 支付数据校验
$pay_name = 'payment\\'.PAYMENT_TYPE;
$ret = (new $pay_name($payment[0]['config']))->Respond(array_merge(input('get.'), input('post.')));
if(!isset($ret['code']) || $ret['code'] != 0)
$pay_ret = (new $pay_name($payment[0]['config']))->Respond(array_merge(input('get.'), input('post.')));
if(!isset($pay_ret['code']) || $pay_ret['code'] != 0)
{
return $ret;
return $pay_ret;
}
// 获取订单信息
$where = ['order_no'=>$ret['data']['out_trade_no'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
$order = Db::name('Order')->where($where)->find();
// 获取支付日志订单
$pay_log_data = Db::name('PayLog')->where([
'log_no' => $pay_ret['data']['out_trade_no'],
'status' => 0,
])->find();
if(empty($pay_log_data))
{
return DataReturn('日志订单有误', -1);
}
// 获取关联信息
$pay_log_value = Db::name('PayLogValue')->where(['pay_log_id'=>$pay_log_data['id']])->column('business_id');
if(empty($pay_log_value))
{
return DataReturn('日志订单关联信息有误', -1);
}
// 获取订单
$order_list = Db::name('Order')->where(['id'=>$pay_log_value, 'status'=>1])->select();
if(empty($order_list))
{
return DataReturn('订单信息有误', -1);
}
// 订单数量是否一致
if(count($order_list) != count($pay_log_value))
{
return DataReturn('订单与日志记录数量不一致', -1);
}
// 支付金额是否小于订单金额
if($pay_ret['data']['pay_price'] < $pay_log_data['total_price'])
{
return DataReturn('支付金额小于日志订单金额', -1);
}
// 支付处理
$pay_params = [
'order' => $order,
'payment' => $payment[0],
'pay' => [
'trade_no' => $ret['data']['trade_no'],
'subject' => $ret['data']['subject'],
'buyer_user' => $ret['data']['buyer_user'],
'pay_price' => $ret['data']['pay_price'],
'order' => $order,
'payment' => $payment[0],
'pay_log_data' => $pay_log_data,
'pay' => [
'trade_no' => $pay_ret['data']['trade_no'],
'subject' => $pay_ret['data']['subject'],
'buyer_user' => $pay_ret['data']['buyer_user'],
'pay_price' => $pay_ret['data']['pay_price'],
],
];
// 支付成功异步通知处理钩子
$hook_name = 'plugins_service_order_pay_notify_handle';
$ret = HookReturnHandle(Hook::listen($hook_name, [
$pay_ret = HookReturnHandle(Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'payment' => $payment[0],
@ -474,24 +629,20 @@ class OrderService
}
/**
* [OrderPayHandle 订单支付处理]
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-10-05T23:02:14+0800
* @param [array] $params [输入参数]
* 订单支付处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-07-28
* @desc description
* @param [array] $params [输入参数]
*/
public static function OrderPayHandle($params = [])
{
// 订单信息
if(empty($params['order']))
if(empty($params['order']) || !is_array($params['order']))
{
return DataReturn('资源不存在或已被删除', -1);
}
if($params['order']['status'] > 1)
{
$status_text = lang('common_order_user_status')[$params['order']['status']]['name'];
return DataReturn('状态不可操作['.$status_text.']', 0);
return DataReturn('订单数据不存在或类型有误', -1);
}
// 支付方式
@ -500,104 +651,131 @@ class OrderService
return DataReturn('支付方式有误', -1);
}
// 订单支付成功处理前钩子
$hook_name = 'plugins_service_order_pay_handle_begin';
$ret = HookReturnHandle(Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => &$params,
'order_id' => $params['order']['id']
]));
if(isset($ret['code']) && $ret['code'] != 0)
// 日志订单
if(empty($params['pay_log_data']))
{
return $ret;
return DataReturn('日志订单有误', -1);
}
// 支付参数
$pay_price = isset($params['pay']['pay_price']) ? $params['pay']['pay_price'] : 0;
// 写入支付日志
$pay_log_data = [
'user_id' => $params['order']['user_id'],
'order_id' => $params['order']['id'],
'total_price' => $params['order']['total_price'],
'trade_no' => isset($params['pay']['trade_no']) ? $params['pay']['trade_no'] : '',
'buyer_user' => isset($params['pay']['buyer_user']) ? $params['pay']['buyer_user'] : '',
'pay_price' => $pay_price,
'subject' => isset($params['pay']['subject']) ? $params['pay']['subject'] : '订单支付',
'payment' => $params['payment']['payment'],
'payment_name' => $params['payment']['name'],
'business_type' => 1,
];
PayLogService::PayLogInsert($pay_log_data);
// 开启事务
Db::startTrans();
// 消息通知
$detail = '订单支付成功,金额'.PriceBeautify($params['order']['total_price']).'元';
MessageService::MessageAdd($params['order']['user_id'], '订单支付', $detail, 1, $params['order']['id']);
// 订单更新数据
$upd_data = [
'status' => 2,
'pay_status' => 1,
'pay_price' => $pay_price,
'payment_id' => $params['payment']['id'],
'pay_time' => time(),
'upd_time' => time(),
];
// 是否线下支付
$upd_data['is_under_line'] = in_array($params['payment']['payment'], config('shopxo.under_line_list')) ? 1 : 0;
// 更新订单状态
if(Db::name('Order')->where(['id'=>$params['order']['id']])->update($upd_data))
// 循环处理
foreach($params['order'] as $order)
{
// 添加状态日志
if(self::OrderHistoryAdd($params['order']['id'], 2, $params['order']['status'], '支付', 0, '系统'))
if($order['status'] > 1)
{
// 库存扣除
$ret = BuyService::OrderInventoryDeduct(['order_id'=>$params['order']['id'], 'order_data'=>$upd_data]);
if($ret['code'] != 0)
{
// 事务回滚
Db::rollback();
return DataReturn($ret['msg'], -10);
}
// 事务回滚
Db::rollback();
$status_text = lang('common_order_user_status')[$order['status']]['name'];
return DataReturn('状态不可操作['.$status_text.']', 0);
}
// 提交事务
Db::commit();
// 订单支付成功处理前钩子
$hook_name = 'plugins_service_order_pay_handle_begin';
$ret = HookReturnHandle(Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => &$params,
'order_id' => $order['id']
]));
if(isset($ret['code']) && $ret['code'] != 0)
{
// 事务回滚
Db::rollback();
return $ret;
}
// 订单支付成功处理完毕钩子
$hook_name = 'plugins_service_order_pay_success_handle_end';
$ret = HookReturnHandle(Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => $params,
'order_id' => $params['order']['id']
]));
// 消息通知
$detail = '订单支付成功,金额'.PriceBeautify($order['total_price']).'元';
MessageService::MessageAdd($order['user_id'], '订单支付', $detail, 1, $order['id']);
// 虚拟商品自动触发发货操作
if($params['order']['order_model'] == 3)
{
self::OrderDelivery([
'id' => $params['order']['id'],
'creator' => 0,
'creator_name' => '系统',
'user_id' => $params['order']['user_id'],
]);
}
// 订单更新数据
$upd_data = [
'status' => 2,
'pay_status' => 1,
'pay_price' => $order['total_price'],
'payment_id' => $params['payment']['id'],
'pay_time' => time(),
'upd_time' => time(),
];
return DataReturn('支付成功', 0);
// 是否线下支付
$upd_data['is_under_line'] = in_array($params['payment']['payment'], config('shopxo.under_line_list')) ? 1 : 0;
// 更新订单状态
if(!Db::name('Order')->where(['id'=>$order['id']])->update($upd_data))
{
// 事务回滚
Db::rollback();
return DataReturn('订单更新失败['.$order['id'].']', -10);
}
// 添加状态日志
if(!self::OrderHistoryAdd($order['id'], 2, $order['status'], '支付', 0, '系统'))
{
// 事务回滚
Db::rollback();
return DataReturn('订单日志添加失败['.$order['id'].']', -10);
}
// 库存扣除
$ret = BuyService::OrderInventoryDeduct(['order_id'=>$order['id'], 'order_data'=>$upd_data]);
if($ret['code'] != 0)
{
// 事务回滚
Db::rollback();
return DataReturn($ret['msg'], -10);
}
// 订单支付成功处理完毕钩子
$hook_name = 'plugins_service_order_pay_success_handle_end';
$ret = HookReturnHandle(Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => $params,
'order_id' => $order['id']
]));
if(isset($ret['code']) && $ret['code'] != 0)
{
// 事务回滚
Db::rollback();
return $ret;
}
// 虚拟商品自动触发发货操作
if($order['order_model'] == 3)
{
self::OrderDelivery([
'id' => $order['id'],
'creator' => 0,
'creator_name' => '系统',
'user_id' => $order['user_id'],
]);
}
}
// 事务回滚
Db::rollback();
// 更新支付日志
$pay_log_data = [
'log_id' => $params['pay_log_data']['id'],
'trade_no' => isset($params['pay']['trade_no']) ? $params['pay']['trade_no'] : '',
'buyer_user' => isset($params['pay']['buyer_user']) ? $params['pay']['buyer_user'] : '',
'pay_price' => isset($params['pay']['pay_price']) ? $params['pay']['pay_price'] : 0,
'subject' => isset($params['pay']['subject']) ? $params['pay']['subject'] : '订单支付',
'payment' => $params['payment']['payment'],
'payment_name' => $params['payment']['name'],
];
$ret = PayLogService::PayLogSuccess($pay_log_data);
if($ret['code'] != 0)
{
// 事务回滚
Db::rollback();
return $ret;
}
// 处理失败
return DataReturn('处理失败', -100);
// 提交事务
Db::commit();
return DataReturn('支付成功', 0);
}
/**

View File

@ -29,33 +29,132 @@ class PayLogService
* @datetime 2019-05-07T00:57:36+0800
* @param [array] $params [输入参数]
* @param [int] $user_id [用户id]
* @param [int] $order_id [业务订单id]
* @param [int] $business_ids [业务订单id]
* @param [float] $total_price [业务订单实际金额]
* @param [string] $trade_no [支付平台交易号]
* @param [string] $buyer_user [支付平台用户帐号]
* @param [float] $pay_price [支付金额]
* @param [string] $subject [业务订单名称]
* @param [string] $payment [支付方式标记]
* @param [string] $payment_name [支付方式名称]
* @param [int] $business_type [业务类型0默认, 1订单, 2充值, ...]
* @return [boolean] [成功true, 失败false]
*/
public static function PayLogInsert($params = [])
{
// 请求参数
$p = [
[
'checked_type' => 'empty',
'key_name' => 'business_ids',
'error_msg' => '业务id为空',
],
[
'checked_type' => 'is_array',
'key_name' => 'business_ids',
'error_msg' => '业务id数据类型有误',
],
[
'checked_type' => 'empty',
'key_name' => 'user_id',
'error_msg' => '用户id为空',
],
[
'checked_type' => 'empty',
'key_name' => 'business_type',
'error_msg' => '业务类型为空',
],
[
'checked_type' => 'empty',
'key_name' => 'total_price',
'error_msg' => '业务金额为空',
],
[
'checked_type' => 'min',
'key_name' => 'total_price',
'checked_data' => 0.01,
'error_msg' => '业务金额必须大于0',
],
];
$ret = ParamsChecked($params, $p);
if($ret !== true)
{
return DataReturn($ret, -1);
}
// 业务id
if(empty($params['business_ids']))
{
return DataReturn('业务id为空', -1);
}
// 日志主数据
$data = [
'log_no' => date('YmdHis').GetNumberCode(6),
'user_id' => intval($params['user_id']),
'total_price' => PriceNumberFormat($params['total_price']),
'business_type' => trim($params['business_type']),
'subject' => isset($params['subject']) ? $params['subject'] : '',
'payment' => isset($params['payment']) ? $params['payment'] : '',
'payment_name' => isset($params['payment_name']) ? $params['payment_name'] : '',
'add_time' => time(),
];
$pay_log_id = Db::name('PayLog')->insertGetId($data);
if($pay_log_id > 0)
{
$business_nos = isset($params['business_nos']) && is_array($params['business_nos']) ? $params['business_nos'] : [];
$value_data = [];
foreach($params['business_ids'] as $bk=>$bv)
{
$value_data[] = [
'pay_log_id' => $pay_log_id,
'business_id' => $bv,
'business_no' => isset($business_nos[$bk]) ? trim($business_nos[$bk]) : '',
'add_time' => time(),
];
}
$res = Db::name('PayLogValue')->insertAll($value_data);
if($res >= count($params['business_ids']))
{
$data['id'] = $pay_log_id;
return DataReturn('添加成功', 0, $data);
}
}
return DataReturn('支付订单添加失败', -100);
}
/**
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-07-27
* @desc description
* @param [int] $log_id [支付日志id]
* @param [string] $trade_no [支付平台交易号]
* @param [string] $buyer_user [支付平台用户帐号]
* @param [float] $pay_price [支付金额]
* @param [string] $payment [支付方式标记]
* @param [string] $payment_name [支付方式名称]
*/
public static function PayLogSuccess($params = [])
{
// 参数
if(empty($params['log_id']))
{
return DataReturn('日志id有误', -100);
}
// 更新数据
$data = [
'user_id' => isset($params['user_id']) ? intval($params['user_id']) : 0,
'order_id' => isset($params['order_id']) ? intval($params['order_id']) : 0,
'total_price' => isset($params['total_price']) ? PriceNumberFormat($params['total_price']) : 0.00,
'trade_no' => isset($params['trade_no']) ? $params['trade_no'] : '',
'buyer_user' => isset($params['buyer_user']) ? $params['buyer_user'] : '',
'pay_price' => isset($params['pay_price']) ? PriceNumberFormat($params['pay_price']) : 0.00,
'subject' => isset($params['subject']) ? $params['subject'] : '',
'payment' => isset($params['payment']) ? $params['payment'] : '',
'payment_name' => isset($params['payment_name']) ? $params['payment_name'] : '',
'business_type' => isset($params['business_type']) ? intval($params['business_type']) : 0,
'add_time' => time(),
'status' => 1,
'pay_time' => time(),
];
return Db::name('PayLog')->insertGetId($data) > 0;
if(Db::name('PayLog')->where(['id'=>intval($params['log_id']), 'status'=>0])->update($data))
{
return DataReturn('日志订单更新成功', 0);
}
return DataReturn('日志订单更新失败', -100);
}
/**

View File

@ -16,6 +16,7 @@ ul { list-style: none; }
.dl-content dd:not(:last-child) { border-bottom: 1px solid #efefef; }
.dl-content dt, .dl-content dd { font-weight: normal !important; text-align: left; margin-top: 0px; line-height: 20px; min-height: 40px; padding-top: 10px; padding-bottom: 10px; }
.dl-content-dd-only dd { padding-left: 0; }
.dl-content-dd-compact dd { line-height: 25px; min-height: 25px; padding: 0; }
/**
* 表单优化

View File

@ -1663,6 +1663,21 @@ function FromTableCheckedValues(form)
return values;
}
/**
* 判断变量是否为数组
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-07-28
* @desc description
* @param {[mixed]} value [变量值]
*/
function IsArray(value)
{
return Object.prototype.toString.call(value) == '[object Array]';
}
// 公共数据操作
$(function()

View File

@ -1,79 +1,218 @@
/**
* 订单列表
* 进度
*/
/* 列表 */
table { width: 100%; }
table.data-list { margin-top: 10px; }
table.data-list-success, table.data-list-success td { border:1px solid #daf3ff; }
table.data-list { background:#FFF; border-radius:2px; -moz-border-radius:2px; -webkit-border-radius:2px; }
table.data-list * { font-size:12px; }
table.data-list td { padding:10px; vertical-align: top; }
.content-title th, table.data-list tr td+td { text-align:center; }
ul.progress {
margin: 20px 0;
}
ul.progress li {
position: relative;
}
ul.progress li i.step {
display: block;
background-color: #e1e1e1;
}
ul.progress li .digital {
background-color: #f7f7f7;
border-radius: 50px;
width: 36px;
height: 36px;
line-height: 26px;
text-align: center;
color: #e1e1e1;
font-weight: 700;
border: 6px solid #e1e1e1;
}
ul.progress li .base .title {
font-weight: 500;
color: #666;
}
ul.progress li .base .date {
color: #999;
}
ul.progress li.steps-success .digital {
border: 6px solid #4CAF50;
color: #fff;
}
ul.progress li.steps-success .digital {
background-color: #82cc85;
}
ul.progress li.steps-success i.step {
background-color: #4CAF50;
}
ul.progress li.current .title {
color: #4CAF50;
}
.base-right .icon-tips, .base-right .icon-success {
font-size: 50px;
}
.base-right .icon-tips {
color: #6980d0;
}
.base-right .icon-success {
color: #28801c;
}
.content img { width:80px; height:80px; }
.content p { margin:0px; }
.content a:hover { color:#F60; }
.row-content { min-width:102px; }
.content-checkbox-operate { padding:3px 5px; }
.submit-pay { margin-top: 5px; }
.wap-base, .base-operate { padding-top: 3px; }
.base-operate { margin-top: 3px; }
.content-hd td span { color: #666; }
@media only screen and (min-width: 641px) {
.row-content { width:25%; }
.row-price { width:15%; }
.row-number { width:10%; }
.row-goods-operate { width: 10%; }
.row-total-price { width:20%; }
.row-status { width:10%; }
.row-operate { width:10%; }
ul.progress {
overflow: hidden;
}
ul.progress li {
float: left;
width: 20%;
text-align: center;
}
ul.progress li i.step {
display: block;
height: 6px;
width: 100%;
position: absolute;
margin: 15px 0 0 -50%;
z-index: 1;
}
ul.progress li .digital {
position: absolute;
margin-left: calc(50% - 18px);
z-index: 2;
}
ul.progress li .base {
margin-top: 50px;
}
}
@media only screen and (max-width: 641px) {
ul.progress li i.step {
height: 60px;
width: 6px;
margin-left: 15px;
}
ul.progress li .base {
position: absolute;
left: 50px;
top: 0;
}
ul.progress li:not(:first-child) .base {
margin-top: 70px;
}
}
/**
* 文本列表
*/
.items {
line-height: 30px;
overflow: hidden;
}
.items-detail {
color: #666;
}
/**
* 订单详情基础
*/
.order-base .am-panel {
-webkit-box-shadow: none;
box-shadow: none;
}
.order-base .am-panel-bd, .order-base .base-right {
padding: 5px 10px;
}
.order-base, .order-base .status {
overflow: hidden;
}
.order-base .status-name {
line-height: 80px;
}
.order-base .operation .am-btn {
margin-left: 15px;
}
.order-base .logistics {
margin-top: 10px;
}
.order-base .am-btn-block {
width: auto;
padding-left: 1em;
padding-right: 1em;
}
@media only screen and (min-width: 641px) {
.order-base .base-left, .order-base .base-right {
width: 50%;
float: left;
}
.order-base {
border: 1px solid #ddd;
}
.order-base .am-panel-default {
border-color: #fff;
}
.order-base .am-panel {
border: 0;
margin: 0;
}
.order-base .base-left {
border-right: 1px solid #ddd;
}
.order-base .base-right {
padding-top: 0;
}
}
@media only screen and (max-width: 641px) {
table.data-list td { padding: 5px; }
.row-content { width:40%; }
.row-goods-operate { width: 20%; }
.row-status { width:20%; }
.row-operate { width:20%; }
.order-base .base-right {
border: 1px solid #ddd;
}
}
/* 不在进行中 */
table.data-list { border: 1px solid #eee; }
table.data-list td.row-number, table.data-list td.row-total-price, table.data-list td.row-status, table.data-list td.row-operate { border-right: 1px solid #eee; }
table.data-list td { border-bottom:1px solid #eee; }
table.data-list .content-hd td { background:#eee; border-bottom-color:#eee; }
table.data-list:hover { box-shadow:0 1px 1px #E4E4E4; background:#fbfbfb; }
table.data-list .base-operate { border-top: 1px dashed #eee; }
/**
* 业务面板
*/
.user-content-body .business-panel {
margin-top: 20px;
box-shadow: none;
-webkit-box-shadow: none;
}
/* 进行中 */
table.data-ongoing { border: 1px solid #daf3ff; }
table.data-ongoing td.row-number, table.data-ongoing td.row-total-price, table.data-ongoing td.row-status, table.data-ongoing td.row-operate { border-right: 1px solid #daf3ff; }
table.data-ongoing td { border-bottom:1px solid #daf3ff; }
table.data-ongoing .content-hd td { background: #eaf8ff; border-bottom-color:#daf3ff; }
table.data-ongoing:hover { box-shadow:0 1px 1px #aed8ff; background:#f7fdff; }
table.data-ongoing .base-operate { border-top: 1px dashed #daf3ff; }
/**
* 支付弹窗
*/
.business-item h3 { border-bottom: 3px solid #e3e3e3; margin-top:5px; font-size: 14px;font-weight: 700; }
.business-item ul { padding: 10px 3px 5px 5px; overflow: hidden; }
.business-item ul li { border:1px solid transparent ;overflow: hidden; float: left; cursor: pointer; padding: 5px; border: 1px solid #eee; margin: 0 10px 10px 0; }
.business-item ul li img { width: 36px; height: 36px; }
.business-item ul li.selected { border-color: #d2364c ; position: relative; box-shadow: 0px 0 0px 1px #d2364c; }
.business-item ul li.selected i.icon-active { position: absolute; width: 10px; height: 10px; font-size: 0; line-height: 0; right: 0px; bottom: 0px; background: url(../images/sys-item-selected.gif) no-repeat right bottom; }
@media only screen and (min-width:640px) {
.business-item ul li {width:calc(33% - 5px); }
.business-item ul li:nth-child(3n) { margin-right: 0; }
.business-item ul li:hover { border: 1px solid #d2364c; box-shadow: 0px 0 0px 1px #d2364c; }
}
@media only screen and (max-width:640px) {
.business-item ul li { width: calc(50% - 5px); }
.business-item ul li:nth-child(2n) { margin-right: 0; }
}
/**
* 商品列表
*/
.goods-detail { position: relative; min-height: 80px; }
.goods-detail img { width: 80px; height: 80px; position: absolute; left: 0; top: 0; }
.goods-title { display: -webkit-box; max-height: 36px; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.goods-title:hover { text-decoration: underline; }
.goods-base { float: left; top: 0; margin-left: 85px; }
.goods-attr { margin-top: 5px; }
.goods-attr li { color: #888; line-height: 16px; }
.original-price, .line-price, strong.total-price-content { font-family: Verdana,Tahoma,arial; }
.original-price { color: #9c9c9c; text-decoration: line-through; }
.line-price { color: #3c3c3c; }
.line-price, strong.total-price-content { font-weight: 700; }
strong.total-price-content { color: #d2364c; font-size: 14px; }
@media only screen and (max-width:640px) {
.goods-detail { min-height: 40px; }
.goods-detail .goods-images { display: none; }
.goods-base { margin-left: 0px; }
table.data-list td.row-status { border-left: 1px solid #eee; }
table.data-ongoing td.row-status { border-left: 1px solid #fff1f5; }
/**
* 虚拟销售
*/
.fictitious-panel-container ul.am-list li:first-child {
border-top: 0;
}
.fictitious-panel-container ul.am-list li:last-child {
border-bottom: 0;
}

View File

@ -1,253 +0,0 @@
/**
* 进度
*/
ul.progress {
margin: 20px 0;
}
ul.progress li {
position: relative;
}
ul.progress li i.step {
display: block;
background-color: #e1e1e1;
}
ul.progress li .digital {
background-color: #f7f7f7;
border-radius: 50px;
width: 36px;
height: 36px;
line-height: 26px;
text-align: center;
color: #e1e1e1;
font-weight: 700;
border: 6px solid #e1e1e1;
}
ul.progress li .base .title {
font-weight: 500;
color: #666;
}
ul.progress li .base .date {
color: #999;
}
ul.progress li.steps-success .digital {
border: 6px solid #4CAF50;
color: #fff;
}
ul.progress li.steps-success .digital {
background-color: #82cc85;
}
ul.progress li.steps-success i.step {
background-color: #4CAF50;
}
ul.progress li.current .title {
color: #4CAF50;
}
.base-right .icon-tips, .base-right .icon-success {
font-size: 50px;
}
.base-right .icon-tips {
color: #6980d0;
}
.base-right .icon-success {
color: #28801c;
}
@media only screen and (min-width: 641px) {
ul.progress {
overflow: hidden;
}
ul.progress li {
float: left;
width: 20%;
text-align: center;
}
ul.progress li i.step {
display: block;
height: 6px;
width: 100%;
position: absolute;
margin: 15px 0 0 -50%;
z-index: 1;
}
ul.progress li .digital {
position: absolute;
margin-left: calc(50% - 18px);
z-index: 2;
}
ul.progress li .base {
margin-top: 50px;
}
}
@media only screen and (max-width: 641px) {
ul.progress li i.step {
height: 60px;
width: 6px;
margin-left: 15px;
}
ul.progress li .base {
position: absolute;
left: 50px;
top: 0;
}
ul.progress li:not(:first-child) .base {
margin-top: 70px;
}
}
/**
* 文本列表
*/
.items {
line-height: 30px;
overflow: hidden;
}
.items-detail {
color: #666;
}
/**
* 订单详情基础
*/
.order-base .am-panel {
-webkit-box-shadow: none;
box-shadow: none;
}
.order-base .am-panel-bd, .order-base .base-right {
padding: 5px 10px;
}
.order-base, .order-base .status {
overflow: hidden;
}
.order-base .status-name {
line-height: 80px;
}
.order-base .operation .am-btn {
margin-left: 15px;
}
.order-base .logistics {
margin-top: 10px;
}
.order-base .am-btn-block {
width: auto;
padding-left: 1em;
padding-right: 1em;
}
@media only screen and (min-width: 641px) {
.order-base .base-left, .order-base .base-right {
width: 50%;
float: left;
}
.order-base {
border: 1px solid #ddd;
}
.order-base .am-panel-default {
border-color: #fff;
}
.order-base .am-panel {
border: 0;
margin: 0;
}
.order-base .base-left {
border-right: 1px solid #ddd;
}
.order-base .base-right {
padding-top: 0;
}
}
@media only screen and (max-width: 641px) {
.order-base .base-right {
border: 1px solid #ddd;
}
}
/**
* 业务面板
*/
.user-content-body .business-panel {
margin-top: 20px;
box-shadow: none;
-webkit-box-shadow: none;
}
/**
* 支付弹窗
*/
.business-item h3 { border-bottom: 3px solid #e3e3e3; margin-top:5px; font-size: 14px;font-weight: 700; }
.business-item ul { padding: 10px 3px 5px 5px; overflow: hidden; }
.business-item ul li { border:1px solid transparent ;overflow: hidden; float: left; cursor: pointer; padding: 5px; border: 1px solid #eee; margin: 0 10px 10px 0; }
.business-item ul li img { width: 36px; height: 36px; }
.business-item ul li.selected { border-color: #d2364c ; position: relative; box-shadow: 0px 0 0px 1px #d2364c; }
.business-item ul li.selected i.icon-active { position: absolute; width: 10px; height: 10px; font-size: 0; line-height: 0; right: 0px; bottom: 0px; background: url(../images/sys-item-selected.gif) no-repeat right bottom; }
@media only screen and (min-width:640px) {
.business-item ul li {width:calc(33% - 5px); }
.business-item ul li:nth-child(3n) { margin-right: 0; }
.business-item ul li:hover { border: 1px solid #d2364c; box-shadow: 0px 0 0px 1px #d2364c; }
}
@media only screen and (max-width:640px) {
.business-item ul li { width: calc(50% - 5px); }
.business-item ul li:nth-child(2n) { margin-right: 0; }
}
/**
* 商品列表
*/
.order-goods { margin-top: 20px; }
.goods-detail img { width: 80px; height: 80px; position: absolute; left: 0; top: 0; }
.goods-detail { position: relative; min-height: 80px; }
.goods-title { display: block; max-height: 36px; overflow: hidden; text-overflow: ellipsis; }
.goods-title:hover { text-decoration: underline; }
.goods-base { float: left; top: 0; margin-left: 85px; }
.goods-attr li { color: #888; line-height: 16px; }
.original-price, .line-price { font-family: Verdana,Tahoma,arial; }
.original-price { color: #9c9c9c; text-decoration: line-through; }
.line-price { color: #3c3c3c; }
.line-price, strong.total-price-content, strong.total-price-content { font-weight: 700; font-family: Verdana,Tahoma,arial; }
strong.total-price-content { color: #d2364c; }
.am-table { margin-bottom: 10px; }
.am-table > tbody > tr > td { border-top: 1px solid #F5F5F5; }
.am-table > thead > tr > th { border-bottom: 1px solid #f7f7f7; }
@media only screen and (min-width:640px) {
.cart-content table tr .base { width: 40%; }
.cart-content table tr .price { width: 20%; }
.cart-content table tr .number { width: 20%; }
.cart-content table tr .total-price { width: 20%; }
.cart-content { margin-top: 20px; }
}
/**
* 自提点地图
*/
#popup-extraction-receive-map .am-popup-bd,
#map {
width: 100%;
height: 100%;
padding: 0;
}
#popup-extraction-receive-map .am-popup-hd {
border: 0;
}
/**
* 虚拟销售
*/
.fictitious-panel-container ul.am-list li:first-child {
border-top: 0;
}
.fictitious-panel-container ul.am-list li:last-child {
border-bottom: 0;
}

View File

@ -1,11 +1,18 @@
$(function()
{
// 支付窗口
var $pay_popup = $('#order-pay-popup');
// 支付窗口参数初始化
function PayPopupParamsInit(e)
function PayPopupParamsInit(ids, payment_id)
{
$('form.pay-form input[name=id]').val(e.data('id'));
var payment_id = e.data('payment-id') || 0;
if($('.payment-items-'+payment_id).length > 0)
// 数组则转成字符串
if(IsArray(ids))
{
ids = ids.join(',');
}
$('form.pay-form input[name=ids]').val(ids);
if((payment_id || null) != null && $('.payment-items-'+payment_id).length > 0)
{
$('form.pay-form input[name=payment_id]').val(payment_id);
$('.payment-items-'+payment_id).addClass('selected').siblings('li').removeClass('selected');
@ -17,7 +24,8 @@ $(function()
// 支付操作
$('.submit-pay').on('click', function()
{
PayPopupParamsInit($(this));
PayPopupParamsInit($(this).data('id'), $(this).data('payment-id'));
$pay_popup.modal();
});
// 混合列表选择
@ -36,8 +44,8 @@ $(function()
// 支付表单
$('form.pay-form button[type=submit]').on('click', function()
{
var id = $('form.pay-form input[name=id]').val() || 0;
if(id == 0)
var ids = $('form.pay-form input[name=ids]').val() || null;
if(ids == null)
{
PromptCenter('订单id有误');
return false;
@ -68,19 +76,18 @@ $(function()
});
// 自动支付处理
if($('.submit-pay').length > 0)
if($pay_popup.length > 0)
{
// 是否自动提交支付表单
if($('.submit-pay').data('is-pay') == 1)
// 是否自动打开支付窗口
if($pay_popup.data('is-auto') == 1)
{
PayPopupParamsInit($('.submit-pay'));
$('#order-pay-popup button[type="submit"]').trigger('click');
} else {
// 是否自动打开支付窗口
if($('.submit-pay').data('is-auto') == 1)
{
$('.submit-pay').trigger('click');
}
$pay_popup.modal();
}
// 是否自动提交支付表单
if($pay_popup.data('is-pay') == 1)
{
$pay_popup.find('button[type="submit"]').trigger('click');
}
}
@ -89,11 +96,25 @@ $(function()
{
// 是否有选择的数据
var values = FromTableCheckedValues('order_form_checkbox_value');
console.log(values)
if(values.length <= 0)
{
Prompt('请先选中数据');
return false;
}
// 支付url支付地址
var url = $(this).data('url') || null;
if(url == null)
{
Prompt('支付url地址有误');
return false;
}
// 获取第一个订单支付方式
var payment_id = $('#data-list-'+values[0]).find('.submit-pay').data('payment-id') || null;
// 支付弹窗
PayPopupParamsInit(values, payment_id);
$pay_popup.modal();
});
});