index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view>
  3. <view class="header">
  4. <view class="u-flex user-box u-m-b-24">
  5. <view class="u-m-r-10" @click="login($store.state.vuex_hasLogin)">
  6. <u-avatar :src="userInfo.headImgUrl || userInfo.avatar||pic" size="140"></u-avatar>
  7. </view>
  8. <view class="u-flex-1" @click="login($store.state.vuex_hasLogin)">
  9. <view class="u-font-18 u-p-b-20"><b>智慧停车</b><span class="payee-no">工号:{{ userInfo.payeeNo || '请登录' }}</span></view>
  10. <view class="addr u-flex">
  11. <u-icon name="map-fill" color="#fff" size="38"></u-icon>
  12. {{ theRoad.roadName || '暂无' }}
  13. </view>
  14. </view>
  15. <view class="u-m-l-10 u-p-10">
  16. <u-icon name="arrow-right" color="rgba(255,255,255,.7)" size="28"></u-icon>
  17. </view>
  18. </view>
  19. <view class="header-total u-flex wrap">
  20. <view class="u-p-r-60">
  21. 车位:{{ spaceInfo.spaceBusy }}/{{ spaceInfo.spaceTotal}}
  22. </view>
  23. <view class="">
  24. 需确认:{{ spaceInfo.spaceConfirm}}
  25. </view>
  26. </view>
  27. </view>
  28. <view class="wrap">
  29. <view class="notice u-flex u-p-l-35 u-p-r-40">
  30. <u-image width="113rpx" height="83rpx" src="/static/img/tip.png"></u-image>
  31. <view class="notice-wrap u-flex-1">
  32. <u-notice-bar mode="vertical" :list="noticeList" :more-icon="true" :volume-icon="false" bg-color="#fff" color="#373737"></u-notice-bar>
  33. </view>
  34. </view>
  35. <view class="feature-list u-flex u-flex-wrap u-row-between">
  36. <!-- <view class="feature-item" @click="speaks('贵AF113Z')">
  37. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-02.png"></u-image>
  38. <view class="feature-item-text">拍照取证</view>
  39. </view> -->
  40. <!-- <view class="feature-item" @click="$refs.uToast.show({title: '建设中'})">
  41. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-03.png"></u-image>
  42. <view class="feature-item-text">缴费</view>
  43. </view> -->
  44. <!-- <view class="feature-item" @click="$refs.uToast.show({title: '建设中'})">
  45. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-04.png"></u-image>
  46. <view class="feature-item-text">车位管理</view>
  47. </view> -->
  48. <view class="feature-item" @click="openPage('pages/parking/parking')">
  49. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-05.png"></u-image>
  50. <view class="feature-item-text">车辆入场</view>
  51. </view>
  52. <view class="feature-item" @click="openPage('pages/getout/getout')">
  53. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-06.png"></u-image>
  54. <view class="feature-item-text">车辆出场</view>
  55. </view>
  56. <view class="feature-item" @click="openPage('pages/attence/attence')">
  57. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-01.png"></u-image>
  58. <view class="feature-item-text">签到打卡</view>
  59. </view>
  60. <!-- <view class="feature-item" @click="openPage('pages/modifypwd/modifypwd')">
  61. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-07.png"></u-image>
  62. <view class="feature-item-text">密码修改</view>
  63. </view> -->
  64. <view class="feature-item" @click="onPrint()">
  65. <u-image width="120rpx" height="120rpx" src="/static/img/index-feature-10.png"></u-image>
  66. <view class="feature-item-text">车主查询</view>
  67. </view>
  68. <view class="feature-item" @click="openPage('pages/performance/performance')">
  69. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-11.png"></u-image>
  70. <view class="feature-item-text">我的业绩</view>
  71. </view>
  72. <view class="feature-item" @click="openPage('pages/setting/setting')">
  73. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-08.png"></u-image>
  74. <view class="feature-item-text">设置</view>
  75. </view>
  76. <!-- <view class="feature-item" @click="logout">
  77. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-09.png"></u-image>
  78. <view class="feature-item-text">退出登录</view>
  79. </view> -->
  80. </view>
  81. <u-bottom color="#949494"></u-bottom>
  82. </view>
  83. <u-toast ref="uToast" />
  84. </view>
  85. </template>
  86. <script>
  87. var ALog = uni.requireNativePlugin("AndroidLog")
  88. var location = uni.requireNativePlugin("Location")
  89. var speak = uni.requireNativePlugin("SpeechPlug")
  90. var device = uni.requireNativePlugin("DeviceInfo")
  91. export default {
  92. data() {
  93. return {
  94. pic:'https://uviewui.com/common/logo.png',
  95. userInfo:[],
  96. noticeList:['智慧停车车主端V0.1版本发布','智慧停车PDA端V0.1版本发布'],
  97. theRoad:[],
  98. spaceInfo:new Object,
  99. }
  100. },
  101. onLoad() {
  102. this.getLocation();
  103. },
  104. onBackPress(options) {
  105. uni.showModal({
  106. title: '温馨提示',
  107. content: '已经到头了',
  108. showCancel: false,
  109. success: (res) => { }
  110. })
  111. // 禁止默认返回
  112. return true
  113. },
  114. onShow() {
  115. if(this.$store.state.vuex_hasLogin){
  116. this.userInfo = this.$store.state.vuex_user;
  117. this.theRoad = this.$store.state.vuex_user?.roadList?.[0]||[];
  118. if(this.theRoad.roadNo){
  119. console.log('this.theRoad.roadNo',this.theRoad.roadNo)
  120. this.handleGetIndex(this.theRoad.roadNo);
  121. };
  122. console.log('this.theRoad',this.theRoad);
  123. console.log('this.userInfo',this.userInfo);
  124. }else{
  125. this.userInfo = [];
  126. this.openPage('pages/login/login');
  127. };
  128. },
  129. methods: {
  130. speaks(msg){
  131. speak.speakAction(msg)
  132. },
  133. onPrint(){
  134. this.$u.api.printIn({orderId:'550110630002380800'})
  135. .then(res=>{
  136. device.print(res.data);
  137. }).catch(err=>{
  138. });
  139. },
  140. getLocation(){
  141. ALog.info({msg:'请求定位'})
  142. uni.getLocation({
  143. type:"gcj02",
  144. success : function (res) {
  145. // console.log("定位返回信息:", res)
  146. // alert(res.longitude + "," + res.latitude )
  147. ALog.info({msg:res})
  148. var dst = '26.58751,106.78329';
  149. var src = res.latitude + ',' + res.longitude;
  150. var locRet = location.distance(src, dst)
  151. ALog.info({msg:locRet.distance})
  152. },
  153. fail: function(res){
  154. ALog.info({msg:'请求错误',err:res})
  155. }
  156. })
  157. },
  158. openPage(path) {
  159. // console.log('path',path);
  160. this.$u.route({
  161. url: path
  162. });
  163. },
  164. //登录判断
  165. login(status){
  166. if(!status){
  167. console.log('config',this.config);
  168. this.openPage('pages/login/login');
  169. // window.location.replace(this.config.loginUrl)
  170. }
  171. },
  172. logout(){
  173. uni.clearStorage();
  174. this.$u.vuex('vuex_token', null);
  175. this.$u.vuex('vuex_user', null);
  176. this.$u.vuex('vuex_hasLogin', false);
  177. this.userInfo = [];
  178. this.theRoad = [];
  179. this.$refs.uToast.show({
  180. title: '退出成功,即将跳转登录页!',
  181. type: 'success',
  182. url:'pages/login/login'
  183. });
  184. // this.$u.route(-1);
  185. },
  186. handleGetIndex(roadNo){
  187. this.$u.api.getIndex({roadNo:roadNo})
  188. .then(res=>{
  189. // this.$refs.uToast.show({
  190. // title: res.msg,
  191. // type: 'success',
  192. // });
  193. this.spaceInfo = res.data.spaceInfo;
  194. console.log('this.spaceInfo',this.spaceInfo)
  195. }).catch(err=>{
  196. if(err.errMsg){
  197. this.$refs.uToast.show({
  198. title: '请检查网络',
  199. type: 'error',
  200. });
  201. return false;
  202. };
  203. this.$refs.uToast.show({
  204. title: err.msg,
  205. type: 'error',
  206. });
  207. console.log('handleGetIndex ',err)
  208. });
  209. },
  210. }
  211. }
  212. </script>
  213. <style lang="scss" scoped>
  214. @import "./index.scss";
  215. </style>