View.php 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. <?php namespace Place_order\Manage\Lib\Source;
  2. use Dever;
  3. class View
  4. {
  5. private $info;
  6. private $user;
  7. # 后台详情页
  8. public function get($info)
  9. {
  10. $info['detail'] = Dever::db('source_detail', 'place_order')->select(['order_id' => $info['id']]);
  11. $this->info = Dever::load('source/order', 'place_order')->getView($info);
  12. $this->info['source_type'] = [];
  13. $tab = $this->getTab();
  14. return ['title' => '订单详情', 'info' => $this->getInfo(), 'tab' => $tab];
  15. }
  16. # 获取基本信息
  17. private function getInfo()
  18. {
  19. if ($this->info['refund_status'] == 1) {
  20. $this->info['status_name'] .= '<span style="color:red">[退]</span>';
  21. }
  22. $info[] = [
  23. # 类型,info介绍 desc描述 table表格,表格有head和body即可
  24. 'type' => 'info',
  25. 'name' => '资源订单',
  26. 'info' => '订单号:' . $this->info['order_num'],
  27. # 右侧按钮
  28. 'button' => $this->getButton(),
  29. # 具体内容
  30. 'content' => [
  31. ['name' => '订单状态', 'content' => $this->info['status_name']],
  32. ['name' => '总金额', 'content' => $this->info['cash_text']],
  33. ['name' => '总数量', 'content' => $this->info['num']],
  34. ['name' => '下单时间', 'content' => $this->info['cdate_str']],
  35. ],
  36. ];
  37. return $info;
  38. }
  39. # 获取切换列表
  40. private function getTab()
  41. {
  42. $tab['active'] = 'view';
  43. $tab['content']['view'] = $this->getView();
  44. //$tab['content']['process'] = $this->getProcess();
  45. $tab['content']['list'] = $this->getList();
  46. if ($this->info['refund_list']) {
  47. if ($this->info['refund_status'] == 1) {
  48. $tab['active'] = 'refund';
  49. }
  50. $tab['content']['refund'] = $this->getRefund();
  51. }
  52. # 返利信息
  53. $rebate = Dever::db('rebate', 'place_order')->select(['table' => 'source', 'table_id' => $this->info['id']]);
  54. if ($rebate) {
  55. $tab['content']['rebate'] = $this->getRebate($rebate);
  56. }
  57. $tab['content']['log'] = $this->getLog();
  58. return $tab;
  59. }
  60. # 获取详情
  61. private function getView()
  62. {
  63. $content = [];
  64. $sales = Dever::load('manage/info', 'place_channel_sales')->getInfo($this->info['sales_type'], $this->info['sales_id']);
  65. $method = Dever::db('source', 'place_order')->value('method', $this->info['method']);
  66. $content[] = [
  67. 'type' => 'list',
  68. 'name' => '用户信息',
  69. 'content' => [
  70. [
  71. 'name' => '用户名称',
  72. 'content' => $this->info['user']['name'],
  73. ],
  74. [
  75. 'name' => '用户账户',
  76. 'content' => $this->info['user']['mobile'],
  77. ],
  78. [
  79. 'name' => '渠道信息',
  80. 'content' => $sales,
  81. ],
  82. [
  83. 'name' => '发货方式',
  84. 'content' => $method,
  85. ],
  86. ],
  87. ];
  88. if (isset($this->info['address']) && $this->info['address']) {
  89. $content[] = [
  90. 'type' => 'list',
  91. 'name' => '收货信息',
  92. 'copy' => true,
  93. 'content' => [
  94. [
  95. 'name' => '收货人',
  96. 'content' => $this->info['address']['name'],
  97. ],
  98. [
  99. 'name' => '收货电话',
  100. 'content' => $this->info['address']['phone'],
  101. ],
  102. [
  103. 'name' => '城市地区',
  104. 'content' => $this->info['address']['area_string'],
  105. ],
  106. [
  107. 'name' => '收货地址',
  108. 'content' => $this->info['address']['address'],
  109. ],
  110. ],
  111. 'button' => array
  112. (
  113. array
  114. (
  115. 'name' => '编辑',
  116. 'type' => 'fastadd',
  117. 'path' => 'source_manage/help',
  118. ),
  119. ),
  120. ];
  121. }
  122. $coupon_tip = '';
  123. if ($this->info['user_coupon_id'] > 0) {
  124. $user_coupon = Dever::db('coupon', 'place_user')->find($this->info['user_coupon_id']);
  125. $coupon = Dever::db('coupon', 'place_benefit')->find($this->info['coupon_id']);
  126. $coupon_tip = $coupon['name'];
  127. /*
  128. if ($user_coupon['coupon_code_id'] > 0) {
  129. $code = Dever::db('coupon_code', 'place_benefit')->find($user_coupon['coupon_code_id']);
  130. $coupon_tip .= '['.$code['code'].']';
  131. }*/
  132. if ($coupon['type'] == 3) {
  133. $user_coupon['value'] = floor($user_coupon['value']) . '折';
  134. $coupon_tip .= ',折扣:' . $user_coupon['value'] . ',抵扣:' . $this->info['coupon_cash_text'];
  135. } elseif ($coupon['type'] == 4) {
  136. $user_coupon['value'] = floor($user_coupon['value']) . '个';
  137. $this->info['coupon_value'] = floor($this->info['coupon_value']) . '个';
  138. $coupon_tip .= ',总数:' . $user_coupon['value'] . ',本次使用:'.$this->info['coupon_value'].',抵扣:' . $this->info['coupon_cash_text'];
  139. } else {
  140. $user_coupon['value'] = Dever::load('info', 'place_score')->toScore($user_coupon['value'], $this->info['score']['exp']);
  141. $user_coupon['value'] = Dever::load('info', 'place_score')->getText($user_coupon['value'], $this->info['score']);
  142. $coupon_tip .= ',总面值:' . $user_coupon['value'] . ',本次使用:' . $this->info['coupon_cash_text'];
  143. }
  144. }
  145. $gift_tip = '';
  146. if ($this->info['user_gift_id'] > 0) {
  147. $user_gift = Dever::db('gift', 'place_user')->find($this->info['user_gift_id']);
  148. $gift = Dever::db('gift', 'place_benefit')->find($this->info['gift_id']);
  149. $gift_tip = $gift['name'];
  150. /*
  151. if ($user_coupon['coupon_code_id'] > 0) {
  152. $code = Dever::db('coupon_code', 'place_benefit')->find($user_coupon['coupon_code_id']);
  153. $coupon_tip .= '['.$code['code'].']';
  154. }*/
  155. $user_gift['value'] = Dever::load('info', 'place_score')->toScore($user_gift['value'], $this->info['score']['exp']);
  156. $user_gift['value'] = Dever::load('info', 'place_score')->getText($user_gift['value'], $this->info['score']);
  157. $gift_tip .= ',总面值:' . $user_gift['value'] . ',本次使用:' . $this->info['gift_cash_text'];
  158. }
  159. $refund_tip = '';
  160. if ($this->info['refund_cash'] > 0) {
  161. $cash = Dever::load('source/refund', 'place_order')->getCash($this->info, $this->info['refund_cash'], 0);
  162. $pay_cash_money = Dever::load('info', 'place_score')->toMoney($cash['pay_cash'], $this->info['score']['exp']) . $this->info['money']['unit'];
  163. list($cash['pay_cash'], $cash['wallet_cash'], $cash['coupon_cash'], $cash['gift_cash']) = Dever::load('info', 'place_score')->getText([$cash['pay_cash'], $cash['wallet_cash'], $cash['coupon_cash'], $cash['gift_cash']], $this->info['score']);
  164. $refund_tip .= '支付退款:'.$cash['pay_cash'] . '['.$pay_cash_money.']';
  165. $refund_tip .= ',' . $this->info['score']['name'] . '退款:'.$cash['wallet_cash'];
  166. $refund_tip .= ',礼品卡退款:'.$cash['gift_cash'];
  167. $refund_tip .= ',优惠券退款:'.$cash['coupon_cash'];
  168. }
  169. $content[] = [
  170. 'type' => 'list',
  171. 'name' => '金额信息',
  172. 'content' => [
  173. [
  174. 'name' => '总金额',
  175. 'content' => $this->info['cash_text'],
  176. ],
  177. [
  178. 'name' => '优惠券抵扣',
  179. 'content' => $this->info['coupon_cash_text'],
  180. 'tip' => $coupon_tip,
  181. ],
  182. [
  183. 'name' => '礼品卡抵扣',
  184. 'content' => $this->info['gift_cash_text'],
  185. 'tip' => $gift_tip,
  186. ],
  187. [
  188. 'name' => $this->info['score']['name'] . '抵扣',
  189. 'content' => $this->info['wallet_cash_text'],
  190. ],
  191. [
  192. 'name' => '支付金额',
  193. 'content' => $this->info['pay_cash_text'] . '['.$this->info['pay_money_cash_text'].']',
  194. ],
  195. [
  196. 'name' => '退款金额',
  197. 'content' => $this->info['refund_cash_text'],
  198. 'tip' => $refund_tip,
  199. ],
  200. ],
  201. ];
  202. if ($this->info['coupon_cash'] > 0) {
  203. # 优惠券信息
  204. }
  205. $content[] = [
  206. 'type' => 'list',
  207. 'name' => '备注信息',
  208. 'content' => [
  209. [
  210. 'name' => '买家留言',
  211. 'content' => $this->info['buy_info'] ?: '无',
  212. ],
  213. [
  214. 'name' => '订单备注',
  215. 'content' => $this->info['sell_info'] ?: '无',
  216. ],
  217. ],
  218. ];
  219. return [
  220. 'type' => 'mul',
  221. 'name' => '详情',
  222. 'content' => $content
  223. ];
  224. }
  225. # 获取进度
  226. private function getProcess()
  227. {
  228. $timeline = [];
  229. foreach ($this->info['status_list'] as $k => $v) {
  230. $v['name'] = '['.$v['name'].']';
  231. if ($k == 1) {
  232. $v['name'] .= ' 下单人:' . $this->info['user']['name'] . '('.$this->info['user']['mobile'].')' . ' 付款:' . $this->info['cash'] . '元 ';
  233. } elseif ($k == 2) {
  234. if (isset($this->info['address']) && $this->info['address']) {
  235. $v['name'] .= ' 收货地址:' . $this->info['address']['full'];
  236. }
  237. } elseif ($k == 3) {
  238. if (isset($this->info['express'])) {
  239. $v['name'] .= ' 已发货:' . $this->info['express']['name'] . ',' . $this->info['express']['number'];
  240. }
  241. } elseif ($k == 4) {
  242. if (isset($this->info['express']['log'][0])) {
  243. $v['name'] .= ' ' . $this->info['express']['log'][0]['status'];
  244. }
  245. } elseif ($k == 5 && $this->info['status'] > 6) {
  246. $v['name'] .= ' 订单'.$this->info['status_name'].'';
  247. }
  248. if ($v['selected']) {
  249. $v['hollow'] = true;
  250. $v['color'] = '#0bbd87';
  251. $v['type'] = 'primary';
  252. $v['size'] = 'large';
  253. }
  254. $timeline[] = $v;
  255. }
  256. $content[] = [
  257. 'name' => '',
  258. 'type' => 'timeline',
  259. 'content' => $timeline,
  260. ];
  261. return [
  262. 'type' => 'mul',
  263. 'name' => '进度',
  264. 'content' => [
  265. [
  266. 'type' => 'desc',
  267. 'name' => '',
  268. 'column' => 1,
  269. 'border' => false,
  270. # 排列方向:horizontal横向 vertical纵向
  271. 'direction' => 'vertical',
  272. 'content' => $content,
  273. ],
  274. ]
  275. ];
  276. }
  277. # 获取清单
  278. private function getList()
  279. {
  280. if ($this->info['detail']) {
  281. foreach ($this->info['detail'] as &$v) {
  282. $v['status'] = $this->getListStatus($v);
  283. $v['cash'] = $this->getListCash($v);
  284. $v['id'] = Dever::load('info', 'place_source')->getCode($v['id']);
  285. $this->info['source_type'][$v['source_type']] = $v['source_type'];
  286. }
  287. }
  288. return [
  289. 'name' => '清单',
  290. 'type' => 'table',
  291. 'border' => true,
  292. # 这里配置和列表list一模一样
  293. 'head' => [
  294. [
  295. 'key' => 'id',
  296. 'name' => '编号',
  297. ],
  298. [
  299. 'key' => 'name',
  300. 'name' => '名称',
  301. ],
  302. [
  303. 'key' => 'sku_name',
  304. 'name' => '规格',
  305. ],
  306. [
  307. 'key' => 'cash',
  308. 'name' => '单价',
  309. 'type' => 'popover',
  310. 'location' => 'right',
  311. //'tag' => true,
  312. ],
  313. [
  314. 'key' => 'num',
  315. 'name' => '数量',
  316. ],
  317. [
  318. 'key' => 'status',
  319. 'name' => '状态',
  320. 'type' => 'popover',
  321. 'location' => 'right',
  322. 'tag' => true,
  323. //'fixed' => 'fixed',
  324. ],
  325. ],
  326. 'button' => [],
  327. 'body' => $this->info['detail'],
  328. ];
  329. }
  330. private function getListStatus($detail)
  331. {
  332. if (isset($detail['delivery']) && $info = $detail['delivery']) {
  333. $data['content'] = [];
  334. $data['content']['type'] = 'line';
  335. $data['content']['content'] = [];
  336. if ($detail['source_type'] == 1) {
  337. $data['content']['content'][] = ['name' => '快递公司', 'content' => $info['name']];
  338. $data['content']['content'][] = ['name' => '快递单号', 'content' => $info['content']];
  339. } else {
  340. $data['content']['content'][] = ['name' => '发货类型', 'content' => $info['name']];
  341. $data['content']['content'][] = ['name' => '发货内容', 'content' => $info['content']];
  342. }
  343. $data['content']['content'][] = ['name' => '发货时间', 'content' => date('Y-m-d H:i:s', $detail['ddate'])];
  344. if ($detail['qdate']) {
  345. $data['content']['content'][] = ['name' => '签收时间', 'content' => date('Y-m-d H:i:s', $detail['qdate'])];
  346. }
  347. if (isset($info['log']) && $info['log']) {
  348. $info['log'] = $this->html($info['log']);
  349. $data['content']['content'][] = ['name' => '快递信息', 'content' => '点此查看', 'alert' => $info['log']];
  350. }
  351. } else {
  352. $data['content'] = [];
  353. $data['content']['type'] = 'text';
  354. $data['content']['content'] = '无';
  355. }
  356. $data['name'] = Dever::db('source_detail', 'place_order')->value('status', $detail['status']);
  357. $result = [0 => $data];
  358. return $result;
  359. }
  360. // 时间线 HTML
  361. public function html($log) {
  362. $html = '<div class="timeline" style="border-left:3px solid #3498db; margin:20px; padding-left:20px;">';
  363. foreach($log as $index => $item) {
  364. // 最新状态高亮
  365. $bgColor = $index === 0 ? '#dff0d8' : '#f0f8ff';
  366. $html .= '<div class="timeline-item" style="position: relative; margin-bottom: 20px;">';
  367. $html .= '<div class="timeline-time" style="font-size:12px; color:#888;">' . htmlspecialchars($item['time']) . '</div>';
  368. $html .= '<div class="timeline-content" style="padding:8px 12px; background:' . $bgColor . '; border-radius:5px; margin-top:5px;">';
  369. $html .= htmlspecialchars($item['status']);
  370. $html .= '</div>';
  371. $html .= '</div>';
  372. }
  373. $html .= '</div>';
  374. return $html;
  375. }
  376. private function getListCash($detail)
  377. {
  378. $data['name'] = Dever::load('info', 'place_score')->getText($detail['cash'], $this->info['score']);
  379. $promotion = Dever::db('promotion', 'place_order')->select(['table' => 'source_detail', 'table_id' => $detail['id']]);
  380. if ($promotion) {
  381. $data['content'] = [];
  382. $data['content']['type'] = 'line';
  383. $data['content']['content'] = [];
  384. foreach ($promotion as $k => $v) {
  385. if ($k == 0) {
  386. $v['m_price'] = Dever::load('info', 'place_score')->getText($v['m_price'], $this->info['score']);
  387. $data['content']['content'][] = ['name' => '原价', 'content' => $v['m_price']];
  388. }
  389. $v['price'] = Dever::load('info', 'place_score')->getText($v['price'], $this->info['score']);
  390. $v['price'] = $v['price'] . '('.$v['value'].'折)';
  391. $data['content']['content'][] = ['name' => $v['name'], 'content' => $v['price']];
  392. }
  393. # 金额信息
  394. list($detail['total_cash'], $detail['pay_cash'], $detail['wallet_cash'], $detail['coupon_cash'], $detail['gift_cash'], $detail['refund_cash']) = Dever::load('info', 'place_score')->getText([$detail['total_cash'], $detail['pay_cash'], $detail['wallet_cash'], $detail['coupon_cash'], $detail['gift_cash'], $detail['refund_cash']], $this->info['score']);
  395. if (empty($detail['refund_num'])) {
  396. $detail['refund_num'] = 0;
  397. }
  398. $data['content']['content'][] = ['name' => '总金额', 'content' => $detail['total_cash']];
  399. $data['content']['content'][] = ['name' => '优惠券抵扣', 'content' => $detail['coupon_cash']];
  400. $data['content']['content'][] = ['name' => '礼品卡抵扣', 'content' => $detail['gift_cash']];
  401. $data['content']['content'][] = ['name' => $this->info['score']['name'] . '抵扣', 'content' => $detail['wallet_cash']];
  402. $data['content']['content'][] = ['name' => '支付金额', 'content' => $detail['pay_cash']];
  403. $data['content']['content'][] = ['name' => '退款金额', 'content' => $detail['refund_cash']];
  404. $data['content']['content'][] = ['name' => '退款数量', 'content' => $detail['refund_num'] . '个'];
  405. # 返利信息
  406. $rebate = Dever::db('rebate', 'place_order')->select(['table' => 'source_detail', 'table_id' => $detail['id']]);
  407. if ($rebate) {
  408. foreach ($rebate as $v) {
  409. if ($v['level'] == 0) {
  410. $data['content']['content'][] = ['name' => '购买返利', 'content' => $v['value_text']];
  411. } else {
  412. $data['content']['content'][] = ['name' => '返利' . $v['level'] . '层', 'content' => $v['value_text']];
  413. }
  414. }
  415. }
  416. }
  417. $result = [0 => $data];
  418. return $result;
  419. }
  420. # 获取退款信息
  421. private function getRefund()
  422. {
  423. foreach ($this->info['refund_list'] as &$v) {
  424. $v['status'] = $this->getRefundStatus($v);
  425. }
  426. return [
  427. 'name' => '退款',
  428. 'type' => 'table',
  429. 'border' => true,
  430. #'height' => '200',
  431. 'head' => [
  432. [
  433. 'key' => 'utype',
  434. 'name' => '申请人品牌',
  435. 'fixed' => 'fixed',
  436. //'width' => '80px',
  437. ],
  438. [
  439. 'key' => 'name',
  440. 'name' => '申请人名称',
  441. 'fixed' => 'fixed',
  442. ],
  443. [
  444. 'key' => 'mobile',
  445. 'name' => '申请人电话',
  446. 'fixed' => 'fixed',
  447. ],
  448. [
  449. 'key' => 'type_name',
  450. 'name' => '退款类型',
  451. 'fixed' => 'fixed',
  452. ],
  453. [
  454. 'key' => 'cash_text',
  455. 'name' => '退款金额',
  456. 'fixed' => 'fixed',
  457. ],
  458. [
  459. 'key' => 'status',
  460. 'name' => '退款状态',
  461. 'fixed' => 'fixed',
  462. 'type' => 'popover',
  463. 'location' => 'right',
  464. 'tag' => true,
  465. ],
  466. [
  467. 'key' => 'cdate_str',
  468. 'name' => '申请时间',
  469. 'fixed' => 'fixed',
  470. ],
  471. ],
  472. 'button' => [],
  473. 'body' => $this->info['refund_list'],
  474. ];
  475. }
  476. private function getRefundStatus($refund)
  477. {
  478. $data['name'] = $refund['status_name'];
  479. $data['content'] = [];
  480. $data['content']['type'] = 'line';
  481. $data['content']['content'] = [];
  482. $data['content']['content'][] = ['name' => '退款方式', 'content' => $refund['method_name']];
  483. $data['content']['content'][] = ['name' => '申请原因', 'content' => $refund['desc_type_name']];
  484. $data['content']['content'][] = ['name' => '申请说明', 'content' => $refund['desc']];
  485. # 获取退款明细
  486. if ($refund['detail_str']) {
  487. $data['content']['content'][] = ['name' => '退款明细', 'content' => $refund['detail_str']];
  488. }
  489. if ($refund['status'] == 5) {
  490. $data['content']['content'][] = ['name' => '申请驳回', 'content' => $refund['audit_desc']];
  491. } elseif ($refund['status'] >= 2) {
  492. $data['content']['content'][] = ['name' => '申请审核', 'content' => $refund['audit_desc']];
  493. }
  494. # 退货退款
  495. if ($refund['type'] == 1 && $refund['status'] >= 3) {
  496. $refund = Dever::load('source/delivery', 'place_order')->getRefundInfo($refund);
  497. if (isset($refund['delivery']['name']) && $refund['delivery']['name']) {
  498. $data['content']['content'][] = ['name' => '发货类型', 'content' => $refund['delivery']['name']];
  499. $data['content']['content'][] = ['name' => '发货内容', 'content' => $refund['delivery']['content']];
  500. }
  501. if (isset($refund['delivery']['log']) && $refund['delivery']['log']) {
  502. $data['content']['content'][] = ['name' => '快递信息', 'content' => $refund['delivery']['log']];
  503. }
  504. }
  505. if ($refund['status'] == 6) {
  506. $data['content']['content'][] = ['name' => '退货驳回', 'content' => $refund['delivery_audit_desc']];
  507. }
  508. $result = [0 => $data];
  509. return $result;
  510. }
  511. # 获取返利信息
  512. private function getRebate($rebate)
  513. {
  514. foreach ($rebate as &$v) {
  515. //$v['status'] = $this->getRefundStatus($v);
  516. $score = Dever::load('info', 'place_score')->get($v['score_id']);
  517. $v['score_name'] = $score['name'];
  518. $v['username'] = '无';
  519. if ($v['level'] == 0) {
  520. $user = Dever::db('info', 'place_user')->find($this->info['uid']);
  521. $v['username'] = $user['name'];
  522. } else {
  523. $parent = Dever::load('relation', 'invite')->getParent($this->info['uid'], $v['level']);
  524. if ($parent) {
  525. $user = Dever::db('info', 'place_user')->find($parent['uid']);
  526. if ($user) {
  527. $v['username'] = $user['name'];
  528. }
  529. }
  530. }
  531. $v['status_name'] = '未入账';
  532. if ($this->info['status'] == 5 || $this->info['status'] == 6) {
  533. $v['status_name'] = '已入账';
  534. }
  535. }
  536. return [
  537. 'name' => '返利',
  538. 'type' => 'table',
  539. 'border' => true,
  540. #'height' => '200',
  541. 'head' => [
  542. [
  543. 'key' => 'name',
  544. 'name' => '名称',
  545. 'fixed' => 'fixed',
  546. ],
  547. [
  548. 'key' => 'score_name',
  549. 'name' => '奖励积分',
  550. 'fixed' => 'fixed',
  551. ],
  552. [
  553. 'key' => 'level',
  554. 'name' => '奖励层级',
  555. 'fixed' => 'fixed',
  556. ],
  557. [
  558. 'key' => 'value_text',
  559. 'name' => '奖励金额',
  560. 'fixed' => 'fixed',
  561. ],
  562. [
  563. 'key' => 'username',
  564. 'name' => '奖励领取人',
  565. 'fixed' => 'fixed',
  566. ],
  567. [
  568. 'key' => 'status_name',
  569. 'name' => '入账状态',
  570. 'fixed' => 'fixed',
  571. ],
  572. ],
  573. 'button' => [],
  574. 'body' => $rebate,
  575. ];
  576. }
  577. # 获取操作日志
  578. private function getLog()
  579. {
  580. return [
  581. 'name' => '记录',
  582. 'type' => 'table',
  583. 'border' => true,
  584. #'height' => '200',
  585. 'head' => [
  586. [
  587. 'key' => 'utype',
  588. 'name' => '品牌',
  589. 'fixed' => 'fixed',
  590. //'width' => '80px',
  591. ],
  592. [
  593. 'key' => 'name',
  594. 'name' => '名称',
  595. 'fixed' => 'fixed',
  596. ],
  597. [
  598. 'key' => 'mobile',
  599. 'name' => '电话',
  600. 'fixed' => 'fixed',
  601. ],
  602. [
  603. 'key' => 'desc',
  604. 'name' => '详情',
  605. 'fixed' => 'fixed',
  606. ],
  607. [
  608. 'key' => 'cdate_str',
  609. 'name' => '时间',
  610. 'fixed' => 'fixed',
  611. ],
  612. ],
  613. 'button' => [],
  614. 'body' => Dever::load('source/log', 'place_order')->getList($this->info['id'])
  615. ];
  616. }
  617. # 操作按钮
  618. private function getButton()
  619. {
  620. $button = [];
  621. if ($this->info['status'] == 2) {
  622. # 实物可以修改收货信息
  623. $this->info['source_type'][1] = true;
  624. if (isset($this->info['source_type'][1]) && $this->info['address_id']) {
  625. $button[] = [
  626. 'name' => '修改收货信息',
  627. 'type' => 'fastedit',
  628. 'path' => 'sector_place_order/source_address',
  629. 'row' => [
  630. 'id' => $this->info['id'],
  631. ],
  632. ];
  633. /*
  634. $button[] = [
  635. 'name' => '快递发货',
  636. # fastedit、fastadd、oper、api、link、route
  637. 'type' => 'fastadd',
  638. 'path' => 'sector_place_order/source_express',
  639. 'row' => [
  640. 'id' => $this->info['id'],
  641. ],
  642. 'param' => [
  643. 'order_id' => $this->info['id'],
  644. ],
  645. ];*/
  646. }
  647. if ($this->info['method'] <= 2) {
  648. $name = '平台发货';
  649. if ($this->info['method'] == 2) {
  650. $name = '店铺发货';
  651. }
  652. if ($this->info['refund_status'] == 2 && (isset($this->info['source_type'][1]) || isset($this->info['source_type'][2]))) {
  653. $button[] = [
  654. 'name' => $name,
  655. 'type' => 'fastadd',
  656. 'path' => 'sector_place_order/source_delivery',
  657. # row必填,这里的按钮来自于列表页,需要依赖哪一行。这里就写id就行,后续优化这里吧
  658. 'row' => [],
  659. 'param' => [
  660. 'order_id' => $this->info['id'],
  661. ],
  662. # 弹窗宽度
  663. 'width' => '60%',
  664. ];
  665. }
  666. }
  667. } elseif ($this->info['status'] == 3 && isset($this->info['delivery_edit']) && $this->info['delivery_edit']) {
  668. # 已发货,修改发货信息
  669. $button[] = [
  670. 'name' => '修改发货信息',
  671. 'type' => 'fastadd',
  672. 'path' => 'sector_place_order/source_delivery',
  673. # row必填,这里的按钮来自于列表页,需要依赖哪一行。这里就写id就行,后续优化这里吧
  674. 'row' => [],
  675. 'param' => [
  676. 'order_id' => $this->info['id'],
  677. ],
  678. # 弹窗宽度
  679. 'width' => '60%',
  680. ];
  681. } elseif ($this->info['status'] == 3 || $this->info['status'] == 4) {
  682. if (isset($this->info['delivery_show']) && $this->info['delivery_show']) {
  683. $button[] = [
  684. 'name' => '查看发货信息',
  685. 'type' => 'fastadd',
  686. 'path' => 'sector_place_order/source_delivery',
  687. # row必填,这里的按钮来自于列表页,需要依赖哪一行。这里就写id就行,后续优化这里吧
  688. 'row' => [],
  689. 'param' => [
  690. 'order_id' => $this->info['id'],
  691. ],
  692. # 弹窗宽度
  693. 'width' => '60%',
  694. ];
  695. }
  696. /*
  697. $button[] = [
  698. 'name' => '确认收货',
  699. 'type' => 'api',
  700. 'path' => 'sector_place_order/source_delivery',
  701. # row必填,这里的按钮来自于列表页,需要依赖哪一行。这里就写id就行,后续优化这里吧
  702. 'row' => [],
  703. 'param' => [
  704. 'order_id' => $this->info['id'],
  705. ],
  706. # 弹窗宽度
  707. 'width' => '60%',
  708. ];*/
  709. }
  710. # 退款按钮
  711. if (!$this->info['refund'] && $this->info['status'] >= 2 && $this->info['status'] < 7) {
  712. $button[] = [
  713. 'name' => '退款申请',
  714. 'type' => 'fastadd',
  715. 'path' => 'sector_place_order/source_refund',
  716. 'row' => [],
  717. 'param' => [
  718. 'order_id' => $this->info['id'],
  719. ],
  720. # 弹窗宽度
  721. 'width' => '60%',
  722. ];
  723. }
  724. if ($this->info['refund'] && $this->info['refund']['status'] == 1) {
  725. $button[] = [
  726. 'name' => '退款审核',
  727. 'type' => 'fastedit',
  728. 'path' => 'sector_place_order/source_refund_audit',
  729. 'row' => [
  730. 'id' => $this->info['refund']['id'],
  731. ],
  732. 'param' => [
  733. 'order_id' => $this->info['id'],
  734. ],
  735. ];
  736. }
  737. if ($this->info['refund'] && $this->info['refund']['status'] == 3) {
  738. $button[] = [
  739. 'name' => '退货审核',
  740. 'type' => 'fastedit',
  741. 'path' => 'sector_place_order/source_refund_audit_delivery',
  742. 'row' => [
  743. 'id' => $this->info['refund']['id'],
  744. ],
  745. 'param' => [
  746. 'order_id' => $this->info['id'],
  747. ],
  748. ];
  749. }
  750. return $button;
  751. }
  752. }