TabActions.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <section class="tab-actions safe-area-inside-bottom bg-white">
  3. <ActionCollection
  4. :id="id"
  5. class="tab-action"
  6. :before-action="beforeActionBindPhoneCheck"
  7. :before-redirect="beforeLeavePage"
  8. @syncLabels="syncLabels"
  9. />
  10. <QuickMonitor
  11. v-if="showMonitor"
  12. :id="id"
  13. class="tab-action"
  14. type="project"
  15. :cache="true"
  16. :auto="true"
  17. popover
  18. :before-action="beforeActionBindPhoneCheck"
  19. :before-leave-page="beforeLeavePage"
  20. @initd="afterMonitorFetch"
  21. @change="afterMonitorFetch"
  22. />
  23. <ActionDownloadReport
  24. v-if="showDownloadReportBtn"
  25. class="tab-action"
  26. :buyers="buyers"
  27. :winners="winners"
  28. :project-name="projectName"
  29. :id="id"
  30. :show-credit="showCreditReport"
  31. :btnInfo="reportBtn"
  32. />
  33. <ActionShareToWorkmate
  34. :id="id"
  35. class="tab-action"
  36. :before-action="beforeShareToWorkMateAction"
  37. />
  38. <ActionInBidding
  39. :id="id"
  40. class="tab-action"
  41. @change="biddingStatusChange"
  42. />
  43. </section>
  44. </template>
  45. <script>
  46. import { mapMutations, mapState } from 'vuex'
  47. import ActionCollection from '@/views/article/components/ActionCollection.vue'
  48. import QuickMonitor from '@/composables/quick-monitor/component/QuickMonitor.vue'
  49. import ActionShareToWorkmate from '@/views/article/components/ActionShareToWorkmate.vue'
  50. import ActionInBidding from '@/views/article/components/ActionInBidding.vue'
  51. import ActionDownloadReport from '@/views/article/components/ActionDownloadReport.vue'
  52. import { openAppOrWxPage } from '@/utils'
  53. import { LINKS } from '@/data'
  54. export default {
  55. name: 'TabActions',
  56. components: {
  57. ActionShareToWorkmate,
  58. ActionCollection,
  59. QuickMonitor,
  60. ActionInBidding,
  61. ActionDownloadReport
  62. },
  63. props: {
  64. beforeLeavePage: Function,
  65. showMonitor: {
  66. type: Boolean,
  67. default: false
  68. },
  69. // 排序列表,根据key排序
  70. orderList: {
  71. type: Array,
  72. default() {
  73. return []
  74. }
  75. }
  76. },
  77. data() {
  78. return {
  79. tabState: {
  80. inBidding: false
  81. }
  82. }
  83. },
  84. computed: {
  85. ...mapState({
  86. userSimpleInfo: (state) => state.user.userSimpleInfo,
  87. content: (state) => state.article.mainModel.content,
  88. reportBtn: (state) => state.article.reportBtn
  89. }),
  90. id() {
  91. return this.content.id
  92. },
  93. winners() {
  94. const { ent_crn } = this.reportBtn
  95. // 当中标企业有1个以上时,需要根据crn是否有值处理供应商分析报告中标企业名称是否可点击
  96. const arr = this.content?._summary?.winners || []
  97. if (arr.length > 0) {
  98. const formatArr = arr.map((v) => {
  99. return {
  100. ...v,
  101. valid:
  102. ent_crn && Object.keys(ent_crn).length > 0
  103. ? ent_crn[v.name]
  104. : false
  105. }
  106. })
  107. return formatArr
  108. } else {
  109. return arr
  110. }
  111. },
  112. buyers() {
  113. return this.content?._summary.buyers || []
  114. },
  115. // 是否展示投标企业信用报告
  116. showCreditReport() {
  117. return ['采购意向', '预告', '招标'].includes(
  118. this.content?._ob?.topType || this.content?._ob?.subType || ''
  119. )
  120. },
  121. showDownloadReportBtn() {
  122. const info = this.reportBtn
  123. return (
  124. info.buyer_report_button ||
  125. info.ent_report_button ||
  126. info.project_report_button
  127. )
  128. },
  129. projectName() {
  130. return this.content?.projectName
  131. }
  132. },
  133. created() {},
  134. methods: {
  135. ...mapMutations('article', ['setOtherModelChild']),
  136. removeHideUnderline() {
  137. this.setOtherModelChild({
  138. key: 'hasProject',
  139. data: true
  140. })
  141. // 移除下划线
  142. this.setOtherModelChild({
  143. key: 'forecastShow',
  144. data: true
  145. })
  146. },
  147. syncLabels({ list }) {
  148. if (Array.isArray(list)) {
  149. this.setOtherModelChild({
  150. key: 'collectionTags',
  151. data: list
  152. })
  153. }
  154. },
  155. showForecast() {},
  156. afterMonitorFetch(payload) {
  157. // console.log(payload)
  158. this.setOtherModelChild({
  159. key: 'projectFollowState',
  160. data: payload
  161. })
  162. if (payload.model && payload.model.canFollow) {
  163. this.showForecast()
  164. this.removeHideUnderline()
  165. }
  166. },
  167. biddingStatusChange(i) {
  168. const userName = i.userName || ''
  169. const userNameList = userName.split(',').filter((i) => i)
  170. this.setOtherModelChild({
  171. key: 'inBiddingPersonList',
  172. data: userNameList
  173. })
  174. },
  175. toBindPhonePage() {
  176. openAppOrWxPage(LINKS.绑定手机号, {
  177. query: {
  178. mode: 'mergeBind'
  179. }
  180. })
  181. },
  182. // mp标记短信邀请进入的详情页,需要判断手机号是否绑定
  183. beforeActionBindPhoneCheck() {
  184. const query = this.$route.query
  185. if (query.mp) {
  186. const { phone } = this.userSimpleInfo
  187. if (phone) {
  188. return true
  189. } else {
  190. this.toBindPhonePage()
  191. return false
  192. }
  193. } else {
  194. return true
  195. }
  196. },
  197. beforeShareToWorkMateAction() {
  198. const { phone, expBinding } = this.userSimpleInfo
  199. if (phone || expBinding === 1) {
  200. return true
  201. } else {
  202. this.toBindPhonePage()
  203. return false
  204. }
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="scss" scoped>
  210. $height: 48px;
  211. ::v-deep {
  212. .action-text {
  213. font-size: 10px;
  214. line-height: 16px;
  215. }
  216. }
  217. .tab-actions {
  218. position: relative;
  219. display: flex;
  220. align-items: center;
  221. justify-content: space-between;
  222. box-shadow: 0px -2px 8px 0px rgba(54, 147, 179, 0.05);
  223. border-top: 1px solid $border_color_3;
  224. z-index: 2002;
  225. ::v-deep {
  226. .tab-action-item {
  227. height: $height;
  228. }
  229. }
  230. }
  231. .tab-action {
  232. flex: 1;
  233. height: $height;
  234. }
  235. </style>