import { FunCode } from "../../../../constants/enum/funcode" import { sendMsgToMQ } from "../../../../services/api/common/index" import { queryGzcjjcorderoperate } from "../../../../services/api/trade/index" import { userid, loginid, clientType, timetample, loginCode, protoHeader, isEncrypted, taAccount, accountid, getErrorMsg } from "../../../../services/utils" import { hideLoading, showLoading, showModel } from "../../../../utils/message/index" import { encryptBody } from "../../../../utils/websocket/crypto" Page({ /** * 页面的初始数据 */ data: { /// 单据信息 order: ({}), /// 查询出境检测单据操作 operator: ({}), /// 资金账户信息 ta: ({}), /// 当前余额 blance: '0.0' }, /** * 返回上层视图 */ backToParent() { /// 返回上层视图 wx.navigateBack() }, /// 查询出境检测单据操作 queryGzcjjcorderoperate() { /// loding... showLoading(() => { /// 发送查询请求 queryGzcjjcorderoperate({ data: { orderid: this.data.order.orderidstr, status: this.data.order.gzcjstatus }, success: (res) => { /// hideLoading hideLoading(() => { if (res.data.length != 0) { this.setData({ operator: res.data[0] }) } }) }, fail: (emsg) => { hideLoading(() => {}, emsg) } }) }) }, /** * 出境检测操作请求 */ doCJJCOperator() { /// loding..... showModel(() => { showLoading(()=>{ /// 参数信息 const info = JSON.stringify({ UserID: userid(), OperateID: loginid(), ClientType: clientType, ClientSerialNo: timetample().toString, OperateAccount: loginCode().toString(), OrderID: this.data.order.orderidstr, OperateType: 5, Header: protoHeader(FunCode.CJJCMemberOperateReq, 66201) }) /// 发送请求 sendMsgToMQ({ data: { data: encryptBody(info), funCodeReq: FunCode.CJJCMemberOperateReq, funCodeRsp: FunCode.CJJCMemberOperateRsp, 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(()=>{}, emsg) } }) }) }, '提示', '确认要付款吗?', true) }, /** * 生命周期函数--监听页面加载 */ onLoad(options: any) { /// 数据解析 const obj = JSON.parse(options.item) if (obj) { /// 资金信息 const { balance, orifreezecharge ,oriotherfreezemargin } = taAccount(accountid()) this.setData({ order: obj, /// 设置账户信息 ta: taAccount(accountid()), /// 当前余额 blance: (balance-orifreezecharge-oriotherfreezemargin).toFixed(2) }) } /// 查询出境检测单据操作 this.queryGzcjjcorderoperate() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })