yuminge-app/yun-min-program-plugin-master/packageI/supplierDist/components/Entrance/Entrance.js

114 lines
2.7 KiB
JavaScript

// packageG/supplierDist/components/Entrance/Entrance.js
const app = getApp();
Component({
/**
* 组件的属性列表
*/
properties: {
infoData: {
type: null
},
delivery_status: {
type: null
},
point: {
type: null
}
},
lifetimes: {
ready() {
}
},
/**
* 组件的初始数据
*/
data: {
show: false,
confirm_credentials: [],
},
/**
* 组件的方法列表
*/
methods: {
goDetail(e) {
let id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '/packageI/supplierDist/supplierDriver/supplierDriver?id=' + id,
});
},
updateImages(e) {
this.setData({
confirm_credentials: e.detail
});
},
goToAdress(e) {
let info = e.currentTarget.dataset.item;
let latitude = info.latitude;
let longitude = info.longitude;
let name = info.address;
let point = app.BMapTransqqMap(parseFloat(longitude), parseFloat(latitude));
wx.openLocation({
latitude: point.lat,
longitude: point.lng,
scale: 18,
name
});
},
callPhone(e) {
wx.makePhoneCall({
phoneNumber: e.currentTarget.dataset.call,
});
},
showPop(e) {
this.setData({
order_id: e.currentTarget.dataset.id,
show: !this.data.show
});
},
onClose() {
this.setData({
show: false
});
},
confirm() {
let urlStr = app.getNetAddresss('plugin.supplier-driver-distribution.frontend.delivery-order.confirmReceive');
app._postNetWork({
url: urlStr,
data: {
delivery_order_id: this.data.order_id,
confirm_credentials: JSON.stringify(this.data.confirm_credentials),
lng: this.data.point.lng,
lat: this.data.point.lat
},
success: (resdata) => {
let res = resdata.data;
if (res.result == 1) {
this.setData({
show: false
});
if (res.data.next_delivery_address.length != 0) {
let point = app.BMapTransqqMap(parseFloat(res.data.next_delivery_address.longitude), parseFloat(res.data.next_delivery_address.latitude));
wx.openLocation({
latitude: point.lat,
longitude: point.lng,
scale: 18,
name: res.data.next_delivery_address.address
});
}
this.triggerEvent('ListenChild');
} else {
wx.showToast({
title: res.msg,
icon: 'none',
duration: 1000
});
}
},
fail: function (res) {
}
});
}
}
});