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. /// loding.....
  57. showModel(() => {
  58. showLoading(()=>{
  59. /// 参数信息
  60. const info = JSON.stringify({
  61. UserID: userid(),
  62. OperateID: loginid(),
  63. ClientType: clientType,
  64. ClientSerialNo: timetample().toString,
  65. OperateAccount: loginCode().toString(),
  66. OrderID: this.data.order.orderidstr,
  67. OperateType: 5,
  68. Header: protoHeader(FunCode.CJJCMemberOperateReq, 66201)
  69. })
  70. /// 发送请求
  71. sendMsgToMQ({
  72. data: {
  73. data: encryptBody(info),
  74. funCodeReq: FunCode.CJJCMemberOperateReq,
  75. funCodeRsp: FunCode.CJJCMemberOperateRsp,
  76. isEncrypted: isEncrypted()
  77. },
  78. success: (res) => {
  79. /// 请求失败
  80. if (res.code ! = 0) {
  81. hideLoading(() => {}, res.msg)
  82. return
  83. }
  84. /// 解析对象
  85. const data = JSON.parse(res.data.data)
  86. if (data.RetCode != 0) {
  87. hideLoading(() => {}, getErrorMsg(data.RetCode))
  88. return
  89. }
  90. hideLoading(()=>{
  91. /// 返回上层视图
  92. wx.navigateBack()
  93. }, '操作成功', 'success')
  94. },
  95. fail: (emsg) => {
  96. hideLoading(()=>{}, emsg)
  97. }
  98. })
  99. })
  100. }, '提示', '确认要付款吗?', true)
  101. },
  102. /**
  103. * 生命周期函数--监听页面加载
  104. */
  105. onLoad(options: any) {
  106. /// 数据解析
  107. const obj = JSON.parse(options.item)
  108. if (obj) {
  109. /// 资金信息
  110. const { balance, orifreezecharge ,oriotherfreezemargin } = taAccount(accountid())
  111. this.setData({
  112. order: obj,
  113. /// 设置账户信息
  114. ta: taAccount(accountid()),
  115. /// 当前余额
  116. blance: (balance-orifreezecharge-oriotherfreezemargin).toFixed(2)
  117. })
  118. }
  119. /// 查询出境检测单据操作
  120. this.queryGzcjjcorderoperate()
  121. },
  122. /**
  123. * 生命周期函数--监听页面初次渲染完成
  124. */
  125. onReady() {
  126. },
  127. /**
  128. * 生命周期函数--监听页面显示
  129. */
  130. onShow() {
  131. },
  132. /**
  133. * 生命周期函数--监听页面隐藏
  134. */
  135. onHide() {
  136. },
  137. /**
  138. * 生命周期函数--监听页面卸载
  139. */
  140. onUnload() {
  141. },
  142. /**
  143. * 页面相关事件处理函数--监听用户下拉动作
  144. */
  145. onPullDownRefresh() {
  146. },
  147. /**
  148. * 页面上拉触底事件的处理函数
  149. */
  150. onReachBottom() {
  151. },
  152. /**
  153. * 用户点击右上角分享
  154. */
  155. onShareAppMessage() {
  156. }
  157. })