index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="zxbox">
  3. <view class="zxtop">
  4. <view class="navbox">
  5. <uni-nav-bar color="#ffffff" leftWidth='110rpx' rightWidth="48rpx" :background-color="backgroundColor" :border="false" statusBar='true'>
  6. <block slot="left">
  7. <view class="topl flexc">
  8. <view class="over">客户</view>
  9. </view>
  10. </block>
  11. <view class="topc flexc">
  12. <image :src="secimg"></image>
  13. <input placeholder="输入关键字进行查询" confirm-type="search" v-model="usename" @confirm="getConfirm"/>
  14. </view>
  15. <block slot="right">
  16. <view class="topr" @click='getNoticeFn'>
  17. <image :src="noticeimg"></image>
  18. <view class="cir">99+</view>
  19. <!-- <block v-if="noticenum>99">99+</block>
  20. <block v-else>{{noticenum}}</block> -->
  21. </view>
  22. </block>
  23. </uni-nav-bar>
  24. </view>
  25. <image :src="bgimg" class="bgimg"></image>
  26. <view class="zxmain" :style="'margin-top:-'+marTop+'rpx;'">
  27. <!-- list -->
  28. <bus-list :datalist="list" :wtdt="wtdt" :type="type" @getDetail="getDetail"></bus-list>
  29. </view>
  30. </view>
  31. <footers v-if="isfootflag" :footerindex="footerindex" :isHomeIndex="true"></footers>
  32. </view>
  33. </template>
  34. <script>
  35. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  36. let { calendar } = require("@/components/lunc-calendar/calendar.js");
  37. import {getIdCardList,} from "@/api/mine/card.js"
  38. import {getDictionaryFn} from "@/api/mine/register.js"
  39. import busList from "@/work/components/business/list.vue"
  40. import footers from '@/components/footer/footer.vue'
  41. export default {
  42. components:{footers,busList},
  43. data(){
  44. return{
  45. footerindex:'custom',
  46. isfootflag:true,
  47. backgroundColor:'transparent',
  48. bgimg:require("@/static/images/bg.png"),
  49. noticeimg:require("@/static/images/home/notice.png"),
  50. secimg:require("@/static/images/home/search.png"),
  51. list:[{idCard:'34282419730618003X',realName:'林振宇',userId:'1'},{idCard:'34282419730618003X',realName:'何芸芸'},
  52. ],
  53. pageSize: 10,
  54. pageNum: 1,
  55. reachflag: true,
  56. wtdt:'加载更多',
  57. nvaHeight:44,
  58. marTop:0,//距离顶部的距离
  59. stubarHeight:0,//
  60. scroflag:false,
  61. type:'custom',
  62. usename:'',
  63. }
  64. },
  65. onPageScroll(e) {
  66. var scrollTop = Number(e.scrollTop);
  67. // var listTop=Number(this.listTop)-Number(this.nvaHeight)
  68. if (scrollTop <=this.nvaHeight) {
  69. const opacity = scrollTop / 100 // 计算透明度值
  70. const color = `rgba(4, 145, 253, ${opacity})`
  71. this.backgroundColor = color // 更新盒子背景颜色
  72. } else {
  73. this.backgroundColor = '#00A9F0'
  74. }
  75. },
  76. onUnload() {
  77. uni.$off('refreshdatalist')
  78. },
  79. onLoad: function() {
  80. // uni.$on('refreshdatalist',(e) => {
  81. // this.reachflag=false;
  82. // this.pageNum=1;
  83. // this.list=[];
  84. // this.getDataFn();
  85. // })
  86. // this.init()
  87. // this.getDataFn()
  88. uni.getSystemInfo({
  89. success: (e) => {
  90. this.stubarHeight=Number(e.statusBarHeight);
  91. this.nvaHeight = Number(e.statusBarHeight)+44;
  92. }
  93. })
  94. },
  95. onShow() {
  96. },
  97. mounted() {
  98. this.getHeightFn()
  99. },
  100. // 上拉触底加载更多触发事件
  101. onReachBottom() {
  102. if (this.reachflag) {
  103. this.pageNum++
  104. this.getDataFn()
  105. }
  106. },
  107. methods:{
  108. checkPermi, checkRole,
  109. getConfirm(){
  110. this.getrefreshData()
  111. },
  112. getNoticeFn(){
  113. this.$tab.navigateTo("/pages/index/notice")
  114. },
  115. getrefreshData(){
  116. this.pageNum=1;
  117. this.list=[];
  118. this.reachflag=true;
  119. this.getDataFn()
  120. },
  121. getHeightFn(){
  122. let query = uni.createSelectorQuery().in(this);
  123. //需要给黄色区域设置一个id标识,在这里是demo
  124. query.select('.navbox').boundingClientRect(data => {
  125. var top=data.top<0 ? -data.top : data.top;
  126. var stubarHeight=Number(this.stubarHeight);
  127. this.marTop =stubarHeight > 0?420 - Number(data.height)*2 : 420 - Number(data.height)*2 + 40 //赋值,待会要用
  128. if (top <=this.nvaHeight) {
  129. const opacity = top / 100 // 计算透明度值
  130. const color = `rgba(4, 145, 253, ${opacity})`
  131. this.backgroundColor = color // 更新盒子背景颜色
  132. } else {
  133. this.backgroundColor = '#00A9F0'
  134. }
  135. }).exec();
  136. },
  137. init(){
  138. // 记录来源
  139. getDictionaryFn('jluly').then(res=>{
  140. if(res.code==200){
  141. this.adrlist = res.data.map(v => {
  142. return {
  143. lLabel: v.dictLabel,
  144. value: v.dictValue
  145. }
  146. })
  147. }
  148. })
  149. },
  150. getDetail(e){
  151. this.$tab.navigateTo("/work/pages/custom/details?id="+e)
  152. },
  153. getDataFn(){
  154. var params={
  155. pageSize:this.pageSize,
  156. pageNum: this.pageNum,
  157. }
  158. if(this.usename){
  159. params.realName=this.usename
  160. }
  161. getIdCardList(params).then(res=>{
  162. if(res.code==200){
  163. if (res.rows.length < this.pageSize) {
  164. this.reachflag = false
  165. this.wtdt = '到底了~';
  166. } else {
  167. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  168. if (num < res.total) {
  169. this.reachflag = true
  170. this.wtdt = '上拉加载更多'
  171. } else {
  172. this.reachflag = false
  173. this.wtdt = '到底了~';
  174. }
  175. }
  176. if (this.pageNum == 1) {
  177. this.list = res.rows;
  178. } else {
  179. this.list = this.list.concat(res.rows)
  180. }
  181. }else{
  182. this.$toast(res.msg)
  183. }
  184. })
  185. },
  186. },
  187. }
  188. </script>
  189. <style lang="scss" scoped>
  190. page{background-color: #f6f6f6;}
  191. .navbox /deep/ .uni-navbar__header-container {align-items: center;padding-left: 0;}
  192. .navbox /deep/ uni-picker{flex: 1;}
  193. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4;
  194. .topl{padding-left: 16rpx;overflow: hidden;
  195. image{width: 30rpx;height: 38rpx;margin-right: 18rpx;flex: 0 0 auto;}
  196. view{font-weight: bold;font-size: 30rpx;color: #FFFFFF;}
  197. }
  198. .topc{border-radius: 34rpx;height:68rpx;box-sizing: border-box;padding:0 32rpx 0 32rpx ;position: relative;flex:1;background-color: #FFFFFF;
  199. input{font-weight: 500;font-size: 26rpx;color: #222327;}
  200. image{width: 30rpx;height: 30rpx;margin-right: 24rpx;}
  201. }
  202. .topr{width: 48rpx;height: 38rpx;position: relative;margin-right: 10rpx;
  203. image{width: 32rpx;height: 38rpx;margin: 0 auto;}
  204. .cir{background: #FF4747;font-size: 14rpx;color: #FFFFFF;border-radius: 50%;border: 2rpx solid #FFFFFF;min-width: 20rpx;height: 20rpx;
  205. position: absolute;right: -5rpx;top: -5rpx;text-align: center;line-height: 16rpx;
  206. }
  207. // .cir{width: 14rpx;height: 14rpx;background: #DF0024;border-radius: 50%;position: absolute;right: -7rpx;top: -7rpx;}
  208. }
  209. }
  210. .zxbox{
  211. .bgimg{width: 100%;height: 420rpx;}
  212. .zxmain{position: relative;padding: 48rpx 36rpx 0;
  213. }
  214. }
  215. </style>