| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- 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, getErrorMsg } from "../../../../services/utils"
- import { showModel, showLoading, hideLoading } from "../../../../utils/message/index"
- import { encryptBody } from "../../../../utils/websocket/crypto"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- /// 单据信息
- orderid: '',
- /// 单据编号
- orderno: '',
- /// 单据状态
- status: 0,
- /// 状态描述
- statusdisplay: '',
- /// 操作信息
- operator: <GuangZuan.FworderoperateRsp>({}),
- /// 资金账户信息
- ta: <GuangZuan.TaAccount>({}),
- /// 当前余额
- blance: '0.0'
- },
- /**
- * 返回上层视图
- */
- backToParent() {
- /// 返回上层视图
- wx.navigateBack()
- },
- /// 查询保税服务单据操作
- queryFworderoperate() {
- /// loding...
- showLoading(() => {
- /// 发送查询请求
- queryFworderoperate({
- data: {
- orderid: this.data.orderid,
- 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: 4,
- 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) {
- /// 计算余额
- const {balance, orifreezecharge ,oriotherfreezemargin} = taAccount(accountid())
- this.setData({
- orderid: options.orderid,
- statusdisplay: options.statusdisplay,
- status: options.status,
- orderno: options.orderno,
- /// 设置账户信息
- ta: taAccount(accountid()),
- /// 当前余额
- blance: (balance-orifreezecharge-oriotherfreezemargin).toFixed(2)
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- /// 查询保税服务单据操作
- this.queryFworderoperate()
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|