index.js 2.8 KB

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