index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. disabled: {type:Boolean},
  5. isInsert: {type:Boolean}
  6. },
  7. data: {
  8. list: [],
  9. sa_projectid: "",
  10. "content": {
  11. "version": 1,
  12. "nocache": true,
  13. "pageNumber": 1,
  14. "pageTotal": 1,
  15. "total": null,
  16. "type": 1,
  17. "where": {
  18. "condition": ""
  19. }
  20. }
  21. },
  22. methods: {
  23. getList(id, init) {
  24. let content = this.data.content;
  25. content.sa_projectid = id;
  26. if (init) content.pageNumber = 1
  27. _Http.basic({
  28. "id": 20221124190702,
  29. content
  30. }).then(res => {
  31. console.log("报价单", res)
  32. if (res.msg != '成功') return wx.showToast({
  33. title: res.data,
  34. icon: "none"
  35. })
  36. this.setData({
  37. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  38. "content.pageNumber": res.pageNumber + 1,
  39. "content.pageSize": res.pageSize,
  40. "content.pageTotal": res.pageTotal,
  41. "content.total": res.total,
  42. sa_projectid: id
  43. });
  44. })
  45. },
  46. addOffers() {
  47. if (this.data.isInsert) {
  48. const {
  49. projectname,
  50. sa_projectid
  51. } = getCurrentPages().find(v => v.__route__ == 'packageA/project/detail').data.detail;
  52. wx.navigateTo({
  53. url: `/packageA/offers/addProjectOffer?sa_projectid=${JSON.stringify({
  54. sa_projectid:[projectname,[sa_projectid]]
  55. })}`,
  56. })
  57. } else {
  58. wx.showToast({
  59. title: '当前项目未审核或报备审核未通过,不可创建报价单',
  60. icon: "none",
  61. mask: true
  62. })
  63. }
  64. },
  65. /* 修改总数 */
  66. changeTotal() {
  67. this.setData({
  68. "content.total": this.data.content.total - 1
  69. })
  70. }
  71. }
  72. })