1.新建工程
1.右键项目——新建项目打开如下图所示:
其中项目名自己起,工程目录自己选择一个,AppID笔者使用的是注册号,您可以申请一个。

2.获取api
快递的API笔者选择的是:贵州诚数科技有限公司的下单api
点击:快递寄件

这个api有三个功能:分别是快递寄件、快递运力查询、快递订单取消

然后在此页面的右上角找到买家中心点进去如下图:

点击订单号后进入下图,图中标出来的就是你要使用的api


3.界面
<view class="container1">
<br style="font-size:20px" > 查询某地快递运力\n</br>
<input placeholder="最大输入长度为10" bindinput="input" />
<button type="primary" bindtap = "btnClick"style="position:relative;right:10%; padding:5%;width:100%;height:10%;font-size:80%;background-color:#07c160;color:white;margin-bottom:10%;">查询</button>
<scroll-view scroll-y="true" style="height:300px;">
【{{expressInfo.message}}】
<view wx:for="{{expressInfo.data.details}}" >
{{item.comCode}}【{{item.type}}】
</view>
</scroll-view>
</view>
<br style="font-size:20px" >寄件</br>
<text>\n</text>
收件人完整地址 <input placeholder="收件人完整地址,包含省、市、区、街道等" bindinput="input1" />
订单信息回调地址 <input placeholder="订单信息回调地址" bindinput="input2" />
随机数 <input placeholder="随机数" bindinput="input3" />
预约时间 <input placeholder="预约起始时间(HH:mm),例如:09:00" bindinput="input4" />
预约截止时间 <input placeholder="预约截止时间(HH:mm),例如:10:00" bindinput="input5" />
寄件人所在完整地址 <input placeholder="寄件人所在完整地址,包含省、市、区、街道等" bindinput="input6" />
物品总重量 <input placeholder="物品总重量KG,例:1.5,单位kg" bindinput="input7" />
备注 <input placeholder="备注" bindinput="input8" />
收件人手机号 <input placeholder="收件人的手机号,手机号和电话号二者其一必填" bindinput="input9" />
预约日期 <input placeholder="预约日期,例如:今天/明天/后天" bindinput="input10" />
寄件人姓名 <input placeholder="寄件人姓名" bindinput="inpu11" />
收件人姓名<input placeholder="收件人姓名" bindinput="input12" />
支付方式<input placeholder="支付方式,SHIPPER: 寄付(默认),CONSIGNEE: 到付" bindinput="input13" />
快递公司编码<input placeholder="快递公司的编码,一律用小写字母" bindinput="input14" />
物品种类 <input placeholder="物品名称,例:文件(公司编码为jd时,cargo必填)" bindinput="input15" />
寄件人手机号 <input placeholder="寄件人的手机号,手机号和电话号二者其一必填" bindinput="input16" />
<button type="primary" bindtap = "btnClick1"style="position:relative;right:10%; padding:5%;width:100%;height:10%;font-size:80%;background-color:#07c160;color:white;margin-bottom:10%;">寄件</button>
<scroll-view scroll-y="true" style="height:300px;">
<view>
[taskId: {{expressInfo1.data.detail.taskId}} ] [orderId:{{expressInfo1.data.detail.orderId}}][messages:{{expressInfo1.message}}]
</view>
</scroll-view>
<br style="font-size:20px" > 快递订单取消</br>
<text>\n</text>
cancelMsg: <input placeholder="取消原因" bindinput="input17" />
orderId: <input placeholder="订单ID" bindinput="input18" />
taskID: <input placeholder="任务ID" bindinput="input19" />
<button type="primary" bindtap = "btnClick2"style="position:relative;right:10%; padding:5%;width:100%;height:10%;font-size:80%;background-color:#07c160;color:white;margin-bottom:10%;">确定</button>
<scroll-view scroll-y="true" style="height:300px;">
<view >
{{expressInfo2.data.result}}【{{expressInfo2.data.description}}】
</view>
</scroll-view>
4.调用api
这部分是最重要的部分参数一定要写对,不然读取不到 |
url填写所用的api的地址,后面的参数根据每个api的参数来写: |
快递运力查询 只有一个参数:address,如下图: |
请求方式为GET,调用地址也给出了。 |

示例:
getExpressInfo:function(address,cb){
wx.request({
url: 'http://gwgp-wat4svkuskr.n.bdcloudapi.com/kdyl/get?address='+address,
data: {
x: '',
y: ''
},
header: {
'Content-Type': 'application/json;charset=UTF-8' ,
'X-Bce-Signature':'AppCode/8a6b23ce2a194b689c7afd96ae539bb8'
},
success (res) {
cb(res.data)
}
})
},
5.运行结果图






【关于url的地址各位朋友一定要注意】 |
【笔者反反复复的发送失败,查不出原因整个人都不好了】 |
【另外就是请求方式的问题:post、get要注意!!!,不然请求不到】 |
6.获取资源
1.资源链接:资源获取
2.微信后台回复:快递小程序
3.源代码 点击