index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. sa_projectid: {
  5. type: String
  6. },
  7. disabled: {
  8. type: Boolean
  9. },
  10. isInsert: {
  11. type: Boolean
  12. }
  13. },
  14. lifetimes: {
  15. attached: function () {
  16. if (wx.getStorageSync('siteP').siteid == 'HY') {
  17. this.setData({
  18. typeList: this.data.typeList.filter(v => v.name != '居间协议')
  19. })
  20. }
  21. getApp().globalData.Language.getLanguagePackage(this)
  22. }
  23. },
  24. data: {
  25. typeShow: false,
  26. typeList: [{
  27. name: getApp().globalData.Language.getMapText('经销项目协议'),
  28. route: 'type2'
  29. }, {
  30. name: getApp().globalData.Language.getMapText('直销项目协议'),
  31. route: 'type3'
  32. }, {
  33. name: getApp().globalData.Language.getMapText('居间协议'),
  34. route: 'type4'
  35. }],
  36. "sa_projectid": 1,
  37. "content": {
  38. "nocache": true,
  39. "sa_projectid": 1,
  40. pageNumbe: 1,
  41. pageTotal: 1,
  42. total: null,
  43. "where": {
  44. "conditino": ""
  45. }
  46. }
  47. },
  48. lifetimes: {
  49. attached: function () {
  50. getApp().globalData.Language.getLanguagePackage(this)
  51. }
  52. },
  53. methods: {
  54. getList(id, init) {
  55. let content = this.data.content;
  56. content.sa_projectid = id;
  57. if (init) content.pageNumber = 1
  58. _Http.basic({
  59. "id": "20221223102102",
  60. content
  61. }).then(res => {
  62. console.log("关联合同列表", res)
  63. if (res.code != '1') return wx.showToast({
  64. title: res.data,
  65. icon: "none"
  66. })
  67. this.setData({
  68. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  69. "content.pageNumber": res.pageNumber + 1,
  70. "content.pageSize": res.pageSize,
  71. "content.pageTotal": res.pageTotal,
  72. "content.sa_projectid": id,
  73. "content.total": res.total,
  74. sa_projectid: id,
  75. })
  76. })
  77. },
  78. /* 修改总数 */
  79. changeTotal() {
  80. this.setData({
  81. "content.total": this.data.content.total - 1
  82. })
  83. },
  84. /* 去添加 */
  85. openType() {
  86. if (this.data.isInsert) {
  87. this.setData({
  88. typeShow: true
  89. })
  90. } else {
  91. wx.showModal({
  92. title: getApp().globalData.Language.getMapText('提示'),
  93. content: getApp().globalData.Language.getMapText('当前项目未审核或报备审核未通过,不可创建合同'),
  94. showCancel: false,
  95. confirmText: getApp().globalData.Language.getMapText('确定'),
  96. })
  97. }
  98. },
  99. typeCancel() {
  100. this.setData({
  101. typeShow: false
  102. })
  103. },
  104. /* 选择添加报价形式 */
  105. typeSelect({
  106. detail
  107. }) {
  108. let page = getCurrentPages()[getCurrentPages().length - 1];
  109. wx.navigateTo({
  110. url: `/packageA/contract/add/${detail.route}/index?project=${JSON.stringify(page.data.detail)}`,
  111. })
  112. this.typeCancel();
  113. },
  114. }
  115. })