index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="yybox">
  3. <view class="navbox">
  4. <image :src="navbg" class="navbg"></image>
  5. <uni-nav-bar color="#ffffff" leftWidth='340rpx' :background-color="backgroundColor" :border="false" statusBar='true' fixed="true">
  6. <block slot="left">
  7. <view class="navleft">
  8. <view>{{city}} {{daytime}}</view>
  9. <view>农历{{lunar}}</view>
  10. </view>
  11. </block>
  12. <block slot="right">
  13. <view class="topr flexccc" v-if="weather">
  14. <image :src="weathericon" class="navright"></image>
  15. <view class="f12 cof">{{weather}} {{temperature}}­°C</view>
  16. </view>
  17. </block>
  18. </uni-nav-bar>
  19. </view>
  20. <!-- 主体 -->
  21. <view class="yymain">
  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='1' :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" :footlist="footlist" :footerindex="footerindex" :color_checked="color_checked" :color_nochecked="color_nochecked" :isHomeIndex="true"></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. footlist:[
  73. {module:'home',title:'首页',icon_checked:require('@/static/images/tabbar/home_.png'),icon_nochecked:require('@/static/images/tabbar/home.png')},
  74. {module:'mine',title:'我的',icon_checked:require('@/static/images/tabbar/mine_.png'),icon_nochecked:require('@/static/images/tabbar/mine.png')},
  75. ],
  76. footerindex:'home',
  77. isfootflag:true,
  78. color_checked :'161616',
  79. color_nochecked :'666666',
  80. navbg:require("@/static/images/navbg.png"),
  81. headimg:require("@/static/images/order/staff/head.png"),
  82. listline:require("@/static/images/order/staff/listline.png"),
  83. backgroundColor: "transparent",
  84. city:'',
  85. weather:'',
  86. temperature:'',
  87. list:[],
  88. adrlist:[],
  89. pageSize: 10,
  90. pageNum: 1,
  91. reachflag: false,
  92. wtdt:'',
  93. daytime:'',
  94. lunar:'',
  95. weathericon:require("@/static/images/weather/weaionf.png"),
  96. }
  97. },
  98. onPageScroll(e) {
  99. var scrollTop = Number(e.scrollTop);
  100. if (scrollTop > 0) {
  101. this.backgroundColor = '#0491FD'
  102. } else {
  103. this.backgroundColor = 'transparent'
  104. }
  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. },
  118. onUnload() {
  119. uni.$off('refreshdatalist')
  120. },
  121. onShow() {
  122. var that=this;
  123. this.time();
  124. // #ifndef H5
  125. self.getLocation(function(res){
  126. if(res==-1){
  127. that.setflag=true
  128. }else{
  129. // that.getAdrinfoFn(res)
  130. // that.location = `${res.lng},${res.lat}`
  131. that.city=res.city;
  132. that.temperature=res.temperature;
  133. that.weather=res.weather;
  134. that.weathericon=res.icon;
  135. }
  136. })
  137. // #endif
  138. },
  139. mounted() {
  140. },
  141. // 上拉触底加载更多触发事件
  142. onReachBottom() {
  143. if (this.reachflag) {
  144. this.pageNum++
  145. this.getDataFn()
  146. }
  147. },
  148. methods:{
  149. checkPermi, checkRole,
  150. init(){
  151. // 记录来源
  152. getDictionaryFn('jluly').then(res=>{
  153. if(res.code==200){
  154. this.adrlist = res.data.map(v => {
  155. return {
  156. dictLabel: v.dictLabel,
  157. dictValue: Number(v.dictValue)
  158. }
  159. })
  160. }
  161. })
  162. },
  163. getMoreFn(){
  164. this.$tab.navigateTo("/pages/order/list")
  165. },
  166. getDelFn(id){
  167. var that=this;
  168. getReservatDel(id).then(res=>{
  169. if(res.code==200){
  170. that.$toast('删除成功')
  171. setTimeout(function(){
  172. that.reachflag=true;
  173. that.pageNum=1;
  174. that.list=[];
  175. that.getDataFn();
  176. // that.getcount();
  177. },1500)
  178. }else{
  179. that.$toast(res.msg)
  180. }
  181. })
  182. },
  183. gettypeFn(ite){
  184. var that=this;
  185. var params={
  186. reservatId:ite.id,
  187. visitType:ite.type
  188. }
  189. getReservatSh(params).then(res=>{
  190. if(res.code==200){
  191. that.$toast('审核成功')
  192. setTimeout(function(){
  193. that.reachflag=true;
  194. that.pageNum=1;
  195. that.list=[];
  196. that.getDataFn();
  197. // that.getcount();
  198. },1500)
  199. }else{
  200. that.$toast(res.msg)
  201. }
  202. })
  203. },
  204. time() {
  205. var date = new Date();
  206. var y = date.getFullYear();
  207. var m = date.getMonth() + 1;
  208. var d = date.getDate();
  209. let lunar = calendar.solar2lunar(y, m, d); //农历
  210. this.lunar=lunar.IMonthCn+lunar.IDayCn;
  211. this.daytime=m+'月'+d+"日";
  212. // var h = date.getHours();
  213. // var min = date.getMinutes();
  214. // var s = date.getSeconds();
  215. // var week = date.getDay(); //获取当前星期X(0-6,0代表星期天)
  216. // var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  217. // var yearStr = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d)
  218. // var timeStr = (h < 10 ? ('0' + h) : h) + ':' + (min < 10 ? ('0' + min) : min) + ':' + (s < 10 ? (
  219. // '0' + s) : s);
  220. // this.kaTime = yearStr + ' ' + timeStr;
  221. },
  222. getcount(){
  223. getReservatcountl().then(res=>{
  224. if(res.code==200){
  225. this.conuntinfo=res.data
  226. }else{
  227. this.$toast(res.msg)
  228. }
  229. })
  230. },
  231. getDetail(data){
  232. this.$tab.navigateTo('/pages/order/staffcode?type=look&id='+data)
  233. },
  234. getDataFn(){
  235. var params={
  236. pageSize:this.pageSize,
  237. pageNum: this.pageNum,
  238. // visitType:3
  239. }
  240. getReservatList(params).then(res=>{
  241. if(res.code==200){
  242. if (res.rows.length < this.pageSize) {
  243. this.reachflag = false
  244. this.wtdt = '到底了~';
  245. } else {
  246. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  247. if (num < res.total) {
  248. this.reachflag = true
  249. this.wtdt = '上拉加载更多'
  250. } else {
  251. this.reachflag = false
  252. this.wtdt = '到底了~';
  253. }
  254. }
  255. if (this.pageNum == 1) {
  256. this.list = res.rows;
  257. } else {
  258. this.list = this.list.concat(res.rows)
  259. }
  260. }else{
  261. this.$toast(res.msg)
  262. }
  263. })
  264. },
  265. },
  266. }
  267. </script>
  268. <style lang="scss" scoped>
  269. .navbox{
  270. .navbg{width: 100%;height: 692rpx;position: fixed;left: 0;right: 0;top: 0;z-index: 1;}
  271. }
  272. .navleft{padding-left: 12rpx;
  273. view{font-weight: bold;font-size: 26rpx;color: #FFFFFF;line-height: 36rpx;}
  274. }
  275. .navright{width: 40rpx;height: 40rpx;}
  276. .yymain{
  277. flex: 1;z-index: 2;padding-top: 20rpx;
  278. }
  279. .yycard{width: 684rpx;height: 306rpx;background: #FFFFFF;border-radius: 14rpx;margin: 0 auto;
  280. .top{
  281. image{width: 132rpx;height: 132rpx;margin-bottom: 12rpx;margin-top: -56rpx;}
  282. view{font-weight: bold;font-size: 30rpx;color: #161616;}
  283. }
  284. .list{text-align: center;flex: 1;padding-top: 44rpx;
  285. .tit{font-weight: bold;font-size: 36rpx;color: #0391FD;margin-bottom: 16rpx;}
  286. .txt{font-weight: bold;font-size: 18rpx;color: #666666;}
  287. }
  288. }
  289. .yylists{width: 684rpx;margin: 42rpx auto 0;
  290. .yyltab{margin-bottom: 28rpx;
  291. .left{font-weight: bold;font-size: 15px;color: #161616;
  292. image{width: 110rpx;height: 14rpx;margin-left: 16rpx;}
  293. }
  294. .right{font-size: 500;font-size: 22rpx;color: #AAAAAA;}
  295. }
  296. }
  297. </style>