var Base64 = require('../../utils/base64.js').Base64;
var MD5 = require('../../utils/md5.min.js');
var util = require('../../utils/util.js');
var MockData = require('../../utils/mockdata.js');
Page({
data: {
result: {},
focus: false,
historySearch: []
},
onLoad: function () {
wx.showLoading({
title: '加载中',
});
},
onShow: function () {
setTimeout(function () {
wx.hideLoading()
}, 100);
this.showHistory();
},
formSubmit: function (e) {
let eorder = util.trim(e.detail.value.expressorder);
if (!eorder) {
wx.showModal({
title: '提示',
content: '快递单号不能为空!',
showCancel: false,
success: function (res) {
if (res.confirm) {
self.setData({
focus: true
})
}
}
})
return;
}
this.searchExpress(eorder);
},
deleteHistory: function (e) {
var self = this;
try {
let historySearchList = wx.getStorageSync('historySearchList');
let newList = historySearchList.filter(function (val) {
return (val.order != e.currentTarget.dataset.order);
});
wx.setStorage({
key: "historySearchList",
data: newList,
success: function () {
self.showHistory();
}
})
} catch (e) {
console.log(e);
}
},
showHistory: function () {
var self = this;
wx.getStorage({
key: 'historySearchList',
success: function (res) {
self.setData({
historySearch: res.data
});
}
})
},
scanCode: function () {
let self = this;
wx.scanCode({
success: (res) => {
if (res.result) {
self.searchExpress(util.trim(res.result));
} else {
wx.showModal({
title: '提示',
content: '快递单号不能为空!',
showCancel: false,
success: function (res) {
if (res.confirm) {
self.setData({
focus: true
})
}
}
})
}
}
})
},
searchExpress: function (eorder) {
let self = this;
if (MockData.env == "mock") { //mock环境下使用假数据
let res = MockData.getExpressName(eorder);
let resData = res.data;
let LogisticCode = resData.LogisticCode;
let ShipperName = "";
let ShipperCode = "";
if (resData.Shippers.length == 1) {
ShipperName = resData.Shippers[0].ShipperName;
ShipperCode = resData.Shippers[0].ShipperCode;
try {
let historySearchList = wx.getStorageSync('historySearchList');
if (!historySearchList) {
historySearchList = [];
};
let newList = historySearchList.filter(function (val) {
return (val.order != LogisticCode);
});
newList.push({
"order": LogisticCode,
"name": ShipperName,
"code": ShipperCode,
})
wx.setStorage({
key: "historySearchList",
data: newList,
success: function () {
wx.navigateTo({
url: '../detail/detail?LogisticCode=' + LogisticCode + '&ShipperCode=' + ShipperCode + '&ShipperName=' + ShipperName
})
}
})
} catch (e) {
console.log(e);
}
} else {
let list = [];
if (resData.Shippers.length >= 1 && resData.Shippers.length <= 6) {
for (let i = 0; i < resData.Shippers.length; i++) {
list.push(resData.Shippers[i].ShipperName)
}
} else if (resData.Shippers.length > 6) {
for (let i = 0; i < 6; i++) {
list.push(resData.Shippers[i].ShipperName)
}
} else {
wx.showModal({
title: '提示',
content: '暂时没有查到该单号',
success: function (res) {
}
})
}
wx.showActionSheet({
itemList: list,
success: function (res) {
ShipperName = resData.Shippers[res.tapIndex].ShipperName;
ShipperCode = resData.Shippers[res.tapIndex].ShipperCode;
try {
let historySearchList = wx.getStorageSync('historySearchList');
if (!historySearchList) {
historySearchList = [];
};
let newList = historySearchList.filter(function (val) {
return (val.order != LogisticCode);
});
newList.push({
"order": LogisticCode,
"name": ShipperName,
"code": ShipperCode,
})
wx.setStorage({
key: "historySearchList",
data: newList,
success: function () {
wx.navigateTo({
url: '../detail/detail?LogisticCode=' + LogisticCode + '&ShipperCode=' + ShipperCode + '&ShipperName=' + ShipperName
})
}
})
} catch (e) {
console.log(e);
}
},
fail: function (res) {
console.log(res.errMsg)
}
})
}
} else { //正式环境下请求数据
let appKey = "";//更换成你申请的appkey
let requestData = "{\"LogisticCode\":\"" + eorder + "\"}";
let eBusinessID = "";//更换成你申请的商户id
let requestType = "2002";
let dataSign = Base64.encode(MD5(requestData + appKey));
wx.request({
url: 'http://api.kdniao.cc/Ebusiness/EbusinessOrderHandle.aspx',
data: {
RequestData: requestData,
EBusinessID: eBusinessID,
RequestType: requestType,
DataSign: dataSign,
DataType: "2"
},
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
},
success: function (res) {
let resData = res.data;
console.info(resData);
let LogisticCode = resData.LogisticCode;
let ShipperName = "";
let ShipperCode = "";
if (resData.Shippers.length == 1) {
ShipperName = resData.Shippers[0].ShipperName;
ShipperCode = resData.Shippers[0].ShipperCode;
try {
let historySearchList = wx.getStorageSync('historySearchList');
if (!historySearchList) {
historySearchList = [];
};
let newList = historySearchList.filter(function (val) {
return (val.order != LogisticCode);
});
newList.push({
"order": LogisticCode,
"name": ShipperName,
"code": ShipperCode,
})
wx.setStorage({
key: "historySearchList",
data: newList,
success: function () {
wx.navigateTo({
url: '../detail/detail?LogisticCode=' + LogisticCode + '&ShipperCode=' + ShipperCode + '&ShipperName=' + ShipperName
})
}
})
} catch (e) {
console.log(e);
}
} else {
let list = [];
if (resData.Shippers.length >= 1 && resData.Shippers.length <= 6) {
for (let i = 0; i < resData.Shippers.length; i++) {
list.push(resData.Shippers[i].ShipperName)
}
} else if (resData.Shippers.length > 6) {
for (let i = 0; i < 6; i++) {
list.push(resData.Shippers[i].ShipperName)
}
} else {
wx.showModal({
title: '提示',
content: '暂时没有查到该单号',
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序项目案例和Demo-快递查询应用快递喵,个人学习研究,本科毕业设计,课程设计
共29个文件
png:9个
js:8个
wxss:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 89 浏览量
2023-06-19
22:18:20
上传
评论
收藏 78KB ZIP 举报
温馨提示
微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应用【快递喵】,个人学习研究,本科毕业设计,课程设计 微信小程序项目案例和Demo--快递查询应
资源推荐
资源详情
资源评论
收起资源包目录
ExpressCat-master.zip (29个子文件)
ExpressCat-master
app
pages
detail
detail.json 2B
detail.js 4KB
detail.wxml 1KB
detail.wxss 2KB
personal
personal.wxss 2KB
personal.wxml 1002B
personal.json 2B
personal.js 2KB
index
index.wxml 1KB
index.js 10KB
index.json 2B
index.wxss 2KB
app.json 847B
app.js 719B
utils
mockdata.js 3KB
md5.min.js 4KB
base64.js 7KB
util.js 2KB
app.wxss 194B
images
express.png 4KB
manager_select.png 4KB
manager.png 4KB
express_icon_grey.png 6KB
express_icon.png 7KB
scanning.png 4KB
delete.png 3KB
express_select.png 4KB
logocat.png 6KB
assest
gh_e9e6a84e8c88_258.jpg 30KB
共 29 条
- 1
资源评论
白话机器学习
- 粉丝: 8190
- 资源: 7687
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 3122080306 邹子轩 实验报告二.docx
- 基于STM32 NUCLEO板设计彩色LED照明灯(纯cubeMX开发)(大赛作品,文档完整,可直接运行)
- 发那科工业机器人保养大全
- Sphere.h
- REMD固有时间尺度分解信号分量可视化(Matlab完整源码和数据)
- 嵌入式系统双单片机STC89C52+STC15W104多功能学习板电路图可扩展 适用于单片机初学者和教学
- 基于STM32蓝牙控制小车系统设计(硬件+源代码+论文)大赛作品
- XILINXFPGA源码基于Spartan3火龙刀系列FPGA开发板VGA测试例程
- Java聊天室的设计与实现【尚学堂·百战程序员】
- python中matplotlib教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功