seach.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="partner-head">
  3. <view class=" dis j-s" style="border: 1px solid #EEEEEE;padding: 10px;color: #666666;">
  4. <view class="dis ">
  5. <text style="margin-right: 10px;" @click="industryShow = true">{{industryData}}<i></i></text>
  6. <u-select mode="single-column" :list="industryoptions" v-model="industryShow"
  7. label-name="lable" value-name="value"
  8. @confirm="industryopConfirm($event)"></u-select>
  9. <!-- <text v-if="partnerHierarchy" @click="cimodelclassShow = true">{{cimodelclassData}}<i></i></text>
  10. <u-select mode="single-column" :list="vehicleTypeoptions" v-model="cimodelclassShow"
  11. label-name="lable" value-name="value"
  12. @confirm="dictionaryConfirm($event)"></u-select> -->
  13. </view>
  14. <view class="search-data" >
  15. <text v-for="(val,index) in year" :key="index" :class="val.startShow? 'active' :''" @click="onSeachYear(val,index)">{{val.lable}}</text>
  16. </view>
  17. </view>
  18. <view class="sum-insurance dis j-c a-c" v-if="!partnerHierarchy">
  19. <view >
  20. <text>{{directLsit.sumPremium}}</text>
  21. <text>总保费</text>
  22. </view>
  23. <view>
  24. <text>{{directLsit.teamManNum}}</text>
  25. <text>会员总人数</text>
  26. </view>
  27. <view style="border-right:none">
  28. <text>{{directLsit.extractFee}}</text>
  29. <text>我的佣金</text>
  30. </view>
  31. </view>
  32. <my-date-picker ref="datePicker" @confirmPickDate="confirmPickDate" />
  33. </view>
  34. </template>
  35. <script>
  36. import myDatePicker from './date-picker.vue';
  37. export default {
  38. components:{myDatePicker},
  39. props:{
  40. directLsit: {
  41. type: Object,
  42. default() {
  43. return {};
  44. }
  45. },
  46. partnerHierarchy: {
  47. type: Boolean,
  48. default() {
  49. return false;
  50. }
  51. },
  52. },
  53. data() {
  54. return {
  55. cimodelclassData:'合伙人层级',
  56. cimodelclassShow:false,
  57. industryShow:false,
  58. industryData:'行业分类',
  59. startShow:false,
  60. vehicleTypeoptions:[{
  61. lable:'全部合伙人',
  62. value:0
  63. },{
  64. lable:'一级合伙人',
  65. value:1
  66. },{
  67. lable:'二级合伙人',
  68. value:2
  69. },{
  70. lable:'三级合伙人',
  71. value:3
  72. },{
  73. lable:'四级合伙人',
  74. value:4
  75. },{
  76. lable:'五级合伙人',
  77. value:5
  78. },
  79. ],
  80. industryoptions:[{
  81. lable:'全部行业',
  82. value:0
  83. },{
  84. lable:'汽车服务',
  85. value:1
  86. },{
  87. lable:'保险',
  88. value:2
  89. },
  90. ],
  91. year:[{
  92. lable:'日',
  93. startShow:false
  94. },{
  95. lable:'月',
  96. startShow:false
  97. },{
  98. lable:'季',
  99. startShow:false
  100. },{
  101. lable:'年',
  102. startShow:false
  103. },{
  104. lable:'自定义',
  105. startShow:false
  106. }],
  107. }
  108. },
  109. async onLoad(e) {
  110. },
  111. methods: {
  112. dictionaryConfirm(e){
  113. this.cimodelclassData=e[0].label
  114. this.$emit('queryData',{partnerType:e[0].value==0?null:e[0].value})
  115. },
  116. // 行业分类
  117. industryopConfirm(e){
  118. this.industryData=e[0].label
  119. this.$emit('queryData',{industrySector:e[0].value==0?null:e[0].value})
  120. },
  121. onSeachYear(val,index){
  122. this.year.map((value, i) => i === index ? value.startShow=!value.startShow : value.startShow=false);
  123. let now = new Date();
  124. let year = now.getFullYear();
  125. let month = now.getMonth() + 1; // 月份是从0开始的,所以需要加1
  126. let day = now.getDate();
  127. if(index==0 && val.startShow){
  128. let theDay=`${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
  129. this.$emit('queryData',{beginTime:theDay+' 00:00:01' ,endTime:theDay+ ' 23:59:59'})
  130. }
  131. else if(index==1 && val.startShow){
  132. this.$emit('queryData',{beginTime:this.getCurrentMonthFirst()+' 00:00:01' ,endTime:this.getCurrentMonthLast()+ ' 23:59:59'})
  133. }
  134. else if(index==2 && val.startShow){
  135. let months = [];
  136. // 获取当前季度的第一个月
  137. let startMonth = month - (month % 3) + 1;
  138. // 获取当前季度的下三个月
  139. for (let i = 0; i < 3; i++) {
  140. months.push(startMonth + i);
  141. }
  142. this.$emit('queryData',{beginTime: year +'-'+ months[0]+'-01 00:00:01' ,endTime: year+'-'+ months[2] + '-31 23:59:59'})
  143. }
  144. else if(index==3 && val.startShow){
  145. this.$emit('queryData',{beginTime:year+'-01-01 00:00:01' ,endTime:year+ '-12-31 23:59:59'})
  146. }
  147. else if(index==4 && val.startShow){
  148. this.$refs.datePicker.open()
  149. }
  150. else{
  151. this.$emit('queryData',{beginTime:'' ,endTime:''})
  152. }
  153. },
  154. getCurrentMonthFirst() {
  155. // 获取当月第一天数据
  156. let date = new Date()
  157. date.setDate(1)
  158. let month = parseInt(date.getMonth() + 1)
  159. let day = date.getDate()
  160. if (month < 10) month = '0' + month
  161. if (day < 10) day = '0' + day
  162. return date.getFullYear() + '-' + month + '-' + day
  163. },
  164. getCurrentMonthLast() {
  165. // 获取当月最后一天数据
  166. let date = new Date()
  167. let year = date.getFullYear()
  168. let month = date.getMonth() + 1
  169. month = month < 10 ? '0' + month : month
  170. let day = new Date(year, month, 0)
  171. return year + '-' + month + '-' + day.getDate()
  172. },
  173. confirmPickDate(dateStr,dateStr1){
  174. if(dateStr){
  175. dateStr+=' 00:00:01'
  176. }
  177. if(dateStr1){
  178. dateStr1+=' 23:59:59'
  179. }
  180. this.$emit('queryData', {beginTime:dateStr ,endTime:dateStr1})
  181. },
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. .partner-head{
  187. background: #FFFFFF;
  188. color: #333333;
  189. font-size: 14px;
  190. i{
  191. margin-left: 2px;
  192. display:inline-block;
  193. width: 0;
  194. height: 0;
  195. border: 4px solid;
  196. border-color: #666666;
  197. border-bottom: 4px solid transparent;
  198. border-right: 4px solid transparent;
  199. border-left: 4px solid transparent;
  200. }
  201. .search-data{
  202. color: #666666;
  203. border: 1px solid #EEEEEE;
  204. .active{
  205. color: #FFFFFF;
  206. background: linear-gradient( 132deg, #2DD9FF 0%, #2D6DFF 100%);
  207. }
  208. text{
  209. padding: 5px 6px;
  210. border-left: 1px solid #EEEEEE;
  211. }
  212. text:first-child{
  213. border-left: none
  214. }
  215. }
  216. }
  217. .sum-insurance{
  218. padding: 10px 0;
  219. view{
  220. text-align: center;
  221. width: 33.33%;
  222. border-right: 1px solid #EEEEEE;
  223. text{
  224. display: block;
  225. }
  226. text:first-child{
  227. font-weight: 600;
  228. font-size: 18px;
  229. color: #333333;
  230. }
  231. text:last-child{
  232. font-size: 10px;
  233. color: #999999;
  234. }
  235. }
  236. }
  237. </style>