Browse Source

订单列表修改,添加商品的信息

lizhen_gitee 3 tháng trước cách đây
mục cha
commit
e297f43ccd

+ 11 - 1
application/admin/controller/unishop/Order.php

@@ -67,6 +67,7 @@ class Order extends Backend
                 ->join('user', 'user.id = order.user_id','LEFT')
                 ->join('user intro', 'intro.id = order.intro_uid','LEFT')
                 ->join('user hexiao', 'hexiao.id = order.hexiao_uid','LEFT')
+                ->join('unishop_order_product op', 'op.order_id = order.id','LEFT')
                 ->where($where)
                 ->where($where_user)
                 ->count();
@@ -76,6 +77,7 @@ class Order extends Backend
                 ->join('user', 'user.id = order.user_id','LEFT')
                 ->join('user intro', 'intro.id = order.intro_uid','LEFT')
                 ->join('user hexiao', 'hexiao.id = order.hexiao_uid','LEFT')
+                ->join('unishop_order_product op', 'op.order_id = order.id','LEFT')
                 ->where($where)
                 ->where($where_user)
                 ->sum('total_price');
@@ -85,11 +87,12 @@ class Order extends Backend
                 ->join('user', 'user.id = order.user_id','LEFT')
                 ->join('user intro', 'intro.id = order.intro_uid','LEFT')
                 ->join('user hexiao', 'hexiao.id = order.hexiao_uid','LEFT')
+                ->join('unishop_order_product op', 'op.order_id = order.id','LEFT')
                 ->where($where)
                 ->where($where_user)
                 ->order($sort, $order)
                 ->limit($offset, $limit)
-                ->field('order.*,user.username,intro.username as intro_username,intro.mobile as intro_mobile,hexiao.username as hexiao_username,hexiao.mobile as hexiao_mobile')
+                ->field('order.*,user.username,intro.username as intro_username,intro.mobile as intro_mobile,hexiao.username as hexiao_username,hexiao.mobile as hexiao_mobile,op.product_id as op_product_id,op.title as op_title,op.number as op_number,op.spec as op_spec,op.price as op_price')
                 ->select();
 
             $list = collection($list)->toArray();
@@ -106,6 +109,13 @@ class Order extends Backend
                 $item['hexiao']['username'] = $item['hexiao_username'] ? $item['hexiao_username'] : '';
                 $item['hexiao']['mobile']   = $item['hexiao_mobile']   ? $item['hexiao_mobile'] : '';
 
+                $item['op'] = [];
+                $item['op']['product_id'] = $item['op_product_id'] ? $item['op_product_id'] : '';
+                $item['op']['title']      = $item['op_title']      ? $item['op_title'] : '';
+                $item['op']['number']     = $item['op_number']     ? $item['op_number'] : '';
+                $item['op']['spec']       = $item['op_spec']       ? $item['op_spec'] : '';
+                $item['op']['price']      = $item['op_price']      ? $item['op_price'] : '';
+
                 $item['have_paid_status'] = $item['have_paid'];
                 $item['have_delivered_status'] = $item['have_delivered'];
                 $item['have_received_status'] = $item['have_received'];

+ 8 - 1
public/assets/js/backend/unishop/order.js

@@ -89,7 +89,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             table.bootstrapTable({
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 pk: 'id',
-                sortName: 'id',
+                sortName: 'createtime',
                 fixedColumns:true,
                 fixedRightNumber:1,
                 search:false,
@@ -105,6 +105,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'hexiao.username', title: '核销人'},
                         {field: 'hexiao.mobile', title: '核销人手机'},
                         {field: 'out_trade_no', title: __('Out_trade_no')},
+
+                        {field: 'op.product_id', title: '商品ID'},
+                        {field: 'op.title', title: '商品标题'},
+                        {field: 'op.spec', title: '商品规格'},
+                        {field: 'op.price', title: '商品单价'},
+                        {field: 'op.number', title: '商品数量'},
+
                         {field: 'order_price', title: __('Order_price'), operate:'BETWEEN'},
                         {field: 'discount_price', title: __('Discount_price'), operate:'BETWEEN'},
 //                        {field: 'delivery_price', title: __('Delivery_price'), operate:'BETWEEN'},