index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="home-address">
  3. <page-navbar bgColor="#fff" title="地址"></page-navbar>
  4. <view class="address-update fl-flex-item">
  5. <view class="fl-flex fl-align-center" @click="handelManual">
  6. <u--image
  7. src="/static/pagesHome/payment-success.png"
  8. width="44rpx"
  9. height="44rpx"
  10. ></u--image>
  11. <view class="f-s-28 text-primary u-m-l-8">地图定位</view>
  12. </view>
  13. <view class="address-line"></view>
  14. <view class="fl-flex fl-align-center" @click="handleUpdateAddress">
  15. <u--image
  16. src="/static/pagesHome/payment-success.png"
  17. width="44rpx"
  18. height="44rpx"
  19. ></u--image>
  20. <view class="f-s-28 text-primary u-m-l-8">刷新定位</view>
  21. </view>
  22. </view>
  23. <base-card padding="24rpx" radius="8rpx">
  24. <view class="fl-flex-item u-m-b-32">
  25. <view class="f-s-28 text-333 text-bold">常用地址</view>
  26. <view
  27. class="fl-flex fl-align-center"
  28. @click="$u.route('/PageMine/address/index')"
  29. >
  30. <view class="f-s-24 text-666">更多</view>
  31. <u-icon name="arrow-right" color="#666" size="16"></u-icon>
  32. </view>
  33. </view>
  34. <view
  35. style="border-bottom: 1rpx solid #d8d8d8"
  36. class="u-p-b-24 u-m-t-24"
  37. v-for="(item, index) in 4"
  38. :key="index"
  39. >
  40. <view class="fl-flex u-m-b-16">
  41. <view class="f-s-28 text-primary u-m-r-16">王忠青</view>
  42. <view class="f-s-28 text-primary u-m-r-8">18285564342</view>
  43. <base-text text="常用" padding="3rpx" fontSize="24rpx"></base-text>
  44. </view>
  45. <view class="f-s-24 text-666">中国科学院近代物理研究所-东门【详情地址】</view>
  46. </view>
  47. </base-card>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. name: 'home-address',
  53. methods: {
  54. handelManual() {
  55. uni.chooseLocation({
  56. success: res => {
  57. let { longitude, latitude } = res;
  58. let data = { longitude, latitude };
  59. this.$store.dispatch('getLocationNow', data);
  60. setTimeout(() => {
  61. uni.navigateTo({
  62. url: '/pages/home/index',
  63. });
  64. }, 500);
  65. },
  66. });
  67. },
  68. handleUpdateAddress() {
  69. uni.getLocation({
  70. type: 'gcj02',
  71. success: res => {
  72. let { longitude, latitude } = res;
  73. let data = { longitude, latitude };
  74. this.$store.dispatch('getLocationNow', data).then(res => {
  75. setTimeout(() => {
  76. uni.navigateTo({
  77. url: '/pages/home/index',
  78. });
  79. }, 500);
  80. });
  81. },
  82. });
  83. },
  84. },
  85. };
  86. </script>
  87. <style lang="scss" scoped>
  88. .home-address {
  89. padding: 24rpx 32rpx;
  90. .address-update {
  91. height: 88rpx;
  92. background-color: #fff;
  93. border-radius: 8rpx;
  94. padding: 0 86rpx;
  95. margin-bottom: 24rpx;
  96. }
  97. .address-line {
  98. height: 40rpx;
  99. width: 2rpx;
  100. background-color: #d8d8d8;
  101. }
  102. }
  103. </style>