import { FunCode } from "../../../../constants/enum/funcode" import { sendMsgToMQ } from "../../../../services/api/common/index" import { accountid, clientType, getErrorMsg, isEncrypted, loginCode, loginid, protoHeader, taAccount, timetample, userid } from "../../../../services/utils" import { hideLoading, showLoading, showModel } from "../../../../utils/message/index" import { queryFworderoperate } from "../../../../services/api/trade/index" import { encryptBody } from "../../../../utils/websocket/crypto" Page({ /** * 页面的初始数据 */ data: { /// 单据信息 orderid: 0, /// 单据状态 status: 0, /// 状态描述 statusdisplay: '', /// 操作信息 operator: ({}), /// 资金账户信息 ta: ({}) }, /** * 返回上层视图 */ backToParent() { /// 返回上层视图 wx.navigateBack() }, /// 查询保税服务单据操作 queryFworderoperate() { /// loding... showLoading(() => { /// 发送查询请求 queryFworderoperate({ data: { orderid: this.data.orderid.toString(), status: this.data.status }, success: (res) => { /// hideLoading hideLoading(() => { if (res.data.length != 0) { this.setData({ operator: res.data[0] }) } }) }, fail: (emsg) => { hideLoading(() => {}, emsg) } }) }) }, /** * 保税服务操作 */ doBSFWOperator() { /// showModel showModel(()=> { /// showLoading showLoading(() => { /// 参数信息 const info = JSON.stringify({ UserID: userid(), OperateID: loginid(), ClientType: clientType, ClientSerialNo: timetample().toString(), OperateAccount: loginCode().toString(), OrderID: this.data.orderid, OperateType: 3, Header: protoHeader(FunCode.BSFWMemberOperateReq, 66201) }) /// 发送请求 sendMsgToMQ({ data: { data: encryptBody(info), funCodeReq: FunCode.BSFWMemberOperateReq, funCodeRsp: FunCode.BSFWMemberOperateRsp, isEncrypted: isEncrypted() }, success: (res) => { /// 请求失败 if (res.code ! = 0) { hideLoading(() => {}, res.msg) return } /// 解析对象 const data = JSON.parse(res.data.data) if (data.RetCode != 0) { hideLoading(() => {}, getErrorMsg(data.RetCode)) return } hideLoading(() => { /// 返回上层视图 wx.navigateBack() }, '操作成功', 'success') }, fail: (emsg) => { /// 操作失败 hideLoading(() => { /// 返回上层视图 wx.navigateBack() }, emsg) } }) }, '请求中.....') }, '提示', '确认要预付款吗?', true) }, /** * 生命周期函数--监听页面加载 */ onLoad(options: any) { /// 数据解析 if (options.orderid) { this.setData({ orderid: options.orderid, statusdisplay: options.statusdisplay, status: options.status, /// 设置账户信息 ta: taAccount(accountid()) }) } /// 查询保税服务单据操作 this.queryFworderoperate() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })