history.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <My_listbox ref="List" @getlist="getList">
  4. <view class="item" @click="changeShop(index)" v-for="(item, index) in list" :key="item.sa_storeid"
  5. hover-class="navigator-hover">
  6. <image class="logo" :src="logo" />
  7. <view class="content">
  8. <view class="label u-line-1">
  9. {{ item.storename }}
  10. </view>
  11. <view class="icons">
  12. <view class="icon-box" hover-class="navigator-hover" @click.stop="goAtOnce(item)">
  13. <text class="iconfont icon-dizhi-hui" />
  14. </view>
  15. <view v-if="item.phonenumber" class="icon-box" hover-class="navigator-hover"
  16. @click.stop="callPhone(item.phonenumber)">
  17. <text class="iconfont icon-dianhua" />
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </My_listbox>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. "content": {
  30. "pageNumber": 1,
  31. "pageSize": 20
  32. },
  33. list: [],
  34. logo: uni.getStorageSync('site').logo
  35. }
  36. }, onLoad(options) {
  37. this.getList(true)
  38. uni.setNavigationBarTitle({
  39. title: '历史足迹',
  40. })
  41. },
  42. methods: {
  43. async getList(init = false) {
  44. if (this.paging(this.content, init)) return;
  45. if (init) {
  46. let s = await this.getLocation();
  47. this.content.longitude = s.longitude;
  48. this.content.latitude = s.latitude;
  49. }
  50. this.$Http.basic({
  51. "id": 20240416162002,
  52. content: this.content
  53. }).then(res => {
  54. this.$refs.List.RefreshToComplete()
  55. console.log("获取历史足迹", res)
  56. if (this.cutoff(res.msg)) return;
  57. res.data = res.data.map(v => {
  58. v.image = v.attinfos.length ? this.getSpecifiedImage(v.attinfos[0]) : '';
  59. v.distance = v.distance > 1000 ? ((v.distance / 1000).toFixed(2) - 0) + 'km' : ((v.distance).toFixed(2) - 0) + 'm'
  60. return v
  61. })
  62. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  63. this.content = this.$refs.List.paging(this.content, res)
  64. })
  65. },
  66. callPhone(phoneNumber) {
  67. uni.makePhoneCall({
  68. phoneNumber: phoneNumber + ''
  69. })
  70. },
  71. goAtOnce(item) {
  72. uni.openLocation({
  73. latitude: item.latitude - 0,
  74. longitude: item.longitude - 0,
  75. address: item.address,
  76. name: item.storename,
  77. success: function () {
  78. console.log('success');
  79. },
  80. fail: (fail) => {
  81. console.log('fail', fail)
  82. },
  83. });
  84. },
  85. changeShop(index) {
  86. this.$Http.changeShop && this.$Http.changeShop(this.list[index]);
  87. }
  88. },
  89. onUnload() {
  90. delete this.$Http.changeShop
  91. }
  92. }
  93. </script>
  94. <style lang="scss">
  95. .item {
  96. display: flex;
  97. width: 100vw;
  98. height: 84px;
  99. background: #FFFFFF;
  100. margin-top: 10px;
  101. padding: 10px;
  102. box-sizing: border-box;
  103. .logo {
  104. width: 64px;
  105. height: 64px;
  106. background: #FFFFFF;
  107. border-radius: 5px;
  108. border: 1px solid #CCCCCC;
  109. box-sizing: border-box;
  110. }
  111. .content {
  112. margin-left: 26px;
  113. .label {
  114. line-height: 20px;
  115. font-family: Source Han Sans SC, Source Han Sans SC;
  116. font-weight: bold;
  117. font-size: 14px;
  118. color: #333333;
  119. }
  120. .icons {
  121. display: flex;
  122. margin-top: 12px;
  123. .icon-box {
  124. width: 32px;
  125. height: 32px;
  126. background: #F2F2F2;
  127. text-align: center;
  128. line-height: 32px;
  129. margin-right: 10px;
  130. border-radius: 50%;
  131. .iconfont {
  132. font-size: 14px;
  133. color: #666666;
  134. }
  135. }
  136. }
  137. }
  138. }
  139. </style>