index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <!-- 首页 -->
  3. <view>
  4. <view class="card_gas_cylinder">气瓶安全追溯管理系统</view>
  5. <!-- <view class="card_port center_in">{{genreTitle}}</view> -->
  6. <view class="card_cylinder">
  7. <view class="card_bottle" v-for="(item,index) in stationList" :key="index" @click="scanCodes(item)">
  8. <view class="card_fiche" :style="{backgroundColor:item.color}">
  9. <span class="iconfont icon_image" :class="item.icon"></span>
  10. <view class="title_hint">{{item.title}}</view>
  11. </view>
  12. </view>
  13. <view class="card_bottle" @click="scanning">
  14. <view class="card_fiche" :style="{backgroundColor:'#67C23A'}">
  15. <span class="iconfont icon_image icon-saomachaxun"></span>
  16. <view class="title_hint">扫码查询气瓶流转信息</view>
  17. </view>
  18. </view>
  19. <view style="width: 40%;margin: 30rpx 0rpx;"></view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. dataList: [],
  28. stationList: [{
  29. id: 'Booking',
  30. title: '订气',
  31. icon: 'icon-lpg',
  32. color: '#f4b237',
  33. }],
  34. city:'',
  35. latitude:'',
  36. longitude:'',
  37. }
  38. },
  39. onShow() {
  40. this.getLocation()
  41. },
  42. mounted() {
  43. this.getLocation()
  44. var userInfo = this.$cache.getCache('userInfo')
  45. // console.log(userInfo, 25)
  46. },
  47. methods: {
  48. //获取经纬度
  49. getLocation() {
  50. console.log(24)
  51. uni.getLocation({
  52. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  53. geocode: true,
  54. success: (res) => {
  55. console.log(res,9998)
  56. // #ifdef APP-PLUS
  57. this.city = res.address.city;
  58. // #endif
  59. this.latitude = res.latitude;
  60. this.longitude = res.longitude;
  61. // #ifdef H5
  62. uni.request({
  63. url: 'https://restapi.amap.com/v3/geocode/regeo', //逆地理编码接口地址。
  64. data: {
  65. key: '2eba463a7c621e888e478eee3f3209c9',
  66. //location:经纬度 lng :经度 lat:纬度
  67. location: this.longitude + ',' + this.latitude,
  68. radius: 1000,
  69. extensions: 'all',
  70. batch: false,
  71. roadlevel: 0
  72. },
  73. success: (res) => {
  74. console.log(res.data,326326);
  75. //详细地址信息
  76. if (res.statusCode == 200 && res.data.info == 'OK') {
  77. this.city = res.data.regeocode.addressComponent.city
  78. }
  79. }
  80. });
  81. // #endif
  82. },
  83. });
  84. },
  85. scanCodes(value) {
  86. if (value.id == 'Booking') {
  87. uni.navigateTo({
  88. url: '/pages/home/company'
  89. });
  90. }
  91. },
  92. // 扫码溯源
  93. scanning() {
  94. uni.navigateTo({
  95. url: '/pages/index/codeTracing'
  96. });
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .card_gas_cylinder {
  103. display: flex;
  104. justify-content: center;
  105. align-items: center;
  106. font-size: 46rpx;
  107. font-weight: bold;
  108. color: #027DB4;
  109. padding: 50rpx 20rpx 0rpx 20rpx;
  110. }
  111. .card_port {
  112. font-size: 40rpx;
  113. font-weight: bold;
  114. color: #027DB4;
  115. padding-bottom: 20rpx;
  116. }
  117. .card_cylinder {
  118. display: flex;
  119. flex-direction: row;
  120. flex-wrap: wrap;
  121. justify-content: space-evenly;
  122. }
  123. .card_bottle {
  124. margin: 30rpx 0rpx;
  125. width: 40%;
  126. display: flex;
  127. flex-direction: column;
  128. align-items: center;
  129. }
  130. .card_fiche {
  131. display: flex;
  132. align-items: center;
  133. flex-direction: column;
  134. // justify-content: center;
  135. justify-content: flex-end;
  136. width: 100%;
  137. height: 240rpx;
  138. background-color: #027DB4;
  139. border-radius: 26rpx;
  140. }
  141. .icon_image {
  142. color: #fff;
  143. font-size: 80rpx;
  144. }
  145. .title_hint {
  146. height: 80rpx;
  147. margin-top: 20rpx;
  148. margin-bottom: 20rpx;
  149. color: #fff;
  150. width: 80%;
  151. text-align: center;
  152. font-size: 32rpx;
  153. }
  154. </style>