shipOwnerList.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // pages/shipOwnerManage/shipOwnerList/shipOwnerList.js
  2. import {
  3. uploadFile
  4. } from "../../../utils/upload"
  5. import {
  6. postApi
  7. } from "../../../apis/api"
  8. Page({
  9. data: {
  10. shipOwnerList: [],
  11. term: '',
  12. currentLetter: ''
  13. },
  14. async getShipOwnerList(type) {
  15. let res = await postApi('/ship/list', {
  16. loginAccountId: wx.getStorageSync('loginAccountId'),
  17. term: this.data.term
  18. })
  19. if (type) wx.stopPullDownRefresh()
  20. let shipOwnerList = res.data.result
  21. shipOwnerList.push(shipOwnerList.shift())
  22. this.setData({
  23. shipOwnerList
  24. })
  25. },
  26. call(e) {
  27. wx.makePhoneCall({
  28. phoneNumber: e.currentTarget.dataset.phone
  29. })
  30. },
  31. addShipOwner() {
  32. wx.navigateTo({
  33. url: '../addShipOnwer/addShipOnwer',
  34. })
  35. },
  36. tapLetter(e) {
  37. this.setData({
  38. currentLetter: e.currentTarget.dataset.letter
  39. })
  40. },
  41. onLoad() {
  42. this.getShipOwnerList()
  43. },
  44. onPullDownRefresh() {
  45. this.setData({
  46. term: ''
  47. })
  48. this.getShipOwnerList(1)
  49. },
  50. onShow() {
  51. if (wx.getStorageSync('apiStatus') == "success") {
  52. this.getShipOwnerList()
  53. wx.removeStorageSync('apiStatus')
  54. }
  55. }
  56. })