|
@@ -0,0 +1,329 @@
|
|
|
|
+<?php namespace Place_order\Manage\Lib\Role;
|
|
|
|
+use Dever;
|
|
|
|
+class View
|
|
|
|
+{
|
|
|
|
+ private $info;
|
|
|
|
+ private $user;
|
|
|
|
+
|
|
|
|
+ # 后台详情页
|
|
|
|
+ public function get($info)
|
|
|
|
+ {
|
|
|
|
+ $info['detail'] = Dever::db('role_detail', 'place_order')->select(['order_id' => $info['id']]);
|
|
|
|
+ $this->info = Dever::load('role/order', 'place_order')->getView($info);
|
|
|
|
+ $tab = $this->getTab();
|
|
|
|
+ return ['title' => '订单详情', 'info' => $this->getInfo(), 'tab' => $tab];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # 获取基本信息
|
|
|
|
+ private function getInfo()
|
|
|
|
+ {
|
|
|
|
+ $info[] = [
|
|
|
|
+ # 类型,info介绍 desc描述 table表格,表格有head和body即可
|
|
|
|
+ 'type' => 'info',
|
|
|
|
+ 'name' => '身份订单',
|
|
|
|
+ 'info' => '订单号:' . $this->info['order_num'],
|
|
|
|
+ # 具体内容
|
|
|
|
+ 'content' => [
|
|
|
|
+ ['name' => '订单状态', 'content' => $this->info['status_name']],
|
|
|
|
+ ['name' => '总金额', 'content' => $this->info['cash_text']],
|
|
|
|
+ ['name' => '总数量', 'content' => $this->info['num']],
|
|
|
|
+ ['name' => '下单时间', 'content' => $this->info['cdate_str']],
|
|
|
|
+ ],
|
|
|
|
+ ];
|
|
|
|
+ return $info;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # 获取切换列表
|
|
|
|
+ private function getTab()
|
|
|
|
+ {
|
|
|
|
+ $tab['active'] = 'view';
|
|
|
|
+ $tab['content']['view'] = $this->getView();
|
|
|
|
+ $tab['content']['list'] = $this->getList();
|
|
|
|
+
|
|
|
|
+ # 返利信息
|
|
|
|
+ $rebate = Dever::db('rebate', 'place_order')->select(['table' => 'role', 'table_id' => $this->info['id']]);
|
|
|
|
+ if ($rebate) {
|
|
|
|
+ $tab['content']['rebate'] = $this->getRebate($rebate);
|
|
|
|
+ }
|
|
|
|
+ $tab['content']['log'] = $this->getLog();
|
|
|
|
+ return $tab;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # 获取详情
|
|
|
|
+ private function getView()
|
|
|
|
+ {
|
|
|
|
+ $content = [];
|
|
|
|
+ $sales = Dever::load('manage/info', 'place_channel_sales')->getInfo($this->info['sales_type'], $this->info['sales_id']);
|
|
|
|
+ $content[] = [
|
|
|
|
+ 'type' => 'list',
|
|
|
|
+ 'name' => '用户信息',
|
|
|
|
+ 'content' => [
|
|
|
|
+ [
|
|
|
|
+ 'name' => '用户名称',
|
|
|
|
+ 'content' => $this->info['user']['name'],
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'name' => '用户账户',
|
|
|
|
+ 'content' => $this->info['user']['mobile'],
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'name' => '渠道信息',
|
|
|
|
+ 'content' => $sales,
|
|
|
|
+ ],
|
|
|
|
+ ],
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ $coupon_tip = '';
|
|
|
|
+ if ($this->info['user_coupon_id'] > 0) {
|
|
|
|
+ $user_coupon = Dever::db('coupon', 'place_user')->find($this->info['user_coupon_id']);
|
|
|
|
+ $coupon = Dever::db('coupon', 'place_benefit')->find($this->info['coupon_id']);
|
|
|
|
+ $coupon_tip = $coupon['name'];
|
|
|
|
+ if ($coupon['type'] == 3) {
|
|
|
|
+ $user_coupon['value'] = floor($user_coupon['value']) . '折';
|
|
|
|
+ $coupon_tip .= ',折扣:' . $user_coupon['value'] . ',抵扣:' . $this->info['coupon_cash_text'];
|
|
|
|
+ } elseif ($coupon['type'] == 4) {
|
|
|
|
+ $user_coupon['value'] = floor($user_coupon['value']) . '个';
|
|
|
|
+ $this->info['coupon_value'] = floor($this->info['coupon_value']) . '个';
|
|
|
|
+ $coupon_tip .= ',总数:' . $user_coupon['value'] . ',本次使用:'.$this->info['coupon_value'].',抵扣:' . $this->info['coupon_cash_text'];
|
|
|
|
+ } else {
|
|
|
|
+ $user_coupon['value'] = Dever::load('info', 'place_score')->toScore($user_coupon['value'], $this->info['score']['exp']);
|
|
|
|
+ $user_coupon['value'] = Dever::load('info', 'place_score')->getText($user_coupon['value'], $this->info['score']);
|
|
|
|
+ $coupon_tip .= ',总面值:' . $user_coupon['value'] . ',本次使用:' . $this->info['coupon_cash_text'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $gift_tip = '';
|
|
|
|
+ if ($this->info['user_gift_id'] > 0) {
|
|
|
|
+ $user_gift = Dever::db('gift', 'place_user')->find($this->info['user_gift_id']);
|
|
|
|
+ $gift = Dever::db('gift', 'place_benefit')->find($this->info['gift_id']);
|
|
|
|
+ $gift_tip = $gift['name'];
|
|
|
|
+ $user_gift['value'] = Dever::load('info', 'place_score')->toScore($user_gift['value'], $this->info['score']['exp']);
|
|
|
|
+ $user_gift['value'] = Dever::load('info', 'place_score')->getText($user_gift['value'], $this->info['score']);
|
|
|
|
+ $gift_tip .= ',总面值:' . $user_gift['value'] . ',本次使用:' . $this->info['gift_cash_text'];
|
|
|
|
+ }
|
|
|
|
+ $content[] = [
|
|
|
|
+ 'type' => 'list',
|
|
|
|
+ 'name' => '金额信息',
|
|
|
|
+ 'content' => [
|
|
|
|
+ [
|
|
|
|
+ 'name' => '总金额',
|
|
|
|
+ 'content' => $this->info['cash_text'],
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'name' => '优惠券抵扣',
|
|
|
|
+ 'content' => $this->info['coupon_cash_text'],
|
|
|
|
+ 'tip' => $coupon_tip,
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'name' => '礼品卡抵扣',
|
|
|
|
+ 'content' => $this->info['gift_cash_text'],
|
|
|
|
+ 'tip' => $gift_tip,
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'name' => $this->info['score']['name'] . '抵扣',
|
|
|
|
+ 'content' => $this->info['wallet_cash_text'],
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'name' => '支付金额',
|
|
|
|
+ 'content' => $this->info['pay_cash_text'] . '['.$this->info['pay_money_cash_text'].']',
|
|
|
|
+ ],
|
|
|
|
+ ],
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ return [
|
|
|
|
+ 'type' => 'mul',
|
|
|
|
+ 'name' => '详情',
|
|
|
|
+ 'content' => $content
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # 获取清单
|
|
|
|
+ private function getList()
|
|
|
|
+ {
|
|
|
|
+ if ($this->info['detail']) {
|
|
|
|
+ foreach ($this->info['detail'] as &$v) {
|
|
|
|
+ $v['status'] = Dever::db('role_detail', 'place_order')->value('status', $v['status']);
|
|
|
|
+ $v['cash'] = $this->getListCash($v);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return [
|
|
|
|
+ 'name' => '清单',
|
|
|
|
+ 'type' => 'table',
|
|
|
|
+ 'border' => true,
|
|
|
|
+ # 这里配置和列表list一模一样
|
|
|
|
+ 'head' => [
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'name',
|
|
|
|
+ 'name' => '身份等级',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'cash',
|
|
|
|
+ 'name' => '单价',
|
|
|
|
+ 'type' => 'popover',
|
|
|
|
+ 'location' => 'right',
|
|
|
|
+ //'tag' => true,
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'num',
|
|
|
|
+ 'name' => '数量',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'status',
|
|
|
|
+ 'name' => '状态',
|
|
|
|
+ ],
|
|
|
|
+ ],
|
|
|
|
+ 'button' => [],
|
|
|
|
+ 'body' => $this->info['detail'],
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function getListCash($detail)
|
|
|
|
+ {
|
|
|
|
+ $data['name'] = Dever::load('info', 'place_score')->getText($detail['cash'], $this->info['score']);
|
|
|
|
+ $promotion = Dever::db('promotion', 'place_order')->select(['table' => 'role_detail', 'table_id' => $detail['id']]);
|
|
|
|
+ if ($promotion) {
|
|
|
|
+ $data['content'] = [];
|
|
|
|
+ $data['content']['type'] = 'line';
|
|
|
|
+ $data['content']['content'] = [];
|
|
|
|
+ foreach ($promotion as $k => $v) {
|
|
|
|
+ if ($k == 0) {
|
|
|
|
+ $v['m_price'] = Dever::load('info', 'place_score')->getText($v['m_price'], $this->info['score']);
|
|
|
|
+ $data['content']['content'][] = ['name' => '原价', 'content' => $v['m_price']];
|
|
|
|
+ }
|
|
|
|
+ $v['price'] = Dever::load('info', 'place_score')->getText($v['price'], $this->info['score']);
|
|
|
|
+ $v['price'] = $v['price'] . '('.$v['value'].'折)';
|
|
|
|
+ $data['content']['content'][] = ['name' => $v['name'], 'content' => $v['price']];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # 金额信息
|
|
|
|
+ list($detail['total_cash'], $detail['pay_cash'], $detail['wallet_cash'], $detail['coupon_cash'], $detail['gift_cash']) = Dever::load('info', 'place_score')->getText([$detail['total_cash'], $detail['pay_cash'], $detail['wallet_cash'], $detail['coupon_cash'], $detail['gift_cash']], $this->info['score']);
|
|
|
|
+ $data['content']['content'][] = ['name' => '总金额', 'content' => $detail['total_cash']];
|
|
|
|
+ $data['content']['content'][] = ['name' => '优惠券抵扣', 'content' => $detail['coupon_cash']];
|
|
|
|
+ $data['content']['content'][] = ['name' => '礼品卡抵扣', 'content' => $detail['gift_cash']];
|
|
|
|
+ $data['content']['content'][] = ['name' => $this->info['score']['name'] . '抵扣', 'content' => $detail['wallet_cash']];
|
|
|
|
+ $data['content']['content'][] = ['name' => '支付金额', 'content' => $detail['pay_cash']];
|
|
|
|
+
|
|
|
|
+ # 返利信息
|
|
|
|
+ $rebate = Dever::db('rebate', 'place_order')->select(['table' => 'role_detail', 'table_id' => $detail['id']]);
|
|
|
|
+ if ($rebate) {
|
|
|
|
+ foreach ($rebate as $v) {
|
|
|
|
+ if ($v['level'] == 0) {
|
|
|
|
+ $data['content']['content'][] = ['name' => '购买返利', 'content' => $v['value_text']];
|
|
|
|
+ } else {
|
|
|
|
+ $data['content']['content'][] = ['name' => '返利' . $v['level'] . '层', 'content' => $v['value_text']];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $result = [0 => $data];
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # 获取返利信息
|
|
|
|
+ private function getRebate($rebate)
|
|
|
|
+ {
|
|
|
|
+ foreach ($rebate as &$v) {
|
|
|
|
+ //$v['status'] = $this->getRefundStatus($v);
|
|
|
|
+ $score = Dever::load('info', 'place_score')->get($v['score_id']);
|
|
|
|
+ $v['score_name'] = $score['name'];
|
|
|
|
+ $v['username'] = '无';
|
|
|
|
+ if ($v['level'] == 0) {
|
|
|
|
+ $user = Dever::db('info', 'place_user')->find($this->info['uid']);
|
|
|
|
+ $v['username'] = $user['name'];
|
|
|
|
+ } else {
|
|
|
|
+ $parent = Dever::load('relation', 'invite')->getParent($this->info['uid'], $v['level']);
|
|
|
|
+ if ($parent) {
|
|
|
|
+ $user = Dever::db('info', 'place_user')->find($parent['uid']);
|
|
|
|
+ if ($user) {
|
|
|
|
+ $v['username'] = $user['name'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $v['status_name'] = '未入账';
|
|
|
|
+ if ($this->info['status'] == 5 || $this->info['status'] == 6) {
|
|
|
|
+ $v['status_name'] = '已入账';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return [
|
|
|
|
+ 'name' => '返利',
|
|
|
|
+ 'type' => 'table',
|
|
|
|
+ 'border' => true,
|
|
|
|
+ #'height' => '200',
|
|
|
|
+ 'head' => [
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'name',
|
|
|
|
+ 'name' => '名称',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'score_name',
|
|
|
|
+ 'name' => '奖励积分',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'level',
|
|
|
|
+ 'name' => '奖励层级',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'value_text',
|
|
|
|
+ 'name' => '奖励金额',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'username',
|
|
|
|
+ 'name' => '奖励领取人',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'status_name',
|
|
|
|
+ 'name' => '入账状态',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ ],
|
|
|
|
+ 'button' => [],
|
|
|
|
+ 'body' => $rebate,
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # 获取操作日志
|
|
|
|
+ private function getLog()
|
|
|
|
+ {
|
|
|
|
+ return [
|
|
|
|
+ 'name' => '记录',
|
|
|
|
+ 'type' => 'table',
|
|
|
|
+ 'border' => true,
|
|
|
|
+ #'height' => '200',
|
|
|
|
+ 'head' => [
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'utype',
|
|
|
|
+ 'name' => '类型',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ //'width' => '80px',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'name',
|
|
|
|
+ 'name' => '名称',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'mobile',
|
|
|
|
+ 'name' => '电话',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'desc',
|
|
|
|
+ 'name' => '详情',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'key' => 'cdate_str',
|
|
|
|
+ 'name' => '时间',
|
|
|
|
+ 'fixed' => 'fixed',
|
|
|
|
+ ],
|
|
|
|
+ ],
|
|
|
|
+ 'button' => [],
|
|
|
|
+ 'body' => Dever::load('role/log', 'place_order')->getList($this->info['id'])
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+}
|