index.ts 3.9 KB

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