index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view>
  3. <view class="navbox">
  4. <uni-nav-bar color="#ffffff" leftWidth='340rpx' :background-color="backgroundColor" :border="false" statusBar='true' fixed="true">
  5. <block slot="left">
  6. <view class="navleft">
  7. <view>{{city}} {{daytime}}</view>
  8. <view>农历{{lunar}}</view>
  9. </view>
  10. </block>
  11. <block slot="right">
  12. <view class="topr flexccc" v-if="weather">
  13. <image :src="weathericon" class="navright"></image>
  14. <view class="f12 cof">{{weather}} {{temperature}}­°C</view>
  15. </view>
  16. </block>
  17. </uni-nav-bar>
  18. </view>
  19. <!-- 主体 -->
  20. <image :src="navbg" class="navbg"></image>
  21. <view class="yymain" :style="'margin-top:-'+marTop+'rpx;'">
  22. <view class="yycard">
  23. <view class="top flexccc">
  24. <image :src="headimg"></image>
  25. <view>欢迎您,尊敬的管理员!</view>
  26. </view>
  27. <view class="flexcc">
  28. <view class="list">
  29. <view class="tit">613</view>
  30. <view class="txt">来访数(位)</view>
  31. </view>
  32. <view class="list">
  33. <view class="tit">246</view>
  34. <view class="txt">本月预约(位)</view>
  35. </view>
  36. <view class="list">
  37. <view class="tit">613</view>
  38. <view class="txt">今日来访(位)</view>
  39. </view>
  40. <view class="list">
  41. <view class="tit">613</view>
  42. <view class="txt">今日预约(位)</view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="yylists">
  47. <view class="yyltab flexcj">
  48. <view class="left flexc">待审批列表<image :src="listline"></image></view>
  49. <view class="right" @click="getMoreFn">查看更多 >></view>
  50. </view>
  51. <!-- 列表 -->
  52. <view>
  53. <y-list type='order' :datalist="list" :wtdt="wtdt" @getDetail='getDetail' :adrlist="adrlist" @getDelFn="getDelFn" @gettypeFn="gettypeFn"></y-list>
  54. </view>
  55. </view>
  56. </view>
  57. <footers v-if="isfootflag" :footerindex="footerindex"></footers>
  58. </view>
  59. </template>
  60. <script>
  61. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  62. import self from '@/utils/location.js';
  63. import yList from "@/components/order/list.vue"
  64. let { calendar } = require("@/components/lunc-calendar/calendar.js");
  65. import {getReservatcountl,getReservatList,getReservatDel,getReservatSh} from "@/api/mine/order.js"
  66. import {getDictionaryFn} from "@/api/mine/register.js"
  67. import footers from '@/components/footer/footer.vue'
  68. export default {
  69. components:{yList,footers},
  70. data(){
  71. return{
  72. footerindex:'home',
  73. isfootflag:true,
  74. navbg:require("@/static/images/navbg.png"),
  75. headimg:require("@/static/images/order/staff/head.png"),
  76. listline:require("@/static/images/order/staff/listline.png"),
  77. backgroundColor: "transparent",
  78. city:'',
  79. weather:'',
  80. temperature:'',
  81. list:[],
  82. adrlist:[],
  83. pageSize: 10,
  84. pageNum: 1,
  85. reachflag: false,
  86. nvaHeight:44,
  87. marTop:0,//距离顶部的距离
  88. stubarHeight:0,//
  89. wtdt:'',
  90. daytime:'',
  91. lunar:'',
  92. weathericon:require("@/static/images/weather/weaionf.png"),
  93. }
  94. },
  95. onPageScroll(e) {
  96. var scrollTop = Number(e.scrollTop);
  97. if (scrollTop > 0) {
  98. this.backgroundColor = '#0491FD'
  99. } else {
  100. this.backgroundColor = 'transparent'
  101. }
  102. },
  103. onUnload() {
  104. uni.$off('refreshdatalist')
  105. },
  106. onLoad: function() {
  107. uni.$on('refreshdatalist',(e) => {
  108. this.reachflag=false;
  109. this.pageNum=1;
  110. this.list=[];
  111. this.getDataFn();
  112. // this.getcount();
  113. })
  114. this.init()
  115. // this.getcount()
  116. this.getDataFn()
  117. uni.getSystemInfo({
  118. success: (e) => {
  119. this.stubarHeight=Number(e.statusBarHeight);
  120. this.nvaHeight = Number(e.statusBarHeight)+44;
  121. this.marTop=692-Number(this.nvaHeight*2)-16;
  122. }
  123. })
  124. },
  125. mounted() {
  126. this.getHeightFn()
  127. },
  128. onShow() {
  129. var that=this;
  130. this.time();
  131. // #ifndef H5
  132. self.getLocation(function(res){
  133. if(res==-1){
  134. that.setflag=true
  135. }else{
  136. // that.getAdrinfoFn(res)
  137. // that.location = `${res.lng},${res.lat}`
  138. that.city=res.city;
  139. that.temperature=res.temperature;
  140. that.weather=res.weather;
  141. that.weathericon=res.icon;
  142. }
  143. })
  144. // #endif
  145. },
  146. mounted() {
  147. },
  148. // 上拉触底加载更多触发事件
  149. onReachBottom() {
  150. if (this.reachflag) {
  151. this.pageNum++
  152. this.getDataFn()
  153. }
  154. },
  155. methods:{
  156. checkPermi, checkRole,
  157. getHeightFn(){
  158. let query = uni.createSelectorQuery().in(this);
  159. //需要给黄色区域设置一个id标识,在这里是demo
  160. query.select('.navbox').boundingClientRect(data => {
  161. var top=data.top<0 ? -data.top : data.top;
  162. var stubarHeight=Number(this.stubarHeight);
  163. if (top <=this.nvaHeight) {
  164. const opacity = top / 100 // 计算透明度值
  165. const color = `rgba(4, 145, 253, ${opacity})`
  166. this.backgroundColor = color // 更新盒子背景颜色
  167. } else {
  168. this.backgroundColor = '#00A9F0'
  169. }
  170. if(top>2){
  171. this.scroflag=true
  172. }else{
  173. this.scroflag=false
  174. }
  175. }).exec();
  176. },
  177. init(){
  178. // 记录来源
  179. getDictionaryFn('jluly').then(res=>{
  180. if(res.code==200){
  181. this.adrlist = res.data.map(v => {
  182. return {
  183. dictLabel: v.dictLabel,
  184. dictValue: Number(v.dictValue)
  185. }
  186. })
  187. }
  188. })
  189. },
  190. getMoreFn(){
  191. this.$tab.navigateTo("/pages/order/list")
  192. },
  193. getDelFn(id){
  194. var that=this;
  195. getReservatDel(id).then(res=>{
  196. if(res.code==200){
  197. that.$toast('删除成功')
  198. setTimeout(function(){
  199. that.reachflag=true;
  200. that.pageNum=1;
  201. that.list=[];
  202. that.getDataFn();
  203. // that.getcount();
  204. },1500)
  205. }else{
  206. that.$toast(res.msg)
  207. }
  208. })
  209. },
  210. gettypeFn(ite){
  211. var that=this;
  212. var params={
  213. reservatId:ite.id,
  214. visitType:ite.type
  215. }
  216. getReservatSh(params).then(res=>{
  217. if(res.code==200){
  218. that.$toast('审核成功')
  219. setTimeout(function(){
  220. that.reachflag=true;
  221. that.pageNum=1;
  222. that.list=[];
  223. that.getDataFn();
  224. // that.getcount();
  225. },1500)
  226. }else{
  227. that.$toast(res.msg)
  228. }
  229. })
  230. },
  231. time() {
  232. var date = new Date();
  233. var y = date.getFullYear();
  234. var m = date.getMonth() + 1;
  235. var d = date.getDate();
  236. let lunar = calendar.solar2lunar(y, m, d); //农历
  237. this.lunar=lunar.IMonthCn+lunar.IDayCn;
  238. this.daytime=m+'月'+d+"日";
  239. // var h = date.getHours();
  240. // var min = date.getMinutes();
  241. // var s = date.getSeconds();
  242. // var week = date.getDay(); //获取当前星期X(0-6,0代表星期天)
  243. // var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  244. // var yearStr = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d)
  245. // var timeStr = (h < 10 ? ('0' + h) : h) + ':' + (min < 10 ? ('0' + min) : min) + ':' + (s < 10 ? (
  246. // '0' + s) : s);
  247. // this.kaTime = yearStr + ' ' + timeStr;
  248. },
  249. getcount(){
  250. getReservatcountl().then(res=>{
  251. if(res.code==200){
  252. this.conuntinfo=res.data
  253. }else{
  254. this.$toast(res.msg)
  255. }
  256. })
  257. },
  258. getDetail(data){
  259. this.$tab.navigateTo('/pages/order/staffcode?type=look&id='+data)
  260. },
  261. getDataFn(){
  262. var params={
  263. pageSize:this.pageSize,
  264. pageNum: this.pageNum,
  265. // visitType:3
  266. }
  267. getReservatList(params).then(res=>{
  268. if(res.code==200){
  269. if (res.rows.length < this.pageSize) {
  270. this.reachflag = false
  271. this.wtdt = '到底了~';
  272. } else {
  273. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  274. if (num < res.total) {
  275. this.reachflag = true
  276. this.wtdt = '上拉加载更多'
  277. } else {
  278. this.reachflag = false
  279. this.wtdt = '到底了~';
  280. }
  281. }
  282. if (this.pageNum == 1) {
  283. this.list = res.rows;
  284. } else {
  285. this.list = this.list.concat(res.rows)
  286. }
  287. }else{
  288. this.$toast(res.msg)
  289. }
  290. })
  291. },
  292. },
  293. }
  294. </script>
  295. <style lang="scss" scoped>
  296. // .navbox{
  297. // .navbg{width: 100%;height: 692rpx;position: fixed;left: 0;right: 0;top: 0;z-index: 1;}
  298. // }
  299. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  300. .navbg{width: 100%;height: 692rpx;}
  301. .navleft{padding-left: 12rpx;
  302. view{font-weight: bold;font-size: 26rpx;color: #FFFFFF;line-height: 36rpx;}
  303. }
  304. .navright{width: 40rpx;height: 40rpx;}
  305. .yymain{flex: 1;z-index: 2;position: relative;}
  306. .yycard{width: 684rpx;height: 306rpx;background: #FFFFFF;border-radius: 14rpx;margin: 0 auto;
  307. .top{
  308. image{width: 132rpx;height: 132rpx;margin-bottom: 12rpx;margin-top: -56rpx;}
  309. view{font-weight: bold;font-size: 30rpx;color: #161616;}
  310. }
  311. .list{text-align: center;flex: 1;padding-top: 44rpx;
  312. .tit{font-weight: bold;font-size: 36rpx;color: #0391FD;margin-bottom: 16rpx;}
  313. .txt{font-weight: bold;font-size: 18rpx;color: #666666;}
  314. }
  315. }
  316. .yylists{width: 684rpx;margin: 42rpx auto 0;
  317. .yyltab{margin-bottom: 28rpx;
  318. .left{font-weight: bold;font-size: 15px;color: #161616;
  319. image{width: 110rpx;height: 14rpx;margin-left: 16rpx;}
  320. }
  321. .right{font-size: 500;font-size: 22rpx;color: #AAAAAA;}
  322. }
  323. }
  324. </style>