index.js 3.3 KB

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