index.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. import { queryGZBSFWOrderDetail } from "../../../../services/api/trade/index"
  2. import { userid } from "../../../../services/utils"
  3. import { hideLoading, showLoading } from "../../../../utils/message/index"
  4. import { isnullstr } from "../../../../utils/util"
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. /// 底部安全区域
  11. safeBottom: getApp().globalData.safeBottom,
  12. /// 列头
  13. titles: [['净重(ct)| 净重(g)| 毛重(g)| 总值(USD)| 单价(USD/ct)'],
  14. ['内容 | 备注 | 彩钻颜色']],
  15. /// 是否空数据
  16. isEmpty: true,
  17. /// 数据
  18. details: <GuangZuan.GZBSFWOrderDetail[]>[],
  19. /// 单据信息
  20. orderid: '',
  21. /// 单据编号
  22. orderno: '',
  23. /// 状态
  24. status: '',
  25. /// 显示的值
  26. values: <{}[]>[]
  27. },
  28. /**
  29. * 返回上层视图
  30. */
  31. backToParent() {
  32. /// 返回上层视图
  33. wx.navigateBack()
  34. },
  35. /// 查询保税服务单据明细
  36. queryGZBSFWOrderDetail () {
  37. /// loding.....
  38. showLoading(() => {
  39. /// 发送查询请求
  40. queryGZBSFWOrderDetail({
  41. data: {
  42. /// 模糊搜索
  43. userid: userid(),
  44. orderid: this.data.orderid
  45. },
  46. /// 加载成功
  47. success: (res) => {
  48. if (res.code != 200) {
  49. /// 加载失败
  50. hideLoading(() => {}, '加载失败...')
  51. return
  52. }
  53. hideLoading(() => {
  54. /// 数据赋值
  55. this.setData({
  56. bonds: res.data,
  57. isEmpty: res.data.length === 0,
  58. /// 显示的值
  59. values: res.data.map(obj => {
  60. return { up: [obj.netweigthct.toString()+' | '+
  61. obj.netweigthgm.toString()+' | '+
  62. obj.grossweightgm.toString()+' | '+obj.totalamount.toFixed(2)+' | '+
  63. obj.perprice.toString()],
  64. dwn: [isnullstr(obj.ordercontent)+' | '+ isnullstr(obj.remark)+' | '+ isnullstr(obj.colorinfo)]}
  65. })
  66. })
  67. })
  68. },
  69. fail: (emsg) => {
  70. /// hideLoading
  71. hideLoading(() => {}, emsg)
  72. },
  73. complete: () => {
  74. /// 停止下拉刷新
  75. wx.stopPullDownRefresh()
  76. }
  77. })
  78. })
  79. },
  80. /**
  81. * 生命周期函数--监听页面加载
  82. */
  83. onLoad(options: any) {
  84. // /// 传参信息
  85. // const item = JSON.parse(options.item)
  86. // /// 单据信息
  87. if (options.orderid) {
  88. this.setData({
  89. orderid: options.orderid,
  90. status: options.status,
  91. orderno: options.orderno,
  92. })
  93. }
  94. /// 查询保税服务单据
  95. this.queryGZBSFWOrderDetail()
  96. },
  97. /**
  98. * 生命周期函数--监听页面初次渲染完成
  99. */
  100. onReady() {
  101. },
  102. /**
  103. * 生命周期函数--监听页面显示
  104. */
  105. onShow() {
  106. },
  107. /**
  108. * 生命周期函数--监听页面隐藏
  109. */
  110. onHide() {
  111. },
  112. /**
  113. * 生命周期函数--监听页面卸载
  114. */
  115. onUnload() {
  116. },
  117. /**
  118. * 页面相关事件处理函数--监听用户下拉动作
  119. */
  120. onPullDownRefresh() {
  121. /// 查询保税服务单据
  122. this.queryGZBSFWOrderDetail()
  123. },
  124. /**
  125. * 页面上拉触底事件的处理函数
  126. */
  127. onReachBottom() {
  128. },
  129. /**
  130. * 用户点击右上角分享
  131. */
  132. onShareAppMessage() {
  133. }
  134. })