index.js 3.0 KB

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