salesBriefings.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div class="salesKit box">
  3. <div class="box-title">
  4. <div class="box-title-left text-size-in">销售简报</div>
  5. <div class="box-title-right text-size-small" @click="showPopUpLayer()">
  6. {{ scopeText }}/{{ dateText }}
  7. <van-icon name="play" class="ml-2 rotate-90" color="#747474" />
  8. </div>
  9. </div>
  10. <div class="content overflow-hidden transitionEffect"
  11. :style="`height: ${expandAndCollapse ? usePxToVwView(user.company.isSimple == 1 ? 180 : 298) : '0'}`">
  12. <div class="flex items-center w-full" >
  13. <div class="item">
  14. <img src="/src/assets/image/salesKitkehu.png" class="item-img" />
  15. <div class="flex flex-col justify-center text=[#999999]">
  16. <div>新增客户</div>
  17. <div class="flex items-end">
  18. <span class="text-[#3C84F3] text-size-in font-bold mr-1">
  19. {{ salesBriefings?.custom?.customCount || 0 }}
  20. </span>人
  21. </div>
  22. </div>
  23. </div>
  24. <div class="item" v-if="user.company.isSimple != 1">
  25. <img src="/src/assets/image/salesKitlianxir.png" class="item-img" />
  26. <div class="flex flex-col justify-center text=[#999999]">
  27. <div>新增联系人</div>
  28. <div class="flex items-end">
  29. <span class="text-[#42DC9E] text-size-in font-bold mr-1">
  30. {{ salesBriefings?.contacts?.contactsCount || 0 }}
  31. </span>人
  32. </div>
  33. </div>
  34. </div>
  35. <div class="item" v-if="user.company.isSimple == 1">
  36. <img src="/src/assets/image/salesKitlishi.png" class="item-img" />
  37. <div class="flex flex-col justify-center text=[#999999]">
  38. <div>新增{{ businessLabel }}</div>
  39. <div class="flex items-end">
  40. <span class="text-[#F3893C] text-size-in font-bold mr-1">
  41. {{ salesBriefings?.businessOpportunity?.businessOpportunityCount || 0 }}
  42. </span>个
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="flex items-center w-full" v-if="user.company.isSimple != 1">
  48. <div class="item">
  49. <img src="/src/assets/image/salesKitlishi.png" class="item-img" />
  50. <div class="flex flex-col justify-center text=[#999999]">
  51. <div>新增{{ businessLabel }}</div>
  52. <div class="flex items-end">
  53. <span class="text-[#F3893C] text-size-in font-bold mr-1">
  54. {{ salesBriefings?.businessOpportunity?.businessOpportunityCount || 0 }}
  55. </span>个
  56. </div>
  57. </div>
  58. </div>
  59. <div class="item">
  60. <img src="/src/assets/image/salesKitdingdan.png" class="item-img" />
  61. <div class="flex flex-col justify-center text=[#999999]">
  62. <div>新增销售订单</div>
  63. <div class="flex items-end">
  64. <span class="text-[#A66AFF] text-size-in font-bold mr-1">
  65. {{ salesBriefings?.salesOrder?.salesOrderCount || 0 }}
  66. </span>个
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="flex items-center w-full">
  72. <div class="item" v-if="user.company.isSimple != 1">
  73. <img src="/src/assets/image/salesKitjer.png" class="item-img" />
  74. <div class="flex flex-col justify-center text=[#999999]">
  75. <div>销售订单金额</div>
  76. <div class="flex items-end">
  77. <span class="text-[#67DF2A] text-size-in font-bold mr-1">
  78. {{ salesBriefings?.salesOrdersPrice?.salesOrdersPrice || 0 }}
  79. </span>元
  80. </div>
  81. </div>
  82. </div>
  83. <div class="item">
  84. <img src="/src/assets/image/salesKitshangji.png" class="item-img" />
  85. <div class="flex flex-col justify-center text=[#999999]">
  86. <div>{{ businessLabel }}金额</div>
  87. <div class="flex items-end">
  88. <span class="text-[#EED116] text-size-in font-bold mr-1">
  89. {{ salesBriefings?.businessOpportunityPrice?.businessOpportunityPrice || 0 }}
  90. </span>元
  91. </div>
  92. </div>
  93. </div>
  94. <div class="item" v-if="user.company.isSimple == 1">
  95. <img src="/src/assets/image/salesKitxianshuo.png" class="item-img" />
  96. <div class="flex flex-col justify-center text=[#999999]">
  97. <div>新增线索</div>
  98. <div class="flex items-end">
  99. <span class="text-[#F44873] text-size-in font-bold mr-1">
  100. {{ salesBriefings?.clue?.clueCount || 0 }}
  101. </span>个
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. <div class="flex items-center w-full" v-if="user.company.isSimple != 1">
  107. <div class="item">
  108. <img src="/src/assets/image/salesKitxianshuo.png" class="item-img" />
  109. <div class="flex flex-col justify-center text=[#999999]">
  110. <div>新增线索</div>
  111. <div class="flex items-end">
  112. <span class="text-[#F44873] text-size-in font-bold mr-1">
  113. {{ salesBriefings?.clue?.clueCount || 0 }}
  114. </span>个
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <div class="w-full flex justify-center mt-2" @click="expandAndCollapseSwitch()">
  121. <van-icon name="arrow-up" color="#AFAFAF" :class="`${!expandAndCollapse && 'rotate-180'} transitionEffect`" />
  122. </div>
  123. <van-popup v-model:show="filterCriteriaPopUpLayerFlag" position="bottom" :style="{ height: '100%' }" closeable>
  124. <FilterItem :dataFilters="filterCriteria" @submit="FilterItemSubmit" />
  125. </van-popup>
  126. </div>
  127. </template>
  128. <script setup>
  129. import { ref, computed } from 'vue';
  130. import { useLifecycle } from '@hooks/useCommon.js';
  131. import { GET_SALES_BRIEFINGS } from '@hooks/useApi.js';
  132. import { fixedFieldPermissionOptions, fixedFieldDateOptions } from '@utility/defaultData.js';
  133. import useInfoStore from "@store/useInfoStore.js";
  134. import requests from "@common/requests"
  135. import usePxToVwView from "@hooks/usePxTransform.js";
  136. import FilterItem from './filterItem.vue';
  137. const filterCriteriaPopUpLayerFlag = ref(false);
  138. const expandAndCollapse = ref(true);
  139. const salesBriefings = ref({});
  140. const filterCriteria = ref({
  141. scopeSelection: 0,
  142. dateSelection: 0,
  143. customTime: []
  144. })
  145. const useInfo = useInfoStore()
  146. const user = useInfo.userInfo
  147. const isExistBusiness = sessionStorage.getItem("isExistBusiness");
  148. const businessLabel = isExistBusiness === "1" ? "商机" : "项目";
  149. const scopeText = computed(() => {
  150. return fixedFieldPermissionOptions[filterCriteria.value.scopeSelection].label
  151. })
  152. const dateText = computed(() => {
  153. if(filterCriteria.value.dateSelection == -1) {
  154. const { customTime = [] } = filterCriteria.value
  155. return ` ${customTime[0]} 至 ${customTime[1]}`
  156. }
  157. return fixedFieldDateOptions[filterCriteria.value.dateSelection].label
  158. })
  159. function FilterItemSubmit(val) {
  160. filterCriteria.value = val
  161. filterCriteriaPopUpLayerFlag.value = false;
  162. getData()
  163. }
  164. function expandAndCollapseSwitch() {
  165. expandAndCollapse.value = !expandAndCollapse.value;
  166. }
  167. function showPopUpLayer() {
  168. filterCriteriaPopUpLayerFlag.value = true;
  169. }
  170. function getData() {
  171. const { scopeSelection = 0, dateSelection = 0, customTime = [] } = filterCriteria.value
  172. const formVal = {
  173. queryType: scopeSelection,
  174. ...(dateSelection !== -1 ? { dateType: dateSelection } : { startDate: customTime[0], endDate: customTime[1] })
  175. }
  176. requests.post(GET_SALES_BRIEFINGS, {
  177. ...formVal
  178. }).then((res) => {
  179. salesBriefings.value = res.data
  180. })
  181. }
  182. useLifecycle({
  183. load: () => {
  184. getData()
  185. },
  186. init: () => {
  187. getData()
  188. }
  189. });
  190. </script>
  191. <style lang='scss' scoped>
  192. /* 样式代码 */
  193. </style>