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

287 lines
13 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
  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:14,//设置地图缩放级别
  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. if (res.status==0){
  174. that.cb(res);
  175. }
  176. },
  177. error: function (xhr, err) {
  178. console.log("错误", err)
  179. }
  180. });
  181. },
  182. //定义请求回调函数,在此拿到计算得到的路线,并进行绘制
  183. cb(ret) {
  184. var coords = ret.result.routes[0].polyline, pl = [];
  185. //坐标解压(返回的点串坐标,通过前向差分进行压缩)
  186. var kr = 1000000;
  187. for (var i = 2; i < coords.length; i++) {
  188. coords[i] = Number(coords[i - 2]) + Number(coords[i]) / kr;
  189. }
  190. //将解压后的坐标放入点串数组pl中
  191. for (var i = 0; i < coords.length; i += 2) {
  192. pl.push(new TMap.LatLng(coords[i], coords[i+1]));
  193. }
  194. this.display_polyline(pl)//显示路线
  195. //标记起终点marker
  196. var marker = new TMap.MultiMarker({
  197. id: 'marker-layer',
  198. map: this.map,
  199. styles: {
  200. "start": new TMap.MarkerStyle({
  201. "width": 25,
  202. "height": 35,
  203. "anchor": { x: 16, y: 32 },
  204. "src": 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/start.png'
  205. }),
  206. "end": new TMap.MarkerStyle({
  207. "width": 25,
  208. "height": 35,
  209. "anchor": { x: 16, y: 32 },
  210. "src": 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/end.png'
  211. }),
  212. "marker": new TMap.MarkerStyle({
  213. "width": 45,
  214. "height": 52,
  215. "anchor": { x: 16, y: 32 },
  216. "src": "../uploads/map/561.png"
  217. })
  218. },
  219. geometries: [{
  220. "id": 'start',
  221. "styleId": 'start',
  222. "position": new TMap.LatLng(that.market_lat,that.market_lng)
  223. }, {
  224. "id": 'end',
  225. "styleId": 'end',
  226. "position": new TMap.LatLng(that.user_lat,that.user_lng)
  227. },{ //点标注数据数组
  228. "id": "horseman",
  229. "styleId": "marker",
  230. "position": new TMap.LatLng(22.805566,108.412079),
  231. "properties": {
  232. "title": "marker"
  233. }
  234. }]
  235. });
  236. },
  237. display_polyline(pl){
  238. //创建 MultiPolyline显示折线
  239. var polylineLayer = new TMap.MultiPolyline({
  240. id: 'polyline-layer', //图层唯一标识
  241. map: this.map,//绘制到目标地图
  242. //折线样式定义
  243. styles: {
  244. 'style_blue': new TMap.PolylineStyle({
  245. 'color': '#3777FF', //线填充色
  246. 'width': 8, //折线宽度
  247. 'borderWidth': 5, //边线宽度
  248. 'borderColor': '#FFF', //边线颜色
  249. 'lineCap': 'round', //线端头方式
  250. })
  251. },
  252. //折线数据定义
  253. geometries: [
  254. {
  255. 'id': 'pl_1',//折线唯一标识,删除时使用
  256. 'styleId': 'style_blue',//绑定样式名
  257. 'paths': pl
  258. }
  259. ]
  260. });
  261. },
  262. mounted: function () {
  263. }
  264. }
  265. });
  266. JS
  267. );
  268. }
  269. return view('orderdetail');
  270. }
  271. }