index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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:[],
  52. pageSize: 10,
  53. pageNum: 1,
  54. reachflag: true,
  55. wtdt:'加载更多',
  56. nvaHeight:44,
  57. marTop:0,//距离顶部的距离
  58. stubarHeight:0,//
  59. scroflag:false,
  60. type:'custom',
  61. usename:'',
  62. }
  63. },
  64. onPageScroll(e) {
  65. var scrollTop = Number(e.scrollTop);
  66. // var listTop=Number(this.listTop)-Number(this.nvaHeight)
  67. if (scrollTop <=this.nvaHeight) {
  68. const opacity = scrollTop / 100 // 计算透明度值
  69. const color = `rgba(4, 145, 253, ${opacity})`
  70. this.backgroundColor = color // 更新盒子背景颜色
  71. } else {
  72. this.backgroundColor = '#00A9F0'
  73. }
  74. },
  75. onUnload() {
  76. uni.$off('refreshdatalist')
  77. },
  78. onLoad: function() {
  79. // uni.$on('refreshdatalist',(e) => {
  80. // this.reachflag=false;
  81. // this.pageNum=1;
  82. // this.list=[];
  83. // this.getDataFn();
  84. // })
  85. // this.init()
  86. this.getDataFn()
  87. uni.getSystemInfo({
  88. success: (e) => {
  89. this.stubarHeight=Number(e.statusBarHeight);
  90. this.nvaHeight = Number(e.statusBarHeight)+44;
  91. }
  92. })
  93. },
  94. onShow() {
  95. },
  96. mounted() {
  97. this.getHeightFn()
  98. },
  99. // 上拉触底加载更多触发事件
  100. onReachBottom() {
  101. if (this.reachflag) {
  102. this.pageNum++
  103. this.getDataFn()
  104. }
  105. },
  106. methods:{
  107. checkPermi, checkRole,
  108. getConfirm(){
  109. this.getrefreshData()
  110. },
  111. getNoticeFn(){
  112. this.$tab.navigateTo("/pages/index/notice")
  113. },
  114. getrefreshData(){
  115. this.pageNum=1;
  116. this.list=[];
  117. this.reachflag=true;
  118. this.getDataFn()
  119. },
  120. getHeightFn(){
  121. let query = uni.createSelectorQuery().in(this);
  122. //需要给黄色区域设置一个id标识,在这里是demo
  123. query.select('.navbox').boundingClientRect(data => {
  124. var top=data.top<0 ? -data.top : data.top;
  125. var stubarHeight=Number(this.stubarHeight);
  126. this.marTop =stubarHeight > 0?420 - Number(data.height)*2 : 420 - Number(data.height)*2 + 40 //赋值,待会要用
  127. if (top <=this.nvaHeight) {
  128. const opacity = top / 100 // 计算透明度值
  129. const color = `rgba(4, 145, 253, ${opacity})`
  130. this.backgroundColor = color // 更新盒子背景颜色
  131. } else {
  132. this.backgroundColor = '#00A9F0'
  133. }
  134. }).exec();
  135. },
  136. init(){
  137. // 记录来源
  138. getDictionaryFn('jluly').then(res=>{
  139. if(res.code==200){
  140. this.adrlist = res.data.map(v => {
  141. return {
  142. lLabel: v.dictLabel,
  143. value: v.dictValue
  144. }
  145. })
  146. }
  147. })
  148. },
  149. getDetail(e){
  150. this.$tab.navigateTo("/work/pages/custom/details?id="+e)
  151. },
  152. getDataFn(){
  153. var params={
  154. pageSize:this.pageSize,
  155. pageNum: this.pageNum,
  156. }
  157. if(this.usename){
  158. params.realName=this.usename
  159. }
  160. getIdCardList(params).then(res=>{
  161. if(res.code==200){
  162. if (res.rows.length < this.pageSize) {
  163. this.reachflag = false
  164. this.wtdt = '到底了~';
  165. } else {
  166. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  167. if (num < res.total) {
  168. this.reachflag = true
  169. this.wtdt = '上拉加载更多'
  170. } else {
  171. this.reachflag = false
  172. this.wtdt = '到底了~';
  173. }
  174. }
  175. if (this.pageNum == 1) {
  176. this.list = res.rows;
  177. } else {
  178. this.list = this.list.concat(res.rows)
  179. }
  180. }else{
  181. this.$toast(res.msg)
  182. }
  183. })
  184. },
  185. },
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. page{background-color: #f6f6f6;}
  190. .navbox /deep/ .uni-navbar__header-container {align-items: center;padding-left: 0;}
  191. .navbox /deep/ uni-picker{flex: 1;}
  192. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4;
  193. .topl{padding-left: 16rpx;overflow: hidden;
  194. image{width: 30rpx;height: 38rpx;margin-right: 18rpx;flex: 0 0 auto;}
  195. view{font-weight: bold;font-size: 30rpx;color: #FFFFFF;}
  196. }
  197. .topc{border-radius: 34rpx;height:68rpx;box-sizing: border-box;padding:0 32rpx 0 32rpx ;position: relative;flex:1;background-color: #FFFFFF;
  198. input{font-weight: 500;font-size: 26rpx;color: #222327;}
  199. image{width: 30rpx;height: 30rpx;margin-right: 24rpx;}
  200. }
  201. .topr{width: 48rpx;height: 38rpx;position: relative;margin-right: 10rpx;
  202. image{width: 32rpx;height: 38rpx;margin: 0 auto;}
  203. .cir{background: #FF4747;font-size: 14rpx;color: #FFFFFF;border-radius: 50%;border: 2rpx solid #FFFFFF;min-width: 20rpx;height: 20rpx;
  204. position: absolute;right: -5rpx;top: -5rpx;text-align: center;line-height: 16rpx;
  205. }
  206. // .cir{width: 14rpx;height: 14rpx;background: #DF0024;border-radius: 50%;position: absolute;right: -7rpx;top: -7rpx;}
  207. }
  208. }
  209. .zxbox{
  210. .bgimg{width: 100%;height: 420rpx;}
  211. .zxmain{position: relative;padding: 48rpx 36rpx 0;
  212. }
  213. }
  214. </style>