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

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