index.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import { FunCode } from "../../../../constants/enum/funcode"
  2. import { sendMsgToMQ } from "../../../../services/api/common/index"
  3. import { queryGzcjjcorderoperate } from "../../../../services/api/trade/index"
  4. import { userid, loginid, clientType, timetample, loginCode, protoHeader, isEncrypted, taAccount, accountid, getErrorMsg } from "../../../../services/utils"
  5. import { hideLoading, showLoading, showModel } from "../../../../utils/message/index"
  6. import { encryptBody } from "../../../../utils/websocket/crypto"
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. /// 单据信息
  13. order: <GuangZuan.GZCJJCOrder>({}),
  14. /// 查询出境检测单据操作
  15. operator: <GuangZuan.GzcjjcorderoperateRsp>({}),
  16. /// 资金账户信息
  17. ta: <GuangZuan.TaAccount>({}),
  18. /// 当前余额
  19. blance: '0.0'
  20. },
  21. /**
  22. * 返回上层视图
  23. */
  24. backToParent() {
  25. /// 返回上层视图
  26. wx.navigateBack()
  27. },
  28. /// 查询出境检测单据操作
  29. queryGzcjjcorderoperate() {
  30. /// loding...
  31. showLoading(() => {
  32. /// 发送查询请求
  33. queryGzcjjcorderoperate({
  34. data: {
  35. orderid: this.data.order.orderidstr,
  36. status: this.data.order.gzcjstatus
  37. },
  38. success: (res) => {
  39. /// hideLoading
  40. hideLoading(() => {
  41. if (res.data.length != 0) {
  42. this.setData({ operator: res.data[0] })
  43. }
  44. })
  45. },
  46. fail: (emsg) => {
  47. hideLoading(() => {}, emsg)
  48. }
  49. })
  50. })
  51. },
  52. /**
  53. * 出境检测操作请求
  54. */
  55. doCJJCOperator() {
  56. /// showModel
  57. showModel(() => {
  58. /// showLoading
  59. showLoading(()=>{
  60. /// 参数信息
  61. const info = JSON.stringify({
  62. UserID: userid(),
  63. OperateID: loginid(),
  64. ClientType: clientType,
  65. ClientSerialNo: timetample().toString,
  66. OperateAccount: loginCode().toString(),
  67. OrderID: this.data.order.orderidstr,
  68. OperateType: 4,
  69. Header: protoHeader(FunCode.CJJCMemberOperateReq, 66201)
  70. })
  71. /// 发送请求
  72. sendMsgToMQ({
  73. data: {
  74. data: encryptBody(info),
  75. funCodeReq: FunCode.CJJCMemberOperateReq,
  76. funCodeRsp: FunCode.CJJCMemberOperateRsp,
  77. isEncrypted: isEncrypted()
  78. },
  79. success: (res) => {
  80. /// 请求失败
  81. if (res.code ! = 0) {
  82. hideLoading(() => {}, res.msg)
  83. return
  84. }
  85. /// 解析对象
  86. const data = JSON.parse(res.data.data)
  87. if (data.RetCode != 0) {
  88. hideLoading(() => {}, getErrorMsg(data.RetCode))
  89. return
  90. }
  91. hideLoading(()=>{
  92. /// 返回上层视图
  93. wx.navigateBack()
  94. }, '操作成功', 'success')
  95. },
  96. fail: (emsg) => {
  97. hideLoading(()=>{}, emsg)
  98. }
  99. })
  100. })
  101. }, '提示', '确认要预付款吗?', true)
  102. },
  103. /**
  104. * 生命周期函数--监听页面加载
  105. */
  106. onLoad(options: any) {
  107. /// 数据解析
  108. const obj = JSON.parse(options.item)
  109. if (obj) {
  110. /// 资金信息
  111. const {balance, orifreezecharge ,oriotherfreezemargin} = taAccount(accountid())
  112. this.setData({
  113. order: obj,
  114. /// 设置账户信息
  115. ta: taAccount(accountid()),
  116. /// 当前余额
  117. blance: (balance-orifreezecharge-oriotherfreezemargin).toFixed(2)
  118. })
  119. }
  120. /// 查询出境检测单据操作
  121. this.queryGzcjjcorderoperate()
  122. },
  123. /**
  124. * 生命周期函数--监听页面初次渲染完成
  125. */
  126. onReady() {
  127. },
  128. /**
  129. * 生命周期函数--监听页面显示
  130. */
  131. onShow() {
  132. },
  133. /**
  134. * 生命周期函数--监听页面隐藏
  135. */
  136. onHide() {
  137. },
  138. /**
  139. * 生命周期函数--监听页面卸载
  140. */
  141. onUnload() {
  142. },
  143. /**
  144. * 页面相关事件处理函数--监听用户下拉动作
  145. */
  146. onPullDownRefresh() {
  147. },
  148. /**
  149. * 页面上拉触底事件的处理函数
  150. */
  151. onReachBottom() {
  152. },
  153. /**
  154. * 用户点击右上角分享
  155. */
  156. onShareAppMessage() {
  157. }
  158. })