myBills.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // pages/voyageManage/myBills/myBills.js
  2. const app = getApp()
  3. const {
  4. postApi
  5. } = require("../../../apis/api")
  6. Page({
  7. data: {
  8. medias: [],
  9. voyageId: 0,
  10. trans: '',
  11. },
  12. check(e) {
  13. let arr = this.data.currentBillItem.shipownerUploadFiles
  14. let {
  15. index,
  16. index: checkedIndex
  17. } = e.currentTarget.dataset
  18. // arr[index].checked = arr[index].checked ? false : true
  19. for (let i in arr) {
  20. if (i == checkedIndex) {
  21. arr[i].checked = true
  22. } else {
  23. arr[i].checked = false
  24. }
  25. }
  26. this.data.currentBillItem.shipownerUploadFiles = arr
  27. this.setData({
  28. currentBillItem: this.data.currentBillItem
  29. })
  30. },
  31. onLoad(options) {
  32. let currentBillItem = app.globalData.currentBillItem
  33. this.setData({
  34. currentBillItem,
  35. voyageId: options.id
  36. })
  37. },
  38. isTrue() {
  39. },
  40. examineMedia() {
  41. let arr = this.data.currentBillItem.shipownerUploadFiles
  42. if (!arr.some((e) => {
  43. return e.checked
  44. })) {
  45. wx.showToast({
  46. title: '至少选择一张单据',
  47. icon: "error"
  48. })
  49. return
  50. }
  51. wx.navigateTo({
  52. url: `/pages/voyageManage/myBills/examine/examine?id=${this.data.voyageId}`,
  53. })
  54. },
  55. onShareAppMessage() {
  56. }
  57. })