index.ts 4.1 KB

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