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
287 lines
13 KiB
<?php
|
|
|
|
|
|
namespace App\Admin\Extensions;
|
|
|
|
use App\Admin\Common\LinkUrl;
|
|
use App\Models\ImsCjdcOrder;
|
|
use App\Models\ImsCjdcOrderMain;
|
|
use App\Models\LanzuOrderGoods;
|
|
use App\Models\LanzuServiceHorseman;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Support\LazyRenderable;
|
|
use Endroid\QrCode\Exceptions\DataDoesntExistsException;
|
|
|
|
class MyDetailPage extends LazyRenderable
|
|
{
|
|
|
|
protected static $js = [LinkUrl::VUE_JS, LinkUrl::ELEMENT_UI_JS, LinkUrl::API_GL_JS];
|
|
protected static $css = [LinkUrl::DETAIL_CSS, LinkUrl::ELEMENT_UI_CSS];
|
|
|
|
|
|
public function render()
|
|
{
|
|
//>>1.主订单数据
|
|
$order = ImsCjdcOrderMain::getOrderData($this->order_id);
|
|
if ($order) {
|
|
$search = array(" ", " ", "\n", "\r", "\t");
|
|
$replace = array("", "", "", "", "");
|
|
$order['address'] = str_replace($search, $replace, $order['address']);
|
|
//>>2.获取子订单
|
|
$result = ImsCjdcOrder::getOrdersData($order['global_order_id'], $order['id']);
|
|
$orders = json_encode($result['orders']);
|
|
$showRefund = json_encode($result['show_refund']);
|
|
$path = "order?" . $this->last_url;
|
|
Admin::script(
|
|
<<<JS
|
|
var orders = JSON.stringify($orders)
|
|
var show_refund = JSON.stringify($showRefund)
|
|
var app = new Vue({
|
|
el:"#detail",
|
|
data:{
|
|
dialogFormVisible: false,
|
|
market_name: "{$order['market_name']}",
|
|
order_num: "{$order['order_num']}",
|
|
name: "{$order['name']}",
|
|
state: "{$order['state']}",
|
|
created_at: "{$order['created_at']}",
|
|
updated_at: "{$order['updated_at']}",
|
|
pay_type: "{$order['pay_type']}",
|
|
shipping_type: "{$order['shipping_type']}",
|
|
shipping_type_num: "{$order['shipping_type_num']}",
|
|
tel: "{$order['tel']}",
|
|
delivery_time_note: "{$order['delivery_time_note']}",
|
|
refuse_refund_note: "{$order['refuse_refund_note']}",
|
|
total_refund_note: "{$order['total_refund_note']}",
|
|
address: "{$order['address']}",
|
|
market_lat:"{$order['market_lat']}",
|
|
//market_lat:"22.851115",
|
|
market_lng:"{$order['market_lng']}",
|
|
//market_lng:"108.346041",
|
|
user_lat:"{$order['lat']}",
|
|
user_lng:"{$order['lng']}",
|
|
note: "{$order['note']}",
|
|
money: "{$order['money']}",
|
|
total_money: "{$order['total_money']}",
|
|
services_money: "{$order['services_money']}",
|
|
coupon_money: "{$order['coupon_money']}",
|
|
delivery_money: "{$order['delivery_money']}",
|
|
horseman_name: "{$order['horseman_name']}",
|
|
distance: "{$order['delivery_distance']}",
|
|
orders: JSON.parse(orders),
|
|
show_refund: JSON.parse(show_refund),
|
|
refund_2:"退款",
|
|
refund_3:"已同意退款",
|
|
refund_goods_name:"",
|
|
global_order_id:"{$order['global_order_id']}",
|
|
user_id:"{$order['user_id']}",
|
|
order_goods_id:null,
|
|
order_child_id:null,
|
|
show_refund_2:true,
|
|
show_refund_3:false,
|
|
path:"{$path}",
|
|
show_map:false,
|
|
close_map:true,
|
|
is_show:true,
|
|
map:""
|
|
},
|
|
methods: {
|
|
refundNote(name,order_goods_id,order_child_id) {
|
|
this.dialogFormVisible = true;
|
|
this.order_goods_id=order_goods_id;
|
|
this.order_child_id=order_child_id;
|
|
this.refund_goods_name ="退款备注商品 ["+name+"]" ;
|
|
},
|
|
refundConfirm() {
|
|
if (this.total_refund_note==''){
|
|
this.\$message({message: '请备注退款原因!',type: 'warning'})
|
|
return false;
|
|
}
|
|
this.\$confirm('是否同意该商品退款?', '提示', {
|
|
confirmButtonText: '同意',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
that = this;
|
|
$.ajax({
|
|
url: "order_goods_refund",
|
|
type: "get",
|
|
contentType: "text/html; charset=utf-8",
|
|
dataType: "json",
|
|
data: {
|
|
user_id:that.user_id,
|
|
note:that.total_refund_note,
|
|
global_order_id:that.global_order_id,
|
|
order_child_id:that.order_child_id,
|
|
order_goods_id:that.order_goods_id
|
|
},
|
|
success: function (res) {
|
|
if (res.code==0){
|
|
that.\$message({
|
|
message: '退款成功',
|
|
type: 'success'
|
|
})
|
|
that.show_refund[that.order_goods_id].show_refund_2=false
|
|
that.show_refund[that.order_goods_id].show_refund_3=true
|
|
}else {
|
|
that.\$message.error('退款失败');
|
|
}
|
|
that.dialogFormVisible = false;
|
|
},
|
|
error: function (xhr, err) {
|
|
console.log("错误", err)
|
|
}
|
|
});
|
|
}).catch(() => {
|
|
});
|
|
},
|
|
showMap() {
|
|
this.is_show=true;
|
|
if (!this.show_map){
|
|
this.show_map = true;
|
|
this.close_map =false;
|
|
this.initMap()
|
|
}
|
|
},
|
|
closeMap() {
|
|
this.is_show=false;
|
|
this.show_map = false;
|
|
this.close_map =true;
|
|
},
|
|
|
|
change2D() {
|
|
this.map.setViewMode('2D');
|
|
},
|
|
|
|
change3D() {
|
|
this.map.setViewMode('3D');
|
|
this.map.setPitch(70);
|
|
},
|
|
|
|
initMap() {
|
|
var center = new TMap.LatLng(this.market_lat, this.market_lng);
|
|
//初始化地图
|
|
this.map = new TMap.Map("container", {rotation: 20,//设置地图旋转角度
|
|
pitch:30, //设置俯仰角度(0~45)
|
|
zoom:14,//设置地图缩放级别
|
|
center: center//设置地图中心点坐标
|
|
});
|
|
that = this;
|
|
$.ajax({
|
|
url: "map_route",
|
|
type: "get",
|
|
contentType: "text/html; charset=utf-8",
|
|
dataType: "json",
|
|
data: {
|
|
m_lat:that.market_lat,
|
|
m_lng:that.market_lng,
|
|
u_lat:that.user_lat,
|
|
u_lng:that.user_lng,
|
|
type:"bicycling"
|
|
},
|
|
success: function (res) {
|
|
if (res.status==0){
|
|
that.cb(res);
|
|
}
|
|
},
|
|
error: function (xhr, err) {
|
|
console.log("错误", err)
|
|
}
|
|
});
|
|
},
|
|
|
|
|
|
//定义请求回调函数,在此拿到计算得到的路线,并进行绘制
|
|
cb(ret) {
|
|
var coords = ret.result.routes[0].polyline, pl = [];
|
|
//坐标解压(返回的点串坐标,通过前向差分进行压缩)
|
|
var kr = 1000000;
|
|
for (var i = 2; i < coords.length; i++) {
|
|
coords[i] = Number(coords[i - 2]) + Number(coords[i]) / kr;
|
|
}
|
|
//将解压后的坐标放入点串数组pl中
|
|
for (var i = 0; i < coords.length; i += 2) {
|
|
pl.push(new TMap.LatLng(coords[i], coords[i+1]));
|
|
}
|
|
|
|
this.display_polyline(pl)//显示路线
|
|
|
|
//标记起终点marker
|
|
var marker = new TMap.MultiMarker({
|
|
id: 'marker-layer',
|
|
map: this.map,
|
|
styles: {
|
|
"start": new TMap.MarkerStyle({
|
|
"width": 25,
|
|
"height": 35,
|
|
"anchor": { x: 16, y: 32 },
|
|
"src": 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/start.png'
|
|
}),
|
|
"end": new TMap.MarkerStyle({
|
|
"width": 25,
|
|
"height": 35,
|
|
"anchor": { x: 16, y: 32 },
|
|
"src": 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/end.png'
|
|
}),
|
|
"marker": new TMap.MarkerStyle({
|
|
"width": 45,
|
|
"height": 52,
|
|
"anchor": { x: 16, y: 32 },
|
|
"src": "../uploads/map/561.png"
|
|
})
|
|
},
|
|
geometries: [{
|
|
"id": 'start',
|
|
"styleId": 'start',
|
|
"position": new TMap.LatLng(that.market_lat,that.market_lng)
|
|
}, {
|
|
"id": 'end',
|
|
"styleId": 'end',
|
|
"position": new TMap.LatLng(that.user_lat,that.user_lng)
|
|
},{ //点标注数据数组
|
|
"id": "horseman",
|
|
"styleId": "marker",
|
|
"position": new TMap.LatLng(22.805566,108.412079),
|
|
"properties": {
|
|
"title": "marker"
|
|
}
|
|
}]
|
|
});
|
|
},
|
|
|
|
display_polyline(pl){
|
|
//创建 MultiPolyline显示折线
|
|
var polylineLayer = new TMap.MultiPolyline({
|
|
id: 'polyline-layer', //图层唯一标识
|
|
map: this.map,//绘制到目标地图
|
|
//折线样式定义
|
|
styles: {
|
|
'style_blue': new TMap.PolylineStyle({
|
|
'color': '#3777FF', //线填充色
|
|
'width': 8, //折线宽度
|
|
'borderWidth': 5, //边线宽度
|
|
'borderColor': '#FFF', //边线颜色
|
|
'lineCap': 'round', //线端头方式
|
|
})
|
|
},
|
|
//折线数据定义
|
|
geometries: [
|
|
{
|
|
'id': 'pl_1',//折线唯一标识,删除时使用
|
|
'styleId': 'style_blue',//绑定样式名
|
|
'paths': pl
|
|
}
|
|
]
|
|
});
|
|
},
|
|
mounted: function () {
|
|
|
|
}
|
|
}
|
|
});
|
|
JS
|
|
);
|
|
}
|
|
return view('orderdetail');
|
|
}
|
|
}
|