链街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.

276 lines
12 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
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, LinkUrl::API_GL_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. market_lat:"{$order['market_lat']}",
  51. //market_lat:"22.851115",
  52. market_lng:"{$order['market_lng']}",
  53. //market_lng:"108.346041",
  54. user_lat:"{$order['lat']}",
  55. user_lng:"{$order['lng']}",
  56. note: "{$order['note']}",
  57. money: "{$order['money']}",
  58. total_money: "{$order['total_money']}",
  59. services_money: "{$order['services_money']}",
  60. coupon_money: "{$order['coupon_money']}",
  61. delivery_money: "{$order['delivery_money']}",
  62. horseman_name: "{$order['horseman_name']}",
  63. distance: "{$order['delivery_distance']}",
  64. orders: JSON.parse(orders),
  65. show_refund: JSON.parse(show_refund),
  66. refund_2:"退款",
  67. refund_3:"已同意退款",
  68. refund_goods_name:"",
  69. global_order_id:"{$order['global_order_id']}",
  70. user_id:"{$order['user_id']}",
  71. order_goods_id:null,
  72. order_child_id:null,
  73. show_refund_2:true,
  74. show_refund_3:false,
  75. path:"{$path}",
  76. show_map:false,
  77. close_map:true,
  78. is_show:true,
  79. map:""
  80. },
  81. methods: {
  82. refundNote(name,order_goods_id,order_child_id) {
  83. this.dialogFormVisible = true;
  84. this.order_goods_id=order_goods_id;
  85. this.order_child_id=order_child_id;
  86. this.refund_goods_name ="退款备注商品 ["+name+"]" ;
  87. },
  88. refundConfirm() {
  89. if (this.total_refund_note==''){
  90. this.\$message({message: '请备注退款原因!',type: 'warning'})
  91. return false;
  92. }
  93. this.\$confirm('是否同意该商品退款?', '提示', {
  94. confirmButtonText: '同意',
  95. cancelButtonText: '取消',
  96. type: 'warning'
  97. }).then(() => {
  98. that = this;
  99. $.ajax({
  100. url: "order_goods_refund",
  101. type: "get",
  102. contentType: "text/html; charset=utf-8",
  103. dataType: "json",
  104. data: {
  105. user_id:that.user_id,
  106. note:that.total_refund_note,
  107. global_order_id:that.global_order_id,
  108. order_child_id:that.order_child_id,
  109. order_goods_id:that.order_goods_id
  110. },
  111. success: function (res) {
  112. if (res.code==0){
  113. that.\$message({
  114. message: '退款成功',
  115. type: 'success'
  116. })
  117. that.show_refund[that.order_goods_id].show_refund_2=false
  118. that.show_refund[that.order_goods_id].show_refund_3=true
  119. }else {
  120. that.\$message.error('退款失败');
  121. }
  122. that.dialogFormVisible = false;
  123. },
  124. error: function (xhr, err) {
  125. console.log("错误", err)
  126. }
  127. });
  128. }).catch(() => {
  129. });
  130. },
  131. showMap() {
  132. this.is_show=true;
  133. if (!this.show_map){
  134. this.show_map = true;
  135. this.close_map =false;
  136. this.initMap()
  137. }
  138. },
  139. closeMap() {
  140. this.is_show=false;
  141. this.show_map = false;
  142. this.close_map =true;
  143. },
  144. change2D() {
  145. this.map.setViewMode('2D');
  146. },
  147. change3D() {
  148. this.map.setViewMode('3D');
  149. this.map.setPitch(70);
  150. },
  151. initMap() {
  152. var center = new TMap.LatLng(this.market_lat, this.market_lng);
  153. //初始化地图
  154. this.map = new TMap.Map("container", {rotation: 20,//设置地图旋转角度
  155. pitch:30, //设置俯仰角度(0~45)
  156. zoom:12,//设置地图缩放级别
  157. center: center//设置地图中心点坐标
  158. });
  159. that = this;
  160. $.ajax({
  161. url: "map_route",
  162. type: "get",
  163. contentType: "text/html; charset=utf-8",
  164. dataType: "json",
  165. data: {
  166. m_lat:that.market_lat,
  167. m_lng:that.market_lng,
  168. u_lat:that.user_lat,
  169. u_lng:that.user_lng,
  170. type:"bicycling"
  171. },
  172. success: function (res) {
  173. console.log(res)
  174. if (res.status==0){
  175. that.cb(res);
  176. }
  177. },
  178. error: function (xhr, err) {
  179. console.log("错误", err)
  180. }
  181. });
  182. },
  183. //定义请求回调函数,在此拿到计算得到的路线,并进行绘制
  184. cb(ret) {
  185. var coords = ret.result.routes[0].polyline, pl = [];
  186. //坐标解压(返回的点串坐标,通过前向差分进行压缩)
  187. var kr = 1000000;
  188. for (var i = 2; i < coords.length; i++) {
  189. coords[i] = Number(coords[i - 2]) + Number(coords[i]) / kr;
  190. }
  191. //将解压后的坐标放入点串数组pl中
  192. for (var i = 0; i < coords.length; i += 2) {
  193. pl.push(new TMap.LatLng(coords[i], coords[i+1]));
  194. }
  195. this.display_polyline(pl)//显示路线
  196. //标记起终点marker
  197. var marker = new TMap.MultiMarker({
  198. id: 'marker-layer',
  199. map: this.map,
  200. styles: {
  201. "start": new TMap.MarkerStyle({
  202. "width": 25,
  203. "height": 35,
  204. "anchor": { x: 16, y: 32 },
  205. "src": 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/start.png'
  206. }),
  207. "end": new TMap.MarkerStyle({
  208. "width": 25,
  209. "height": 35,
  210. "anchor": { x: 16, y: 32 },
  211. "src": 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/end.png'
  212. })
  213. },
  214. geometries: [{
  215. "id": 'start',
  216. "styleId": 'start',
  217. "position": new TMap.LatLng(that.market_lat,that.market_lng)
  218. }, {
  219. "id": 'end',
  220. "styleId": 'end',
  221. "position": new TMap.LatLng(that.user_lat,that.user_lng)
  222. }]
  223. });
  224. },
  225. display_polyline(pl){
  226. //创建 MultiPolyline显示折线
  227. var polylineLayer = new TMap.MultiPolyline({
  228. id: 'polyline-layer', //图层唯一标识
  229. map: this.map,//绘制到目标地图
  230. //折线样式定义
  231. styles: {
  232. 'style_blue': new TMap.PolylineStyle({
  233. 'color': '#3777FF', //线填充色
  234. 'width': 8, //折线宽度
  235. 'borderWidth': 5, //边线宽度
  236. 'borderColor': '#FFF', //边线颜色
  237. 'lineCap': 'round', //线端头方式
  238. })
  239. },
  240. //折线数据定义
  241. geometries: [
  242. {
  243. 'id': 'pl_1',//折线唯一标识,删除时使用
  244. 'styleId': 'style_blue',//绑定样式名
  245. 'paths': pl
  246. }
  247. ]
  248. });
  249. },
  250. mounted: function () {
  251. }
  252. }
  253. });
  254. JS
  255. );
  256. }
  257. return view('orderdetail');
  258. }
  259. }