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