order
parent
58d02ffb48
commit
67fa59d27c
|
|
@ -77,6 +77,24 @@ class UserController extends CommonController
|
|||
$user_order_status = OrderService::OrderStatusStepTotal(['user_type'=>'user', 'user'=>$this->user, 'is_comments'=>1]);
|
||||
$this->assign('user_order_status', $user_order_status['data']);
|
||||
|
||||
// 参数
|
||||
$params = array_merge($_POST, $_GET);
|
||||
$params['user'] = $this->user;
|
||||
|
||||
// 条件
|
||||
$where = OrderService::UserOrderListWhere($params);
|
||||
|
||||
// 获取列表
|
||||
$order_params = array(
|
||||
'limit_start' => 0,
|
||||
'limit_number' => 6,
|
||||
'is_items' => 0,
|
||||
'where' => $where,
|
||||
);
|
||||
$order = OrderService::OrderList($order_params);
|
||||
$this->assign('order_list', $order['data']);
|
||||
|
||||
|
||||
$this->display('Index');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@
|
|||
<td class="base">
|
||||
<div class="goods-detail">
|
||||
<a href="{{$goods.goods_url}}" target="_blank">
|
||||
<img src="{{$goods.images}}">
|
||||
<img src="{{$goods.images}}" />
|
||||
</a>
|
||||
<div class="goods-base">
|
||||
<a href="{{$goods.goods_url}}" target="_blank" class="goods-title">{{$goods.title}}</a>
|
||||
|
|
|
|||
|
|
@ -110,12 +110,60 @@
|
|||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd"><i></i>交易提醒</div>
|
||||
<div class="am-panel-bd">
|
||||
<div class="table-no">
|
||||
<div>
|
||||
<i class="am-icon-warning"></i> {{:L('common_not_data_tips')}}
|
||||
<notempty name="order_list">
|
||||
<table class="am-table">
|
||||
<tbody>
|
||||
<foreach name="order_list" item="v">
|
||||
<tr id="data-list-{{$v.id}}" data-id="{{$v.id}}" data-goods-id="{{$v.goods_id}}">
|
||||
<td class="base">
|
||||
<div class="goods-detail">
|
||||
<a href="{{$v.goods_url}}" target="_blank">
|
||||
<img src="{{$v.images}}" />
|
||||
</a>
|
||||
<div class="goods-base">
|
||||
<a href="{{$v.goods_url}}" target="_blank" class="goods-title">{{$v.title}}</a>
|
||||
<notempty name="goods.attribute">
|
||||
<ul class="goods-attr">
|
||||
<foreach name="goods.attribute" item="attr">
|
||||
<li>{{$attr.attr_type_name}}:{{$attr.attr_name}}</li>
|
||||
</foreach>
|
||||
</ul>
|
||||
</notempty>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wap-base am-show-sm-only">
|
||||
<if condition="$goods['original_price'] gt 0">
|
||||
<span class="original-price">¥{{$v.original_price}}</span>
|
||||
</if>
|
||||
<strong class="total-price-content">¥{{$v.price}}</strong>
|
||||
<span class="wap-number">x{{$v.buy_number}}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="price am-hide-sm-only">
|
||||
<if condition="$goods['original_price'] gt 0">
|
||||
<p class="original-price">¥{{$v.original_price}}</p>
|
||||
</if>
|
||||
<p class="line-price">¥{{$v.price}}</p>
|
||||
</td>
|
||||
<td class="number am-hide-sm-only">
|
||||
x{{$v.buy_number}}
|
||||
</td>
|
||||
<td class="total-price am-hide-sm-only">
|
||||
<strong class="total-price-content">¥{{$v.total_price}}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</foreach>
|
||||
</tbody>
|
||||
</table>
|
||||
</notempty>
|
||||
<empty name="order_list">
|
||||
<div class="table-no">
|
||||
<p>
|
||||
<i class="am-icon-warning"></i> {{:L('common_not_data_tips')}}
|
||||
</p>
|
||||
<a href="{{:U('Home/Order/Index')}}" class="am-btn am-btn-default am-radius am-btn-xs">查看全部订单</a>
|
||||
</div>
|
||||
<a href="{{:U('Home/Order/Index')}}" class="am-btn am-btn-default am-radius">查看全部订单</a>
|
||||
</div>
|
||||
</empty>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -682,9 +682,9 @@ class BuyService
|
|||
* @version 1.0.0
|
||||
* @date 2018-09-29
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
* @param [array] $where [条件]
|
||||
*/
|
||||
public static function CartTotal($params = [])
|
||||
public static function CartTotal($where = [])
|
||||
{
|
||||
return (int) M('Cart')->where($where)->count();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -514,6 +514,7 @@ class OrderService
|
|||
$limit_start = max(0, intval($params['limit_start']));
|
||||
$limit_number = max(1, intval($params['limit_number']));
|
||||
$order_by = empty($params['order_by']) ? 'id desc' : I('order_by', '', '', $params);
|
||||
$is_items = isset($params['is_items']) ? intval($params['is_items']) : 1;
|
||||
|
||||
// 获取订单
|
||||
$data = M('Order')->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select();
|
||||
|
|
@ -527,7 +528,6 @@ class OrderService
|
|||
foreach($data as &$v)
|
||||
{
|
||||
// 订单基础
|
||||
$total_price = 0;
|
||||
$v['payment_name'] = '';
|
||||
|
||||
// 状态
|
||||
|
|
@ -545,22 +545,22 @@ class OrderService
|
|||
$v['receive_county_name'] = ResourcesService::RegionName(['region_id'=>$v['receive_county']]);
|
||||
|
||||
// 订单详情
|
||||
$items = $detail_m->where(['order_id'=>$v['id']])->field($detail_field)->select();
|
||||
if(!empty($items))
|
||||
if($is_items == 1)
|
||||
{
|
||||
foreach($items as &$vs)
|
||||
$items = $detail_m->where(['order_id'=>$v['id']])->field($detail_field)->select();
|
||||
if(!empty($items))
|
||||
{
|
||||
$vs['images'] = empty($vs['images']) ? null : $images_host.$vs['images'];
|
||||
$vs['attribute'] = empty($vs['attribute']) ? null : json_decode($vs['attribute'], true);
|
||||
$vs['goods_url'] = HomeUrl('Goods', 'Index', ['id'=>$vs['goods_id']]);
|
||||
$vs['total_price'] = $vs['buy_number']*$vs['price'];
|
||||
|
||||
$total_price += $vs['total_price'];
|
||||
foreach($items as &$vs)
|
||||
{
|
||||
$vs['images'] = empty($vs['images']) ? null : $images_host.$vs['images'];
|
||||
$vs['attribute'] = empty($vs['attribute']) ? null : json_decode($vs['attribute'], true);
|
||||
$vs['goods_url'] = HomeUrl('Goods', 'Index', ['id'=>$vs['goods_id']]);
|
||||
$vs['total_price'] = $vs['buy_number']*$vs['price'];
|
||||
}
|
||||
}
|
||||
$v['items'] = $items;
|
||||
$v['items_count'] = count($items);
|
||||
}
|
||||
$v['items'] = $items;
|
||||
$v['items_count'] = count($items);
|
||||
$v['total_price'] = $total_price;
|
||||
}
|
||||
}
|
||||
return DataReturn('处理成功', 0, $data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue