history.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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="item.cover" />
  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. }
  35. }, onLoad(options) {
  36. this.getList(true)
  37. uni.setNavigationBarTitle({
  38. title: options.title || '历史足迹',
  39. })
  40. },
  41. methods: {
  42. async getList(init = false) {
  43. if (this.paging(this.content, init)) return;
  44. if (init) {
  45. let s = await this.getLocation();
  46. this.content.longitude = s.longitude;
  47. this.content.latitude = s.latitude;
  48. }
  49. this.$Http.basic({
  50. "id": 20240416162002,
  51. content: this.content
  52. }).then(res => {
  53. this.$refs.List.RefreshToComplete()
  54. console.log("获取历史足迹", res)
  55. if (this.cutoff(res.msg)) return;
  56. res.data = res.data.map(v => {
  57. v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos[0]) : uni.getStorageSync('site').logo || '';
  58. v.distance = v.distance > 1000 ? ((v.distance / 1000).toFixed(2) - 0) + 'km' : ((v.distance).toFixed(2) - 0) + 'm'
  59. return v
  60. })
  61. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  62. this.content = this.$refs.List.paging(this.content, res)
  63. })
  64. },
  65. goAtOnce(item) {
  66. uni.openLocation({
  67. latitude: item.latitude - 0,
  68. longitude: item.longitude - 0,
  69. address: item.address,
  70. name: item.storename,
  71. success: function () {
  72. console.log('success');
  73. },
  74. fail: (fail) => {
  75. console.log('fail', fail)
  76. },
  77. });
  78. },
  79. changeShop(index) {
  80. this.$Http.changeShop && this.$Http.changeShop(this.list[index]);
  81. }
  82. },
  83. }
  84. </script>
  85. <style lang="scss">
  86. .item {
  87. display: flex;
  88. width: 100vw;
  89. height: 84px;
  90. background: #FFFFFF;
  91. margin-top: 10px;
  92. padding: 10px;
  93. box-sizing: border-box;
  94. .logo {
  95. width: 64px;
  96. height: 64px;
  97. background: #FFFFFF;
  98. border-radius: 5px;
  99. border: 1px solid #CCCCCC;
  100. box-sizing: border-box;
  101. }
  102. .content {
  103. margin-left: 26px;
  104. .label {
  105. line-height: 20px;
  106. font-family: Source Han Sans SC, Source Han Sans SC;
  107. font-weight: bold;
  108. font-size: 14px;
  109. color: #333333;
  110. }
  111. .icons {
  112. display: flex;
  113. margin-top: 12px;
  114. .icon-box {
  115. width: 32px;
  116. height: 32px;
  117. background: #F2F2F2;
  118. text-align: center;
  119. line-height: 32px;
  120. margin-right: 10px;
  121. border-radius: 50%;
  122. .iconfont {
  123. font-size: 14px;
  124. color: #666666;
  125. }
  126. }
  127. }
  128. }
  129. }
  130. </style>