import { sendMsgToMQ } from "../../../../services/api/common/index" import Toast from "../../../../miniprogram_npm/@vant/weapp/toast/toast"; import { FunCode } from "../../../../constants/enum/funcode" import { accountid, isEncrypted, protoHeader } from "../../../../services/utils"; Page({ /** * 页面的初始数据 */ data: { /// 单据信息 order: ({}), /// 联系信息 contract: '', /// 地址信息 address: '', /// 发票信息 invoice: '' }, /** * 返回上层视图 */ backToParent() { /// 返回上层视图 wx.navigateBack() }, /** * 修改申请 */ doModify() { // 校验失败 if (!this.check()) { return } /// loding..... Toast.loading({ message: '修改申请请求中.....'}) const json = { ContactInfo: `ContactInfo:${this.data.contract}`+`ReceiveInfo:${this.data.address}`+`ReceiptInfo:${this.data.invoice}` } /// 参数信息 const params = { PerformancePlanID: this.data.order.performanceplanid, AccountID: accountid(), ContactInfo: JSON.stringify(json), Header: protoHeader(FunCode.PerformanceModifyContactReq) } /// 发送请求 sendMsgToMQ({ data: { data: JSON.stringify(params), funCodeReq: FunCode.PerformanceModifyContactReq, funCodeRsp: FunCode.PerformanceModifyContactRsp, isEncrypted: isEncrypted() }, success: (res) => { if (res.code != 0) { Toast.fail({message: '修改申请失败, 原因:'+res.msg}) return } /// 操作成功 Toast.success('修改申请成功') /// 返回上层视图 wx.navigateBack() }, fail: (emsg) => { /// 操作失败 Toast.fail('修改申请失败,原因:'+emsg) }, complete: () => { /// hideLoading Toast.clear() } }) }, check(): boolean { if (this.data.contract === '') { Toast.fail({message: '请输入联系信息!'}) return false } if (this.data.address === '') { Toast.fail({message: '请选择收货地址信息!'}) return false } if (this.data.invoice === '') { Toast.fail({message: '请选择发票信息!'}) return false } return true }, /** * 生命周期函数--监听页面加载 */ onLoad(options: any) { /// 数据解析 const myPerformanc: GuangZuan.MyPerformanc = JSON.parse(options.id ?? '') if (myPerformanc) { this.setData({ order: myPerformanc }) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })