index.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. import { FunCode } from "../../../../constants/enum/funcode"
  2. import { sendMsgToMQ } from "../../../../services/api/common/index"
  3. import { queryGzbscReckonOrder } from "../../../../services/api/orders/index"
  4. import { getEnumdicValue, getErrorMsg, isEncrypted, protoHeader, timetample, userid } from "../../../../services/utils"
  5. import { hideLoading, showLoading, showModel } from "../../../../utils/message/index"
  6. import { isnullstr } from "../../../../utils/util"
  7. import { encryptBody } from "../../../../utils/websocket/crypto"
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. /// 底部安全区域
  14. safeBottom: getApp().globalData.safeBottom,
  15. /// tabs
  16. tabs: [{id: 2, name: '待支付'}, {id: 3, name: '已支付'}],
  17. /// 类别
  18. active: 0,
  19. /// 是否空数据
  20. isEmpty: false,
  21. /// 数据信息
  22. data: <GuangZuan.GzbscReckonOrder[]>[],
  23. /// 显示数据信息
  24. values: <{}>[]
  25. },
  26. /**
  27. * 返回上层视图
  28. */
  29. backToParent() {
  30. /// 返回上层视图
  31. wx.navigateBack()
  32. },
  33. onTabChange(e: any) {
  34. // 重置状态
  35. this.setData({ active: e.detail.index })
  36. /// 查询数据
  37. this.queryGzbscReckonOrder()
  38. },
  39. /// 申请支付提交
  40. doPayment(orderID: string) {
  41. /// showModel
  42. showModel(() => {
  43. /// showLoading
  44. showLoading(() => {
  45. /// 请求参数
  46. const info = JSON.stringify({
  47. Header: protoHeader(FunCode.BSWMSReckonPayReq),
  48. UserID: userid(),
  49. OrderID: orderID,
  50. ClientSerialNo: timetample().toString()
  51. })
  52. /// 发送请求
  53. sendMsgToMQ({
  54. data: {
  55. data: encryptBody(info),
  56. funCodeReq: FunCode.BSWMSReckonPayReq,
  57. funCodeRsp: FunCode.BSWMSReckonPayRsp,
  58. isEncrypted: isEncrypted()
  59. },
  60. success: (res) => {
  61. /// 解析对象
  62. const data = JSON.parse(res.data.data)
  63. if (data.RetCode != 0) {
  64. hideLoading(() => {}, getErrorMsg(data.RetCode))
  65. return
  66. }
  67. /// 求购发布请求成功
  68. hideLoading(() => {
  69. wx.navigateBack()
  70. }, '提交支付申请成功', 'success')
  71. },
  72. fail: (emsg) => {
  73. hideLoading(()=>{}, emsg)
  74. }
  75. })
  76. }, '提交申请请求中....')
  77. }, '提示', '确认要提交支付申请吗?')
  78. },
  79. /// 保税仓结算单表查询
  80. queryGzbscReckonOrder() {
  81. /// showLoading
  82. showLoading(() => {
  83. queryGzbscReckonOrder({
  84. data: {
  85. userid: userid(),
  86. paystatus: this.data.active+2
  87. },
  88. success: (res) => {
  89. /// 获取数据
  90. this.setData({
  91. isEmpty: res.data.length === 0,
  92. data: res.data,
  93. values: res.data.map(obj => {
  94. return {
  95. servicefee: obj.servicefee,
  96. paystatusdesc: getEnumdicValue('GZBSCPayStatus', obj.paystatus),
  97. reckonmonth: isnullstr(obj.reckonmonth),
  98. totalfee: obj.totalfee,
  99. storagefee: obj.storagefee,
  100. powerfee: obj.powerfee,
  101. premium: obj.premium,
  102. customsfee: obj.customsfee,
  103. paystatus: obj.paystatus,
  104. paytime: obj.paytime,
  105. orderid: obj.orderid
  106. }
  107. })
  108. })
  109. },
  110. complete: () => {
  111. /// hideLoading
  112. hideLoading()
  113. }
  114. })
  115. })
  116. },
  117. /**
  118. * 生命周期函数--监听页面加载
  119. */
  120. onLoad() {
  121. /// 保税仓结算单表查询
  122. this.queryGzbscReckonOrder()
  123. },
  124. /**
  125. * 生命周期函数--监听页面初次渲染完成
  126. */
  127. onReady() {
  128. },
  129. /**
  130. * 生命周期函数--监听页面显示
  131. */
  132. onShow() {
  133. },
  134. /**
  135. * 生命周期函数--监听页面隐藏
  136. */
  137. onHide() {
  138. },
  139. /**
  140. * 生命周期函数--监听页面卸载
  141. */
  142. onUnload() {
  143. },
  144. /**
  145. * 页面相关事件处理函数--监听用户下拉动作
  146. */
  147. onPullDownRefresh() {
  148. /// 保税仓结算单表查询
  149. this.queryGzbscReckonOrder()
  150. },
  151. /**
  152. * 页面上拉触底事件的处理函数
  153. */
  154. onReachBottom() {
  155. },
  156. /**
  157. * 用户点击右上角分享
  158. */
  159. onShareAppMessage() {
  160. }
  161. })