index.ts 3.7 KB

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