index.vue 6.7 KB

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