seach.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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(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(index){
  122. this.year.map(i=>i.startShow=false)
  123. this.year[index].startShow=true
  124. let now = new Date();
  125. let year = now.getFullYear();
  126. let month = now.getMonth() + 1; // 月份是从0开始的,所以需要加1
  127. let day = now.getDate();
  128. if(index==0){
  129. let theDay=`${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
  130. this.$emit('queryData',{beginTime:theDay+' 00:00:01' ,endTime:theDay+ ' 23:59:59'})
  131. }
  132. if(index==1){
  133. this.$emit('queryData',{beginTime:this.getCurrentMonthFirst()+' 00:00:01' ,endTime:this.getCurrentMonthLast()+ ' 23:59:59'})
  134. }
  135. if(index==2){
  136. let months = [];
  137. // 获取当前季度的第一个月
  138. let startMonth = month - (month % 3) + 1;
  139. // 获取当前季度的下三个月
  140. for (let i = 0; i < 3; i++) {
  141. months.push(startMonth + i);
  142. }
  143. this.$emit('queryData',{beginTime: year +'-'+ months[0]+'-01 00:00:01' ,endTime: year+'-'+ months[2] + '-31 23:59:59'})
  144. }
  145. if(index==3){
  146. this.$emit('queryData',{beginTime:year+'-01-01 00:00:01' ,endTime:year+ '-12-31 23:59:59'})
  147. }
  148. if(index==4){
  149. this.$refs.datePicker.open()
  150. }
  151. // switch (index) {
  152. // case 0:
  153. // console.log(month,111111111)
  154. // let theDay=`${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
  155. // this.$emit('queryData',{beginTime:theDay+' 00:00:01' ,endTime:theDay+ ' 23:59:59'})
  156. // break;
  157. // case 1:
  158. // this.$emit('queryData',this.getCurrentMonthFirst()+' 00:00:01' ,this.getCurrentMonthLast()+ ' 23:59:59')
  159. // break;
  160. // case 2:
  161. // // let months = [];
  162. // // // 获取当前季度的第一个月
  163. // // let startMonth = month - (month % 3) + 1;
  164. // // // 获取当前季度的下三个月
  165. // // for (let i = 0; i < 3; i++) {
  166. // // months.push(startMonth + i);
  167. // // }
  168. // const month = now.getMonth();
  169. // const quarter = Math.floor(month / 3) + 1;
  170. // const firstMonthDay = new Date(year, quarter - 1 * 3, 1);
  171. // const lastMonthDay = new Date(year, quarter * 3, 0);
  172. // // const firstMonthFirstDay = firstMonthDay.toISOString().split('T')[0];
  173. // // const lastMonthLastDay = lastMonthDay.toISOString().split('T')[0];
  174. // console.log(firstMonthDay,lastMonthDay,1111111)
  175. // break;
  176. // case 3:
  177. // this.$emit('queryData',year+'-01-01 00:00:01' ,year+ '-12-31 23:59:59')
  178. // break;
  179. // case 4:
  180. // this.$refs.datePicker.open()
  181. // break;
  182. // default:
  183. // }
  184. },
  185. getCurrentMonthFirst() {
  186. // 获取当月第一天数据
  187. let date = new Date()
  188. date.setDate(1)
  189. let month = parseInt(date.getMonth() + 1)
  190. let day = date.getDate()
  191. if (month < 10) month = '0' + month
  192. if (day < 10) day = '0' + day
  193. return date.getFullYear() + '-' + month + '-' + day
  194. },
  195. getCurrentMonthLast() {
  196. // 获取当月最后一天数据
  197. let date = new Date()
  198. let year = date.getFullYear()
  199. let month = date.getMonth() + 1
  200. month = month < 10 ? '0' + month : month
  201. let day = new Date(year, month, 0)
  202. return year + '-' + month + '-' + day.getDate()
  203. },
  204. confirmPickDate(dateStr,dateStr1){
  205. if(dateStr){
  206. dateStr+=' 00:00:01'
  207. }
  208. if(dateStr1){
  209. dateStr1+=' 23:59:59'
  210. }
  211. console.log(dateStr ,dateStr1,1111)
  212. this.$emit('queryData', {dateStr ,dateStr1})
  213. },
  214. }
  215. }
  216. </script>
  217. <style lang="scss" scoped>
  218. .partner-head{
  219. background: #FFFFFF;
  220. color: #333333;
  221. font-size: 14px;
  222. i{
  223. margin-left: 2px;
  224. display:inline-block;
  225. width: 0;
  226. height: 0;
  227. border: 4px solid;
  228. border-color: #666666;
  229. border-bottom: 4px solid transparent;
  230. border-right: 4px solid transparent;
  231. border-left: 4px solid transparent;
  232. }
  233. .search-data{
  234. color: #666666;
  235. border: 1px solid #EEEEEE;
  236. .active{
  237. color: #FFFFFF;
  238. background: linear-gradient( 132deg, #2DD9FF 0%, #2D6DFF 100%);
  239. }
  240. text{
  241. padding: 5px 6px;
  242. border-left: 1px solid #EEEEEE;
  243. }
  244. text:first-child{
  245. border-left: none
  246. }
  247. }
  248. }
  249. .sum-insurance{
  250. padding: 10px 0;
  251. view{
  252. text-align: center;
  253. width: 33.33%;
  254. border-right: 1px solid #EEEEEE;
  255. text{
  256. display: block;
  257. }
  258. text:first-child{
  259. font-weight: 600;
  260. font-size: 18px;
  261. color: #333333;
  262. }
  263. text:last-child{
  264. font-size: 10px;
  265. color: #999999;
  266. }
  267. }
  268. }
  269. </style>