index.ts 3.9 KB

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