dever 3 سال پیش
والد
کامیت
78f33b7a62

+ 1 - 1
app/mshop/src/Data.php

@@ -115,7 +115,7 @@ class Data extends Core
             } else {
                 $status = 5;
             }
-            $state = Dever::db('shop/sell_order')->update(array('where_id' => $info['id'], 'status' => $status, 'operdate' => time()));
+            $state = Dever::db('shop/sell_order')->update(array('where_id' => $info['id'], 'status' => $status, 'fdate' => time()));
 
             # 给用户发消息
             if ($info['uid'] && $info['uid'] > 0) {

+ 3 - 2
app/shop/assets/manage/html/sell_order_goods.html

@@ -1,4 +1,4 @@
-</form>
+
 <form class="layui-form form10" action="" target="f10" method="post">
 <iframe id="f10" name="f10" style="display:none;"></iframe>
 <div class="layui-form-item" id="show">
@@ -23,4 +23,5 @@
         </tr>
       </tbody>
     </table>
-</div>
+</div>
+</form>

+ 11 - 1
app/shop/database/sell_order.php

@@ -324,6 +324,15 @@ return array
             'list'      => true,
         ),
 
+        'fdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '完成时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '',
+        ),
+
         'operdate'     => array
         (
             'type'      => 'int-11',
@@ -369,7 +378,8 @@ return array
 
         'list_button' => array
         (
-            'fast_list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=1"'),
+            //fast_list
+            'list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=1"'),
 
             //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
             //'delete' => array('删除', '', '{status} == 1'),

+ 1 - 1
app/shop/database/sell_order_goods.php

@@ -160,7 +160,7 @@ return array
     (
         'insert' => false,
         'delete' => false,
-        'page_list_table' => 'sell_order_goods',
+        'page_list' => 'sell_order_goods',
     ),
 
     'request' => array

+ 129 - 84
app/shop/lib/Sell.php

@@ -896,6 +896,19 @@ class Sell
 
         $user = Dever::db('passport/user')->find($info['uid']);
 
+        $cdate = date('Y-m-d H:i', $info['cdate']);
+        if ($info['operdate']) {
+            $opertime = date('Y-m-d H:i', $info['operdate']);
+        } else {
+            $opertime = '';
+        }
+
+        if ($info['fdate']) {
+            $fdate = date('Y-m-d H:i', $info['fdate']);
+        } else {
+            $fdate = '';
+        }
+
         if (!$user) {
             $user['username'] = '无';
         }
@@ -903,74 +916,92 @@ class Sell
             $user['truename'] = $user['username'];
         }
 
-        $html = '<div class="layui-col-md12"><div class="layui-card"><div class="layui-card-header">基本信息</div><div class="layui-card-body">';
-        $html .= '<table class="layui-table"><thead><tr><th style="width:20%">项目</th><th style="width:80%">详情</th></tr> </thead><tbody>';
-
-        $html .= '<tr>
-          <td>订单号</td>
-          <td>'.$this->table(false, array(array($info['order_num']))).'</td>
-
-        </tr>';
-
-        $html .= '<tr>
-          <td>门店信息</td>
-          <td>'.$this->table(false, array(array('门店名称:' . $shop['name'], '联系人:' . $shop['truename'], '联系电话:' . $shop['mobile']))).'</td>
-
-        </tr>';
-
-        $html .= '<tr>
-          <td>用户信息</td>
-          <td>'.$this->table(false, array(array('昵称:' . $user['username'], '联系电话:' . $info['mobile']))).'</td>
-        </tr>';
-
         if ($tk && $tk['process'] == 1) {
             $status = '申请' . $tk_status[$tk['status']];
             $process = $tk_process[$tk['process']];
             $process = '';
         }
 
