链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
6.0 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Extensions;
  3. use App\Admin\Common\LinkUrl;
  4. use App\Models\ImsCjdcOrder;
  5. use App\Models\ImsCjdcOrderMain;
  6. use App\Models\LanzuOrderGoods;
  7. use App\Models\LanzuServiceHorseman;
  8. use Dcat\Admin\Admin;
  9. use Dcat\Admin\Support\LazyRenderable;
  10. use Endroid\QrCode\Exceptions\DataDoesntExistsException;
  11. class MyDetailPage extends LazyRenderable
  12. {
  13. protected static $js = [LinkUrl::VUE_JS, LinkUrl::ELEMENT_UI_JS];
  14. protected static $css = [LinkUrl::DETAIL_CSS, LinkUrl::ELEMENT_UI_CSS];
  15. public function render()
  16. {
  17. //>>1.主订单数据
  18. $order = ImsCjdcOrderMain::getOrderData($this->order_id);
  19. if ($order) {
  20. $search = array(" "," ","\n","\r","\t");
  21. $replace = array("","","","","");
  22. $order['address'] = str_replace($search, $replace, $order['address']);
  23. //>>2.获取子订单
  24. $result = ImsCjdcOrder::getOrdersData($order['global_order_id'],$order['id']);
  25. $orders = json_encode($result['orders']);
  26. $showRefund = json_encode($result['show_refund']);
  27. $path = "order?".$this->last_url;
  28. Admin::script(
  29. <<<JS
  30. var orders = JSON.stringify($orders)
  31. var show_refund = JSON.stringify($showRefund)
  32. var app = new Vue({
  33. el:"#detail",
  34. data:{
  35. dialogFormVisible: false,
  36. market_name: "{$order['market_name']}",
  37. order_num: "{$order['order_num']}",
  38. name: "{$order['name']}",
  39. state: "{$order['state']}",
  40. created_at: "{$order['created_at']}",
  41. updated_at: "{$order['updated_at']}",
  42. pay_type: "{$order['pay_type']}",
  43. shipping_type: "{$order['shipping_type']}",
  44. shipping_type_num: "{$order['shipping_type_num']}",
  45. tel: "{$order['tel']}",
  46. delivery_time_note: "{$order['delivery_time_note']}",
  47. refuse_refund_note: "{$order['refuse_refund_note']}",
  48. total_refund_note: "{$order['total_refund_note']}",
  49. address: "{$order['address']}",
  50. note: "{$order['note']}",
  51. money: "{$order['money']}",
  52. total_money: "{$order['total_money']}",
  53. services_money: "{$order['services_money']}",
  54. coupon_money: "{$order['coupon_money']}",
  55. delivery_money: "{$order['delivery_money']}",
  56. horseman_name: "{$order['horseman_name']}",
  57. distance: "{$order['delivery_distance']}",
  58. orders: JSON.parse(orders),
  59. show_refund: JSON.parse(show_refund),
  60. refund_2:"退款",
  61. refund_3:"已同意退款",
  62. refund_goods_name:"",
  63. global_order_id:"{$order['global_order_id']}",
  64. user_id:"{$order['user_id']}",
  65. order_goods_id:null,
  66. order_child_id:null,
  67. show_refund_2:true,
  68. show_refund_3:false,
  69. path:"{$path}"
  70. },
  71. methods: {
  72. refundNote(name,order_goods_id,order_child_id) {
  73. this.dialogFormVisible = true;
  74. this.order_goods_id=order_goods_id;
  75. this.order_child_id=order_child_id;
  76. this.refund_goods_name ="退款备注商品 ["+name+"]" ;
  77. },
  78. refundConfirm() {
  79. if (this.total_refund_note==''){
  80. this.\$message({message: '请备注退款原因!',type: 'warning'})
  81. return false;
  82. }
  83. this.\$confirm('是否同意该商品退款?', '提示', {
  84. confirmButtonText: '同意',
  85. cancelButtonText: '取消',
  86. type: 'warning'
  87. }).then(() => {
  88. that = this;
  89. $.ajax({
  90. url: "order_goods_refund",
  91. type: "get",
  92. contentType: "text/html; charset=utf-8",
  93. dataType: "json",
  94. data: {
  95. user_id:that.user_id,
  96. note:that.total_refund_note,
  97. global_order_id:that.global_order_id,
  98. order_child_id:that.order_child_id,
  99. order_goods_id:that.order_goods_id
  100. },
  101. success: function (res) {
  102. if (res.code==0){
  103. that.\$message({
  104. message: '退款成功',
  105. type: 'success'
  106. })
  107. that.show_refund[that.order_goods_id].show_refund_2=false
  108. that.show_refund[that.order_goods_id].show_refund_3=true
  109. }else {
  110. that.\$message.error('退款失败');
  111. }
  112. that.dialogFormVisible = false;
  113. },
  114. error: function (xhr, err) {
  115. console.log("错误", err)
  116. }
  117. });
  118. }).catch(() => {
  119. });
  120. }
  121. }
  122. });
  123. JS
  124. );
  125. }
  126. return view('orderdetail');
  127. }
  128. }