Files
sphc/pages/expresswx/expresswx.js
2024-05-06 15:34:15 +08:00

124 lines
2.4 KiB
JavaScript

// pages/expresswx/expresswx.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
current: 1,
verticalCurrent: 1,
expresslist: [],
expressData: '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
expressData:JSON.parse(app.globalData.expressData)
})
console.log(this.data.expressData)
wx.showLoading({
title: '加载中',
})
wx.request({
url: app.globalData.ip + '/wisdommining/api/order/getLogistics',
data: {
logisticsNumber: this.data.expressData.logisticsNum,
},
success: res => {
wx.hideLoading()
if (res.data.code == 1) {
if (res.data.value.length == 0) {
wx.showModal({
title: '提示',
content: '暂无物流信息',
showCancel: false,
success: s => {
wx.navigateBack()
}
})
} else {
var expresslist = res.data.value;
this.setData({
expresslist: expresslist,
})
console.log(this.data.expresslist)
}
} else {
wx.showModal({
title: '数据查询异常',
content: res.data.message,
showCancel: false,
success: s => {
wx.navigateBack()
}
})
}
},
fail: res => {
wx.hideLoading()
wx.showToast({
title: '数据查询失败',
icon: 'none',
})
}
})
},
//复制单号
num: function (e) {
wx.setClipboardData({
data: e.currentTarget.dataset.num,
success(res) {
wx.getClipboardData({
success(res) {
console.log(res.data) // data
}
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
})