|
@@ -282,4 +282,304 @@ class Order
|
|
|
|
|
|
return $data;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public function show()
|
|
|
+ {
|
|
|
+ $id = Dever::input('order_id');
|
|
|
+
|
|
|
+ $config = Dever::db('agent/order')->config['set'];
|
|
|
+
|
|
|
+ $info = Dever::db('agent/order')->one($id);
|
|
|
+
|
|
|
+ $process = Dever::db('agent/order_process')->getData($id);
|
|
|
+
|
|
|
+ $status = $config['status'][$info['status']];
|
|
|
+
|
|
|
+ $member = array();
|
|
|
+ if ($info['mid'] > 0) {
|
|
|
+ $member = Dever::db('agent/member')->find($info['mid']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $parent_member = array();
|
|
|
+ if ($info['parent_mid'] > 0) {
|
|
|
+ $parent_member = Dever::db('agent/member')->find($info['parent_mid']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $cdate = date('Y-m-d H:i', $info['cdate']);
|
|
|
+
|
|
|
+ if ($info['fdate']) {
|
|
|
+ $fdate = date('Y-m-d H:i', $info['fdate']);
|
|
|
+ } else {
|
|
|
+ $fdate = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$member) {
|
|
|
+ $user['username'] = '无';
|
|
|
+ }
|
|
|
+ if (!isset($user['truename'])) {
|
|
|
+ $user['truename'] = $user['username'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$info['coupon_cash']) {
|
|
|
+ $info['coupon_cash'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$info['kou_cash']) {
|
|
|
+ $info['kou_cash'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$info['ps_cash']) {
|
|
|
+ $info['ps_cash'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$info['wallet_cash']) {
|
|
|
+ $info['wallet_cash'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$info['card_code_cash']) {
|
|
|
+ $info['card_code_cash'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($info['card_code_card']) {
|
|
|
+ $info['card_code_cash'] .= '('.$info['card_code_card'].')';
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($tk && $tk['process'] == 1) {
|
|
|
+ $status = '申请' . $tk_status[$tk['status']];
|
|
|
+ $process = $tk_process[$tk['process']];
|
|
|
+ $process = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ $time = array();
|
|
|
+ $time[] = array('下单时间', $cdate);
|
|
|
+
|
|
|
+ if ($opertime) {
|
|
|
+ if ($info['status'] == 2) {
|
|
|
+ $time[] = array('通知时间', $opertime);
|
|
|
+ }
|
|
|
+ if ($info['status'] == 7) {
|
|
|
+ $time[] = array('取消时间:', $opertime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($fdate) {
|
|
|
+ $time[] = array('完成时间:', $fdate);
|
|
|
+ }
|
|
|
+
|
|
|
+ $result = array();
|
|
|
+
|
|
|
+ $result[$info['order_num']] = array
|
|
|
+ (
|
|
|
+ 'type' => 'info',
|
|
|
+ 'content' => array
|
|
|
+ (
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('订单状态', $status),
|
|
|
+ array('支付方式', $config['pay_method'][$info['pay_method']]),
|
|
|
+ array('配送方式', $config['method'][$info['method']]),
|
|
|
+ ),
|
|
|
+
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('门店名称', $shop['name']),
|
|
|
+ array('联系人', $shop['truename']),
|
|
|
+ array('联系电话', $shop['mobile']),
|
|
|
+ ),
|
|
|
+
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('下单用户', $user['username']),
|
|
|
+ array('联系电话', $info['mobile']),
|
|
|
+ array('订单备注', $info['info']),
|
|
|
+ ),
|
|
|
+
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('支付金额', '¥ ' . round($info['price'], 2)),
|
|
|
+ array('优惠券满减', '¥ ' . $info['coupon_cash']),
|
|
|
+ array('配送费', '¥ ' . $info['ps_cash']),
|
|
|
+ ),
|
|
|
+
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('礼品卡抵扣', '¥ ' . round($info['card_code_cash'], 2)),
|
|
|
+ array('钱包抵扣', '¥ ' . round($info['wallet_cash'], 2)),
|
|
|
+ array('抹零', '¥ ' . round($info['kou_cash'], 2)),
|
|
|
+ ),
|
|
|
+
|
|
|
+ $time,
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ if ($info['address_id'] > 0) {
|
|
|
+ $address = Dever::load('passport/address')->getOne($info['uid'], $info['address_id']);
|
|
|
+
|
|
|
+ if ($address) {
|
|
|
+
|
|
|
+ $result['收货地址'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'info',
|
|
|
+ 'content' => array
|
|
|
+ (
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('联系人', $address['contact']),
|
|
|
+ array('联系电话', $address['mobile']),
|
|
|
+ ),
|
|
|
+
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('收货地址', $address['address']),
|
|
|
+ array('门牌号', $address['house_number']),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if ($info['invoice_id'] > 0) {
|
|
|
+ $invoice = Dever::load('passport/invoice')->getOne($info['uid'], $info['invoice_id']);
|
|
|
+
|
|
|
+ if ($invoice) {
|
|
|
+
|
|
|
+ $result['发票信息'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'info',
|
|
|
+ 'content' => array
|
|
|
+ (
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('发票类型', $invoice['title_type_name']),
|
|
|
+ array('抬头', $invoice['title']),
|
|
|
+ array('税号', $invoice['number']),
|
|
|
+ ),
|
|
|
+
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('手机号', $invoice['mobile']),
|
|
|
+ array('邮箱', $invoice['email']),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (!$info['refund_cash']) {
|
|
|
+ $info['refund_cash'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($info['refund_cash'] > 0 && $tk) {
|
|
|
+ $process = $tk_process[$tk['process']];
|
|
|
+ $tk['cdate'] = date('Y-m-d H:i', $tk['cdate']);
|
|
|
+ $result['退款信息'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'info',
|
|
|
+ 'content' => array
|
|
|
+ (
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('退款金额', $info['refund_cash']),
|
|
|
+ array('数量', $info['num']),
|
|
|
+ array('退款进度', $process),
|
|
|
+ ),
|
|
|
+
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('申请时间', $tk['cdate']),
|
|
|
+ array('退款原因', $tk['desc']),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ $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;
|
|
|
+
|
|
|
+ $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']];
|
|
|
+ $tk = Dever::db('shop/sell_order_refund')->find(array('order_id' => $info['id'], 'order_goods_id' => $v['id'], 'type' => 2));
|
|
|
+ if ($tk && $tk['process'] == 1) {
|
|
|
+ $status = '申请' . $tk_status[$tk['status']];
|
|
|
+
|
|
|
+ }
|
|
|
+ if (isset($goods_info['sku'])) {
|
|
|
+ $sku = $goods_info['sku']['string'];
|
|
|
+ } else {
|
|
|
+ $sku = '无';
|
|
|
+ }
|
|
|
+
|
|
|
+ $d = array
|
|
|
+ (
|
|
|
+ 'pic' => $goods_info['cover'],
|
|
|
+ 'name' => $goods_info['name'],
|
|
|
+ 'sku' => $sku,
|
|
|
+ 'price' => $v['price'],
|
|
|
+ 'num' => $v['num'],
|
|
|
+ 'status' => $status,
|
|
|
+ );
|
|
|
+
|
|
|
+ if ($tk && $v['status'] == 3) {
|
|
|
+ $d['status'] = $tk_status[$tk['status']];
|
|
|
+ $refund_body[] = $d;
|
|
|
+ $price = $v['price']*$v['num'];
|
|
|
+ $refund_body_total['price'] += $price;
|
|
|
+ $refund_body_total['num'] += $v['num'];
|
|
|
+ } else {
|
|
|
+ $body[] = $d;
|
|
|
+ $price = $v['price']*$v['num'];
|
|
|
+ $body_total['price'] += $price;
|
|
|
+ $body_total['num'] += $v['num'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($body) {
|
|
|
+ if ($refund_body_total['price']) {
|
|
|
+ $body_total['set_price'] = $body_total['price'] - $refund_body_total['price'];
|
|
|
+ }
|
|
|
+ if ($refund_body_total['num']) {
|
|
|
+ $body_total['set_num'] = $body_total['num'] - $refund_body_total['num'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $result['商品清单'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'list',
|
|
|
+ 'content' => $body,
|
|
|
+ 'total' => $body_total,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($refund_body) {
|
|
|
+ $result['退款商品'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'list',
|
|
|
+ 'content' => $refund_body,
|
|
|
+ 'total' => $refund_body_total,
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $head = array
|
|
|
+ (
|
|
|
+ 'name' => '基本信息',
|
|
|
+ 'btn' => array(),
|
|
|
+ );
|
|
|
+ $html = Dever::show($head, $result);
|
|
|
+
|
|
|
+ return $html;
|
|
|
+ }
|
|
|
}
|