-        if ($info['info']) {
-            $html .= '<tr>
-              <td>订单备注</td>
-              <td>'.$this->table(false, array(array($info['info']))).'</td>
+        $time = array('下单时间:' . $cdate);
 
-            </tr>';
+        if ($opertime) {
+            if ($info['status'] == 2) {
+                $time[] = '通知时间:' . $opertime;
+            }
+            if ($info['status'] == 7) {
+                $time[] = '取消时间:' . $opertime;
+            }
         }
 
-        if (!$info['refund_cash']) {
-            $info['refund_cash'] = 0;
+        if ($fdate) {
+            $time[] = '完成时间:' . $fdate;
         }
 
-        $html .= '<tr>
-          <td>订单信息</td>
-          <td>'.$this->table(array('金额', '退款金额', '数量', '支付方式', '配送方式', '订单状态'), array(array($info['price'], $info['refund_cash'], $info['num'],$config['pay_method'][$info['pay_method']], $config['method'][$info['method']], $status))).'</td>
-        </tr>';
+        $result = array();
+
+        $result['基本信息'] = array
+        (
+            'head' => array('项目', '详情'),
+            'body' => array
+            (
+                array('订单信息', array('订单号:' . $info['order_num'], '金额:' . $info['price'], '数量:' . $info['num'], '状态:' . $status, '支付方式:' . $config['pay_method'][$info['pay_method']], '配送方式:' . $config['method'][$info['method']])),
+
+                array('订单时间', $time),
+
+                array('门店信息', array('门店名称:' . $shop['name'], '联系人:' . $shop['truename'], '联系电话:' . $shop['mobile'])),
+
+                array('用户信息', array('昵称:' . $user['username'], '联系电话:' . $info['mobile'])),
+
+                array('订单备注', $info['info']),
+            )
+        );
 
         if ($info['address_id'] > 0) {
             $address = Dever::load('passport/address')->getOne($info['uid'], $info['address_id']);
-            $html .= '<tr>
-              <td>收货地址</td>
-              <td>'.$this->table(array('省份', '城市', '地区','地址', '门牌号', '姓名', '手机号'), array(array($address['province_name'], $address['city_name'], $address['county_name'], $address['address'], $address['house_number'], $address['contact'], $address['mobile']))).'</td>
-        </tr>';
+
+            $result['收货地址'] = array
+            (
+                'head' => array('省份', '城市', '地区','地址', '门牌号', '姓名', '手机号'),
+                'body' => array($address['province_name'], $address['city_name'], $address['county_name'], $address['address'], $address['house_number'], $address['contact'], $address['mobile'])
+            );
         }
 
         if ($info['invoice_id'] > 0) {
             $invoice = Dever::load('passport/invoice')->getOne($info['uid'], $info['invoice_id']);
-            $html .= '<tr>
-              <td>发票信息</td>
-              <td>'.$this->table(array('发票类型', '抬头', '税号','手机号', '邮箱'), array(array($invoice['title_type_name'], $invoice['title'], $invoice['number'], $invoice['mobile'], $invoice['email']))).'</td>
-        </tr>';
+
+            $result['发票信息'] = array
+            (
+                'head' => array('发票类型', '抬头', '税号','手机号', '邮箱'),
+                'body' => array($invoice['title_type_name'], $invoice['title'], $invoice['number'], $invoice['mobile'], $invoice['email'])
+            );
         }
 
-        $html .= '</tbody></table></div></div>';
 
-        $html .= '<div class="layui-card"><div class="layui-card-header">商品清单</div><div class="layui-card-body">';
+        if (!$info['refund_cash']) {
+            $info['refund_cash'] = 0;
+        }
 
-        $head = array('名称', '属性', '价格', '数量', '状态');
+        if ($info['refund_cash'] > 0 && $tk) {
+            $process = $tk_process[$tk['process']];
+            $result['退款信息'] = array
+            (
+                'head' => array('退款金额', '数量', '退款原因', '退款进度'),
+                'body' => array($info['refund_cash'], $info['num'], $tk['desc'], $process)
+            );
+        }
+
+        $body = $refund_body = array();
+        $body_total = array();
+        $body_total['price'] = 0;
+        $body_total['num'] = 0;
+
+        $refund_body_total = array();
+        $refund_body_total['price'] = 0;
+        $refund_body_total['num'] = 0;
 
-        $body = array();
         $goods = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
         $goods_status = Dever::db('shop/sell_order_goods')->config['status'];
+
         foreach ($goods as $k => $v) {
             $goods_info = Dever::load('goods/lib/info')->getInfoBySku($v['goods_id'], $v['sku_id']);
             $status = $goods_status[$v['status']];
@@ -984,53 +1015,67 @@ class Sell
             } else {
                 $sku = '无';
             }
-            $body[$k] = array
+
+            if ($tk && $v['status'] == 3) {
+                $refund_body[] = array
+                (
+                    $goods_info['name'],
+                    $sku,
+                    $v['price'],
+                    $v['num'],
+                    $tk_status[$tk['status']],
+                );
+                $refund_body_total['price'] += $v['price'];
+                $refund_body_total['num'] += $v['num'];
+            } else {
+                $body[] = array
+                (
+                    $goods_info['name'],
+                    $sku,
+                    $v['price'],
+                    $v['num'],
+                    $status,
+                );
+                $body_total['price'] += $v['price'];
+                $body_total['num'] += $v['num'];
+            }
+        }
+
+        if ($body) {
+            $body[] = array
             (
-                $goods_info['name'],
-                $sku,
-                $v['price'],
-                $v['num'],
-                $status,
+                '合计',
+                '-',
+                $body_total['price'],
+                $body_total['num'],
+                '-'
+            );
+            $result['商品清单'] = array
+            (
+                'head' => array('名称', '属性', '价格', '数量', '状态'),
+                'body' => $body,
             );
         }
-        $html .= $this->table($head, $body) . '</div></div>';
-
-        return $html;
-    }
-
-    private function table($head, $data)
-    {
-        $html = '';
-        if ($head) {
-            $html = '<table class="layui-table">';
-
-            $html .= '<thead><tr>';
-            foreach ($head as $k => $v) {
-                $html .= '<th>'.$v.'</th>';
-            }
-            $html .= '</tr></thead>';
 
-            $html .= '<tbody>';
-            foreach ($data as $k => $v) {
-                $html .= '<tr>';
-                foreach ($v as $k1 => $v1) {
-                    $html .= '<td>'.$v1.'</td>';
-                }
-                $html .= '</tr>';
-            }
+        if ($refund_body) {
+            $refund_body[] = array
+            (
+                '合计',
+                '-',
+                $refund_body_total['price'],
+                $refund_body_total['num'],
+                '-'
+            );
+            $result['商品清单'] = array
+            (
+                'head' => array('名称', '属性', '价格', '数量', '状态'),
+                'body' => $refund_body,
+            );
+        }
+        
 
-            $html .= '</tbody>';
+        $html = Dever::show($result);
 
-            $html .= '</table>';
-        } else {
-            foreach ($data as $k => $v) {
-                $html .= '';
-                foreach ($v as $k1 => $v1) {
-                    $html .= $v1 . '&nbsp;&nbsp;&nbsp;&nbsp;';
-                }
-                $html .= '';
-            }
-        }
         return $html;
     }
 }

+ 2 - 0
app/shop/src/Buy.php

@@ -189,6 +189,7 @@ class Buy extends Core
 	# 确认订单页面
 	public function confirm()
 	{
+		$this->data['uid'] = $this->uid;
 		$this->data['user'] = $this->user;
 		$this->data['shop'] = $this->shop;
 		Dever::load('shop/lib/sell')->goods($this->data);
@@ -207,6 +208,7 @@ class Buy extends Core
 		
 		$info = Dever::input('info');
 
+		$this->data['uid'] = $this->uid;
 		$this->data['user'] = $this->user;
 		$this->data['shop'] = $this->shop;