index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <view class="staff" :style="'padding-top:'+statop+'px;'">
  3. <view class="pfixed">
  4. <view class="staff_top flexcj" :style="'padding-top:'+tops+'px;'">
  5. <image :src="titimg" class="topl flex0"></image>
  6. <view class="topr" v-if="city">
  7. <view class="f14 co16 fw flexc lh20">{{city}}<image :src="weathericon" class="weaimg"></image>
  8. </view>
  9. <view class="f12 co16">{{weather}} {{temperature}}­°C</view>
  10. </view>
  11. </view>
  12. <view class="sy_box plr15" :style="topflag?'display: block;':'display: none;'" >
  13. <view class="sy_tit flexcj">
  14. <view class="sy_txt">预约登记信息</view>
  15. <!-- <image :src="rimg" class="sy_rimg"></image> -->
  16. </view>
  17. <!-- tab -->
  18. <view class="tab flexcj">
  19. <view class="list" :class="tabidx==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTab(ite.val)">{{ite.tit}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="staff_box">
  24. <view class="s_count">
  25. <image :src="bgimg" class="bgimg"></image>
  26. <view class="s_counta">
  27. <view class="s_coua flexcj">
  28. <view class="f14 fw cof1 lh20">陵园参观预约统计</view>
  29. <i class="f14 fw cof1">{{kaTime}}</i>
  30. </view>
  31. <view class="flexc s_clist">
  32. <view class="list">
  33. <view class="num">{{conuntinfo.canGuan}}</view>
  34. <view class="tit">参观数(位)</view>
  35. </view>
  36. <view class="list">
  37. <view class="num">{{conuntinfo.yuYue}}</view>
  38. <view class="tit">已预约(位)</view>
  39. </view>
  40. <view class="list">
  41. <view class="num">{{conuntinfo.todayYuYue}}</view>
  42. <view class="tit">今日预约(位)</view>
  43. </view>
  44. <view class="list">
  45. <view class="num">{{conuntinfo.todayCanGuan}}</view>
  46. <view class="tit">今日参观(位)</view>
  47. </view>
  48. </view>
  49. <!-- v-if="checkPermi(['system:reservat:cav'])" -->
  50. <view class="flexcc s_cbtn" @click="getCode" >
  51. <image :src="scanimg" class="scanimg"></image>
  52. 扫码通行
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 预约客户信息 -->
  57. <view class="sy_box" >
  58. <view class="sy_tit flexcj">
  59. <view class="sy_txt">预约登记信息</view>
  60. <!-- <image :src="rimg" class="sy_rimg"></image> -->
  61. </view>
  62. <!-- tab -->
  63. <view class="tab flexcj">
  64. <view class="list" :class="tabidx==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTab(ite.val)">{{ite.tit}}</view>
  65. </view>
  66. </view>
  67. <!-- 列表 -->
  68. <view class="pt8" :style="'min-height: ' + minheight + 'px;'"><y-list :datalist="list" :wtdt="wtdt" :type="type" @getDetail='getDetail'></y-list></view>
  69. </view>
  70. <footers v-if="isfootflag" :footlist="footlist" :footerindex="footerindex" :color_checked="color_checked" :color_nochecked="color_nochecked" :isHomeIndex="true"></footers>
  71. </view>
  72. </template>
  73. <script>
  74. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  75. import self from '@/utils/location.js';
  76. import yList from "@/components/order/list.vue"
  77. import {getReservatcountl,getReservatList,getReservatvav} from "@/api/mine/order.js"
  78. import footers from '@/components/footer/footer.vue'
  79. export default {
  80. components:{yList,footers},
  81. data(){
  82. return{
  83. tops:12,
  84. backgroundColor: "#ffffff",
  85. weather:require("@/static/images/order/staffs/weather.png"),
  86. titimg:require("@/static/images/order/staffs/tit.png"),
  87. bgimg:require("@/static/images/order/staffs/bg.png"),
  88. scanimg:require("@/static/images/order/staffs/scan.png"),
  89. rimg:require("@/static/images/order/staffs/rimg.png"),
  90. footlist:[
  91. {module:'home',title:'首页',icon_checked:require('@/static/images/tabbar/home_.png'),icon_nochecked:require('@/static/images/tabbar/home.png')},
  92. {module:'mine',title:'我的',icon_checked:require('@/static/images/tabbar/mine_.png'),icon_nochecked:require('@/static/images/tabbar/mine.png')},
  93. ],
  94. footerindex:'home',
  95. isfootflag:true,
  96. color_checked :'161616',
  97. color_nochecked :'666666',
  98. statop:48,
  99. dingtop:0,
  100. tabidx:1,
  101. tablist:[{tit:'今天',val:'1'},{tit:'昨天',val:'2'},{tit:'近7天',val:'3'},{tit:'近30天',val:'4'},{tit:'全部',val:'5'}],
  102. pageSize: 10,
  103. pageNum: 1,
  104. reachflag: true,
  105. topflag:false,
  106. wtdt:'',
  107. list:[],
  108. type:'1',
  109. conuntinfo:{},
  110. timefn:'',
  111. kaTime:'',
  112. minheight:0,
  113. city:'',
  114. weather:'',
  115. temperature:'',
  116. weathericon:require("@/static/images/weather/weaionc.png"),
  117. }
  118. },
  119. onLoad: function() {
  120. uni.$on('refreshdatalist',(e) => {
  121. this.reachflag=true;
  122. this.pageNum=1;
  123. this.list=[];
  124. this.getDataFn();
  125. this.getcount();
  126. })
  127. uni.getSystemInfo({
  128. success: (e) => {
  129. this.tops = Number(e.statusBarHeight)+12;
  130. this.statop=this.tops+48;
  131. this.minheight = e.screenHeight - this.statop - 80;
  132. }
  133. })
  134. this.getcount()
  135. this.getDataFn()
  136. },
  137. onUnload() {
  138. uni.$off('refreshdatalist')
  139. clearInterval(this.timefn)
  140. },
  141. onHide() {
  142. clearInterval(this.timefn)
  143. },
  144. onShow() {
  145. clearInterval(this.timefn)
  146. this.gettimeFn();
  147. var that=this;
  148. // #ifndef H5
  149. self.getLocation(function(res){
  150. if(res==-1){
  151. that.setflag=true
  152. }else{
  153. // that.getAdrinfoFn(res)
  154. // that.location = `${res.lng},${res.lat}`
  155. that.city=res.city;
  156. that.temperature=res.temperature;
  157. that.weather=res.weather;
  158. that.weathericon=res.icon;
  159. }
  160. })
  161. // #endif
  162. },
  163. mounted() {
  164. this.ceheiFn()
  165. },
  166. onPageScroll(e) {
  167. let that = this;
  168. if(e.scrollTop >= that.dingtop + 10){
  169. that.topflag = true;
  170. }else{
  171. that.topflag = false;
  172. }
  173. },
  174. // 上拉触底加载更多触发事件
  175. onReachBottom() {
  176. if (this.reachflag) {
  177. this.pageNum++
  178. this.getDataFn()
  179. }
  180. },
  181. methods:{
  182. checkPermi, checkRole,
  183. gettimeFn() {
  184. var that = this;
  185. clearInterval(this.timefn)
  186. that.time();
  187. // var stime = this.shuatime
  188. that.timefn = setInterval(function() {
  189. // if (stime <= 1) {
  190. // that.shuiux()
  191. // stime = that.shuatime
  192. // }
  193. // stime = stime - 1;
  194. that.time();
  195. }, 1000);
  196. },
  197. time() {
  198. var date = new Date();
  199. var y = date.getFullYear();
  200. var m = date.getMonth() + 1;
  201. var d = date.getDate();
  202. var h = date.getHours();
  203. var min = date.getMinutes();
  204. var s = date.getSeconds();
  205. var week = date.getDay(); //获取当前星期X(0-6,0代表星期天)
  206. var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  207. var yearStr = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d)
  208. var timeStr = (h < 10 ? ('0' + h) : h) + ':' + (min < 10 ? ('0' + min) : min) + ':' + (s < 10 ? (
  209. '0' + s) : s);
  210. this.kaTime = yearStr + ' ' + timeStr;
  211. },
  212. getcount(){
  213. getReservatcountl().then(res=>{
  214. if(res.code==200){
  215. this.conuntinfo=res.data
  216. }else{
  217. this.$toast(res.msg)
  218. }
  219. })
  220. },
  221. getTab(e){
  222. this.tabidx=e;
  223. this.reachflag=false;
  224. this.pageNum=1;
  225. this.list=[];
  226. this.totopFn();
  227. this.getDataFn();
  228. },
  229. ceheiFn(){
  230. var that = this;
  231. let cehei = uni.createSelectorQuery().in(this);
  232. cehei.select(".s_count").boundingClientRect(function(res){
  233. that.dingtop = res.height;
  234. }).exec();
  235. },
  236. getDetail(data){
  237. this.$tab.navigateTo('/pages/order/staffcode?type=look&id='+data)
  238. },
  239. getCode(){
  240. var that = this;
  241. uni.scanCode({
  242. onlyFromCamera: true,
  243. autoZoom:false,
  244. scanType: ['qrCode'],
  245. success: function(red) {
  246. let result = red.result;
  247. if (typeof result == 'string') {
  248. try {
  249. } catch (e) {
  250. uni.navigateBack({
  251. delta: 1
  252. })
  253. uni.showToast({
  254. title: '扫码查询失败,请检查二维码是否正确',
  255. icon: "none"
  256. })
  257. return
  258. }
  259. }
  260. var id = red.result
  261. var params = {
  262. "reservatId": id,
  263. }
  264. getReservatvav(params).then(res => {
  265. if (res.code == 200) {
  266. if(res.msg=='核销失败'){
  267. that.$tab.navigateTo('/pages/order/stafffail')
  268. }else{
  269. uni.$emit('refreshdatalist')
  270. that.$tab.navigateTo('/pages/order/staffcode?id='+id)
  271. }
  272. } else {
  273. uni.showToast({
  274. title: res.msg,
  275. duration: 1000,
  276. icon: 'none'
  277. });
  278. }
  279. })
  280. },
  281. fail: function(e) {
  282. if (e && e.errMsg && e.errMsg.indexOf('scanCode:fail cancel') != -1) {
  283. return;
  284. }
  285. uni.showToast({
  286. title: '扫码失败',
  287. icon: "none"
  288. })
  289. },
  290. });
  291. // this.$tab.navigateTo('/pages/order/code')
  292. },
  293. totopFn(){
  294. var that = this;
  295. uni.pageScrollTo({
  296. duration: 0,
  297. scrollTop: that.dingtop + 12
  298. })
  299. },
  300. getDataFn(){
  301. var params={
  302. pageSize:this.pageSize,
  303. pageNum: this.pageNum,
  304. // visitType:3
  305. }
  306. if(this.tabidx!=5){
  307. params.dataType=this.tabidx
  308. }
  309. getReservatList(params).then(res=>{
  310. if(res.code==200){
  311. if (res.rows.length < this.pageSize) {
  312. this.reachflag = false
  313. this.wtdt = '到底了~';
  314. } else {
  315. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  316. if (num < res.total) {
  317. this.reachflag = true
  318. this.wtdt = '上拉加载更多'
  319. } else {
  320. this.reachflag = false
  321. this.wtdt = '到底了~';
  322. }
  323. }
  324. if (this.pageNum == 1) {
  325. this.list = res.rows;
  326. } else {
  327. this.list = this.list.concat(res.rows)
  328. }
  329. }else{
  330. this.$toast(res.msg)
  331. }
  332. })
  333. },
  334. },
  335. }
  336. </script>
  337. <style lang="scss" scoped>
  338. .yfixed{position: fixed;z-index: 5;left: 0;top: 0;right: 0;background: #ffffff;padding: 0 30rpx;}
  339. .staff_top{padding: 24rpx 32rpx;box-sizing: border-box;box-sizing: border-box;
  340. .topl{width: 272rpx;height: 56rpx;}
  341. .topr{
  342. .weaimg{width: 40rpx;height: 40rpx;}
  343. }
  344. }
  345. .staff_box{padding:8px 30rpx 0;
  346. .s_count{position: relative;min-height: 380rpx;
  347. .bgimg{position: absolute;left: 0;top: 0;right: 0;bottom: 0;z-index: -1;width: 100%;height: 100%;}
  348. .s_counta{padding: 36rpx 0 20rpx;width: 100%;
  349. .s_coua{margin: 0 36rpx;}
  350. .s_clist{padding: 36rpx 0;
  351. .list{width: 25%;display: flex;flex-direction: column;align-items: center;position: relative;
  352. .num{font-size: 42rpx;font-weight: 500;color: #F1F1F1;margin-bottom: 14rpx;}
  353. .tit{font-size: 24rpx;font-weight: bold;color: #F2B5B2;}
  354. &::after{content: '';width: 2rpx;height: 36rpx;background: #B7C9F9;position: absolute;right: 0;top: 50%;margin-top: -18rpx;border-radius: 4rpx;}
  355. &:last-of-type::after{display: none;}
  356. }
  357. }
  358. .s_cbtn{margin: 14rpx 58rpx 0;height: 76rpx;background: #FFFFFF;box-shadow: 0px 2rpx 6rpx 0px rgba(35,68,152,0.63);border-radius: 38rpx;
  359. font-size: 30rpx;font-weight: bold;color: $com-cd3;
  360. .scanimg{width: 44rpx;height: 44rpx;margin-right: 30rpx;}
  361. }
  362. }
  363. }
  364. }
  365. .sy_box{
  366. .sy_tit{padding: 32rpx 0;
  367. .sy_txt{font-size: 30rpx;font-weight: bold;color: #161616;position: relative;padding-left: 26rpx;
  368. &::before{width: 6rpx;height: 34rpx;background: $com-cd3;border-radius: 4rpx;content: '';left: 0;top: 3rpx;position: absolute;bottom: 3rpx;}
  369. }
  370. .sy_rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;marign-left:20rpx}
  371. }
  372. .tab{padding-bottom: 24rpx;
  373. .list{min-width: 112rpx;height: 52rpx;background: #E6E4E4;border-radius: 26rpx;display: flex;align-items: center;font-size: 26rpx;font-weight: 500;
  374. color: #666666;justify-content: center;box-sizing: border-box;padding: 0 28rpx;line-height: 48rpx;
  375. &.act{color: $com-cd3;background: #FFFFFF;border: 2rpx solid $com-cd3;}
  376. }
  377. }
  378. }
  379. </style>