const Parse = getApp().Parse const company = getApp().globalData.company Component({ /** * 组件的属性列表 */ properties: { /* 订单编号 */ num:{ type:String, value:'' }, /* 快递公司代码 依据ExpressCompany表code获取*/ com:{ type:String, value:'' }, /* 寄件/收人手机号(二选一)【顺丰及丰网必填】 */ phone:{ type:String, value:'' }, }, /** * 组件的初始数据 */ data: { }, lifetimes: { created() { }, attached: async function () { }, ready(){ let { num, com } = this.data num && this.getExpress() } }, /** * 组件的方法列表 */ methods: { getExpress() { let { num, com, phone } = this.data let data = { company:company, num, com, phone } let url = `https://server.fmode.cn/api/apig/express/consult` wx.request({ url: url, data: data, header: { 'content-type': 'application/json' }, method: 'POST', dataType: 'json', responseType: 'text', success: (result) => { console.log(result); if(result?.data.code == 200){ let data = result.data.data.data this.setData({ step:data[0] }) return } }, fail: () => {}, complete: () => {} }); }, async getExpressCompany(com){ let query = new Parse.Query('ExpressCompany') query.equalTo('code',com) let r = await query.first() if(r?.id){ this.setData({ companyText:r.get('name') }) } }, toUrl(){ let { num, com } = this.data let url = `/common-page/pages/nova-express/index?num=${num}&com=${com}` wx.navigateTo({ url: url, }); } }, })