index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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>{{ userInfo.payeeName || '智慧停车' }}</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" @click="openRoad">
  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="" @click="openPage('/pages/parking/parking')">
  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="openPage('/pages/parking/parking')">
  37. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-05.png"></u-image>
  38. <view class="feature-item-text">车辆入场</view>
  39. </view>
  40. <view class="feature-item" @click="openPage('/pages/getout/getout')">
  41. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-06.png"></u-image>
  42. <view class="feature-item-text">车辆出场</view>
  43. </view>
  44. <view class="feature-item" @click="openPage('/pages/attence/attence')">
  45. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-01.png"></u-image>
  46. <view class="feature-item-text">签到打卡</view>
  47. </view>
  48. <view class="feature-item" @click="openPage('/pages/ownersquery/ownersquery')">
  49. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-10.png"></u-image>
  50. <view class="feature-item-text">车主查询</view>
  51. </view>
  52. <view class="feature-item" @click="openPage('/pages/performance/performance')">
  53. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-11.png"></u-image>
  54. <view class="feature-item-text">我的业绩</view>
  55. </view>
  56. <view class="feature-item" @click="openPage('/pages/setting/setting')">
  57. <u-image width="160rpx" height="160rpx" src="/static/img/index-feature-08.png"></u-image>
  58. <view class="feature-item-text">设置</view>
  59. </view>
  60. </view>
  61. <u-bottom color="#949494" :static="true"></u-bottom>
  62. </view>
  63. <u-toast ref="uToast" />
  64. </view>
  65. </template>
  66. <script>
  67. //#ifdef APP-PLUS
  68. var ALog = uni.requireNativePlugin("AndroidLog")
  69. var location = uni.requireNativePlugin("Location")
  70. var speak = uni.requireNativePlugin("SpeechPlug")
  71. var device = uni.requireNativePlugin("DeviceInfo")
  72. //#endif
  73. export default {
  74. data() {
  75. return {
  76. pic:'/static/img/default-portrait.png',
  77. userInfo:[],
  78. noticeList:['智慧停车车主端V0.1版本发布','智慧停车PDA端V0.1版本发布'],
  79. theRoad:[],
  80. spaceInfo:new Object,
  81. latitude:'',
  82. longitude:'',
  83. roadList:'',
  84. list: ''
  85. }
  86. },
  87. onLoad() {
  88. },
  89. onBackPress(options) {
  90. // uni.showModal({
  91. // title: '温馨提示',
  92. // content: '已经到头了',
  93. // showCancel: false,
  94. // success: (res) => { }
  95. // })
  96. // 禁止默认返回
  97. return true
  98. },
  99. onShow() {
  100. this.getLocation();
  101. if(this.$store.state.vuex_hasLogin){
  102. this.userInfo = this.$store.state.vuex_user;
  103. this.theRoad = this.$store.state.vuex_user?.roadList?.[0]||[];
  104. if(this.theRoad.roadNo){
  105. console.log('this.theRoad.roadNo',this.theRoad.roadNo)
  106. this.handleGetIndex(this.theRoad.roadNo);
  107. };
  108. console.log('this.theRoad',this.theRoad);
  109. console.log('this.userInfo',this.userInfo);
  110. }else{
  111. this.userInfo = [];
  112. this.openPage('/pages/login/login');
  113. };
  114. },
  115. methods: {
  116. openRoad(){
  117. //#ifdef APP-PLUS
  118. let ALog = uni.requireNativePlugin("AndroidLog");
  119. ALog.info({msg:'径度:err' + this.latitude});
  120. //#endif
  121. this.$u.route({
  122. url: 'pages/roadlist/roadlist',
  123. params: {
  124. latitude: this.latitude,
  125. longitude: this.longitude,
  126. }
  127. });
  128. },
  129. speaks(msg){
  130. speak.speakAction(msg)
  131. },
  132. onPrint(){
  133. this.$u.api.printIn({orderId:'550110630002380800'})
  134. .then(res=>{
  135. device.print(res.data);
  136. }).catch(err=>{
  137. });
  138. },
  139. getLocation(){
  140. let that = this;
  141. uni.getLocation({
  142. type:"gcj02",
  143. success : function (res) {
  144. var dst = '26.58751,106.78329';
  145. var src = res.latitude + ',' + res.longitude;
  146. that.latitude = res.latitude;
  147. //#ifdef APP-PLUS
  148. let ALog = uni.requireNativePlugin("AndroidLog");
  149. ALog.info({msg:'精度:err' + res.latitude});
  150. //#endif
  151. console.log('res.latitude', res.latitude)
  152. that.longitude = res.longitude;
  153. //#ifdef APP-PLUS
  154. var locRet = location.distance(src, dst)
  155. //#endif
  156. },
  157. fail: function(res){
  158. }
  159. })
  160. },
  161. openPage(path) {
  162. uni.navigateTo({
  163. url: path
  164. });
  165. },
  166. //登录判断
  167. login(status){
  168. if(!status){
  169. console.log('config',this.config);
  170. this.openPage('/pages/login/login');
  171. // window.location.replace(this.config.loginUrl)
  172. }
  173. },
  174. handleGetIndex(roadNo){
  175. this.$u.api.getIndex({roadNo:roadNo})
  176. .then(res=>{
  177. // this.$refs.uToast.show({
  178. // title: res.msg,
  179. // type: 'success',
  180. // });
  181. this.spaceInfo = res.data.spaceInfo;
  182. if (res.data.notices){
  183. this.noticeList=[];
  184. res.data.notices.forEach(item =>{
  185. this.noticeList.push(item.title);
  186. })
  187. }
  188. console.log('this.spaceInfo',this.spaceInfo)
  189. }).catch(err=>{
  190. if(err.errMsg){
  191. this.$refs.uToast.show({
  192. title: '请检查网络',
  193. type: 'error',
  194. });
  195. return false;
  196. };
  197. this.$refs.uToast.show({
  198. title: err.msg,
  199. type: 'error',
  200. });
  201. console.log('handleGetIndex ',err)
  202. });
  203. },
  204. }
  205. }
  206. </script>
  207. <style lang="scss" >
  208. @import "./index.scss";
  209. </style>