|
@@ -285,45 +285,109 @@ class Sell
|
|
|
{
|
|
|
$id = Dever::input('order_id');
|
|
|
|
|
|
+ $config = Dever::db('shop/sell_order')->config;
|
|
|
+
|
|
|
$info = Dever::db('shop/sell_order')->one($id);
|
|
|
|
|
|
- $goods = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
|
|
|
+ $shop = Dever::db('shop/info')->find($info['shop_id']);
|
|
|
+
|
|
|
+ $user = Dever::db('passport/user')->find($info['uid']);
|
|
|
+
|
|
|
+ if (!$user['truename']) {
|
|
|
+ $user['truename'] = $user['username'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $html = '订单号:' . $info['order_num'] . '<br />';
|
|
|
+ $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(array('订单状态', '金额', '数量','支付方式', '配送方式'), array(array($config['status'][$info['status']], $info['price'], $info['num'],$config['pay_method'][$info['pay_method']], $config['method'][$info['method']]))).'</td>
|
|
|
+ </tr>';
|
|
|
+
|
|
|
+ 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>';
|
|
|
+ }
|
|
|
|
|
|
- $goods_tbody = '';
|
|
|
+ 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>';
|
|
|
+ }
|
|
|
+
|
|
|
+ $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'], '联系电话:' . $user['mobile']))).'</td>
|
|
|
+ </tr>';
|
|
|
+
|
|
|
+ $html .= '</tbody></table>';
|
|
|
+
|
|
|
+ $html .= '[商品清单]:';
|
|
|
+
|
|
|
+ $head = array('商品名称', '商品属性', '商品价格', '商品数量');
|
|
|
+
|
|
|
+ $body = array();
|
|
|
+ $goods = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
|
|
|
foreach ($goods as $k => $v) {
|
|
|
- $goods_tbody .= '<tr>';
|
|
|
$goods_info = Dever::load('goods/lib/info')->getInfoBySku($v['goods_id'], $v['sku_id']);
|
|
|
-
|
|
|
- $goods_tbody .= '<td>'.$goods_info['name'].'</td>';
|
|
|
- $goods_tbody .= '<td>'.$v['price'].'</td>';
|
|
|
- $goods_tbody .= '<td>'.$v['price'].'</td>';
|
|
|
- $goods_tbody .= '<td>'.$v['num'].'</td>';
|
|
|
- $goods_tbody .= '</tr>';
|
|
|
+ $body[$k] = array
|
|
|
+ (
|
|
|
+ $goods_info['name'],
|
|
|
+ $v['price'],
|
|
|
+ $v['price'],
|
|
|
+ $v['num'],
|
|
|
+ );
|
|
|
}
|
|
|
+ $html .= $this->table($head, $body);
|
|
|
+
|
|
|
+ return $html;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function table($head, $data)
|
|
|
+ {
|
|
|
+ $html = '';
|
|
|
+ if ($head) {
|
|
|
+ $html = '<table class="layui-table">';
|
|
|
|
|
|
- return '
|
|
|
-<table class="layui-table">
|
|
|
-
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td>总金额:'.$info['price'].'</td>
|
|
|
- <td>总数量:'.$info['num'].'</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
-
|
|
|
- <table class="layui-table">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th>商品名称</th>
|
|
|
- <th>商品属性</th>
|
|
|
- <th>商品价格</th>
|
|
|
- <th>商品数量</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- '.$goods_tbody.'
|
|
|
- </tbody>
|
|
|
- </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>';
|
|
|
+ }
|
|
|
+
|
|
|
+ $html .= '</tbody>';
|
|
|
+
|
|
|
+ $html .= '</table>';
|
|
|
+ } else {
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $html .= '';
|
|
|
+ foreach ($v as $k1 => $v1) {
|
|
|
+ $html .= $v1 . ' ';
|
|
|
+ }
|
|
|
+ $html .= '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $html;
|
|
|
}
|
|
|
}
|