tabsAbout.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="detail-customer-about">
  3. <about-contacts :list="contactsList" :config="getConfigs('contacts')" class="about-section" />
  4. <about-group :list="teamList" :config="getConfigs('group')" class="about-section" />
  5. <about-business :list="businessList" :config="getConfigs('business')" class="about-section" />
  6. <about-contract :list="contractList" :config="getConfigs('contract')" class="about-section" />
  7. <about-receivables :list="receivedList" :config="getConfigs('receivables')" class="about-section" />
  8. <about-file
  9. v-if="batchId"
  10. :batch-id="batchId"
  11. :detail-id="detailId"
  12. :is-seas="isSeas"
  13. type="crm_customer"
  14. class="about-section" />
  15. <about-operation
  16. :detail-id="detailId"
  17. type="crm_customer"
  18. class="about-section" />
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. QueryContacts,
  24. QueryBusiness,
  25. QueryContract,
  26. QueryReceivables,
  27. GetMembers
  28. } from 'API/crm/customer'
  29. import AboutContacts from '../../components/tabAbout/aboutContacts.vue'
  30. import AboutGroup from '../../components/tabAbout/aboutGroup.vue'
  31. import AboutBusiness from '../../components/tabAbout/aboutBusiness.vue'
  32. import AboutContract from '../../components/tabAbout/aboutContract.vue'
  33. import AboutReceivables from '../../components/tabAbout/aboutReceivables.vue'
  34. import AboutFile from '../../components/tabAbout/aboutFile.vue'
  35. import AboutOperation from '../../components/tabAbout/aboutOperation.vue'
  36. export default {
  37. name: 'DetailCustomerAbout',
  38. components: {
  39. AboutContacts,
  40. AboutGroup,
  41. AboutBusiness,
  42. AboutContract,
  43. AboutReceivables,
  44. AboutFile,
  45. AboutOperation
  46. },
  47. props: {
  48. detailId: {
  49. type: [String, Number],
  50. default: null,
  51. required: true
  52. },
  53. detailData: {
  54. type: Object,
  55. default: () => {}
  56. },
  57. batchId: {
  58. type: String,
  59. default: null
  60. },
  61. isSeas: {
  62. type: Boolean,
  63. default: false
  64. }
  65. },
  66. data() {
  67. return {
  68. contactsList: [],
  69. businessList: [],
  70. contractList: [],
  71. receivedList: [],
  72. teamList: [],
  73. contractReady: false,
  74. receivedReady: false
  75. }
  76. },
  77. computed: {
  78. flag() {
  79. return this.contractReady && this.receivedReady
  80. }
  81. },
  82. watch: {
  83. flag: {
  84. handler(val) {
  85. if (val) {
  86. if (this.contractList.length > 0) {
  87. this.contractList.forEach(contract => {
  88. let filterRes = this.receivedList.filter(received => {
  89. return contract.contract_id == received.contract_id && received.check_status === 2
  90. })
  91. let doMoney = 0
  92. filterRes.forEach(item => {
  93. doMoney += Number(item.money)
  94. })
  95. contract.doMoney = doMoney.toFixed(2)
  96. this.$set(contract, 'doMoney', contract.doMoney)
  97. })
  98. }
  99. console.log('redy contractList', this.contractList)
  100. }
  101. },
  102. immediate: true
  103. }
  104. },
  105. created() {
  106. this.getList()
  107. },
  108. methods: {
  109. getList() {
  110. let params = {
  111. customerId: this.detailId,
  112. pageType: 0
  113. }
  114. QueryContacts(params).then(response => {
  115. console.log('contactsList: ', response)
  116. this.contactsList = response.list
  117. }).catch()
  118. QueryBusiness(params).then(response => {
  119. console.log('businessList: ', response)
  120. this.businessList = response.list
  121. })
  122. QueryContract(params).then(response => {
  123. console.log('contractList: ', response)
  124. this.contractList = response.list || []
  125. this.contractReady = true
  126. })
  127. QueryReceivables(params).then(response => {
  128. console.log('receivedList: ', response)
  129. this.receivedList = response.list || []
  130. this.receivedReady = true
  131. })
  132. GetMembers({
  133. id: this.detailId
  134. }).then(res => {
  135. console.log('teamList: ', res)
  136. this.teamList = res
  137. }).catch(() => {})
  138. },
  139. getConfigs() {
  140. return {
  141. detail: this.detailData,
  142. type: 'customer',
  143. isSeas: this.isSeas
  144. }
  145. }
  146. }
  147. }
  148. </script>
  149. <style scoped lang="scss">
  150. </style>