index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view style="width: 100%; height: 100vh">
  3. <zj-page-container>
  4. <view>
  5. <!-- 左上角返回按钮 -->
  6. <image
  7. @tap.stop="navBack"
  8. class="map-back"
  9. src="/static/images/map_back.png"
  10. mode=""
  11. :style="{ top: StatusBar + 'px' }"
  12. ></image>
  13. <!-- 申请记录按钮 -->
  14. <view class="record-application" @tap.stop="toNavigate" :style="{ top: StatusBar + 'px' }">
  15. <text class="record-application-text">申请记录</text>
  16. </view>
  17. </view>
  18. <zj-page-fill
  19. @scrolltolower="loadMore"
  20. :scrollAttribute="{
  21. 'refresher-enabled': false
  22. }"
  23. >
  24. <view class="list_view_lay">
  25. <view class="box" v-for="item in websitList" :key="item.websitId">
  26. <view class="mb20 flex_abs mt20">
  27. <text class="fw600 f32_302">{{ item.websitName }}</text>
  28. <text class="f24_999">距离{{ item.distance }}km</text>
  29. </view>
  30. <view class="flex_abs">
  31. <text class="f28_666" style="width: 520rpx">地址:{{ item.address }}</text>
  32. <tag
  33. style="
  34. width: 150rpx;
  35. height: 50rpx;
  36. background-image: linear-gradient(to bottom right, #7fdaff, #6da7ff);
  37. border-radius: 30rpx;
  38. "
  39. >
  40. <text @tap.stop="toApplicationPartsForm(item)" class="f24_FFF">申请</text>
  41. </tag>
  42. </view>
  43. </view>
  44. </view>
  45. </zj-page-fill>
  46. </zj-page-container>
  47. </view>
  48. </template>
  49. <script>
  50. const sysInfo = uni.getSystemInfoSync()
  51. import api from '@/common/http/'
  52. import tag from '@/components/tag.vue'
  53. import zjPageFill from '@/components/zj-page-container/zj-page-fill.vue'
  54. import wx from 'weixin-js-sdk'
  55. export default {
  56. components: {
  57. tag,
  58. zjPageFill,
  59. View
  60. },
  61. data() {
  62. return {
  63. StatusBar: sysInfo.statusBarHeight,
  64. latitude: '',
  65. longitude: '',
  66. markers: [
  67. {
  68. id: 'm_1',
  69. latitude: 23.183466,
  70. longitude: 113.35709,
  71. iconPath: '/static/images/order_call.png'
  72. }
  73. ],
  74. websitList: [],
  75. page: 1,
  76. pageSize: 3,
  77. websit_number: ''
  78. }
  79. },
  80. async onShow() {
  81. const getWebsit_number = uni.getStorageSync('userInfo')
  82. this.websit_number = getWebsit_number.websit_number
  83. await this.getCurrentWebsit()
  84. await this.getWebsitList()
  85. },
  86. methods: {
  87. navBack() {
  88. uni.navigateBack({
  89. delta: 1
  90. })
  91. },
  92. toNavigate() {
  93. this.$navToPage({
  94. url: `/packageAttachment/pages/orderOfSales/index`
  95. })
  96. },
  97. toApplicationPartsForm(item) {
  98. var { websitId, websitName, partsWebsitId } = item
  99. this.$navToPage({
  100. url: `/packageAttachment/pages/applicationParts/applicationPartsForm?websitId=${websitId}&websitName=${websitName}&partsWebsitId=${partsWebsitId}`
  101. })
  102. },
  103. loadMore() {
  104. this.page++
  105. this.getWebsitList()
  106. },
  107. getWebsitList() {
  108. let params = {
  109. latitude: this.latitude,
  110. longitude: this.longitude,
  111. pageNo: this.page,
  112. pageSize: this.pageSize,
  113. websitNumber: this.websit_number
  114. }
  115. api.post('/app/buy/websit/list', params).then(res => {
  116. this.websitList = this.websitList.concat(res.data.records).filter(item => item.partsWebsitId)
  117. })
  118. },
  119. async getCurrentWebsit() {
  120. try {
  121. const addressInfo = await new Promise((resolve, reject) => {
  122. wx.getLocation({
  123. type: 'gcj02',
  124. isHighAccuracy: true,
  125. geocode: true,
  126. success: res => {
  127. resolve({
  128. lat: res.latitude,
  129. lng: res.longitude,
  130. address: res.address
  131. })
  132. },
  133. fail: err => {
  134. reject(err)
  135. }
  136. })
  137. })
  138. let { lat, lng } = addressInfo
  139. this.latitude = lat
  140. this.longitude = lng
  141. } catch (error) {}
  142. }
  143. }
  144. }
  145. </script>
  146. <style scoped lang="scss">
  147. .map-back {
  148. position: absolute;
  149. left: 30rpx;
  150. width: 60rpx;
  151. height: 60rpx;
  152. border-radius: 30rpx;
  153. overflow: hidden;
  154. }
  155. .record-application {
  156. position: absolute;
  157. right: 30rpx;
  158. width: auto;
  159. height: 60rpx;
  160. border-radius: 30rpx;
  161. box-sizing: border-box;
  162. padding: 0 20rpx;
  163. background: #6da7ff;
  164. }
  165. .record-application-text {
  166. font-size: 28rpx;
  167. font-weight: 500;
  168. text-align: center;
  169. color: #ffffff !important;
  170. line-height: 60rpx;
  171. }
  172. .item {
  173. background-color: #ffffff;
  174. overflow: hidden;
  175. border-bottom: 2rpx solid #f7f7f7;
  176. padding-bottom: 20rpx;
  177. }
  178. .flex_abs {
  179. flex-direction: row;
  180. }
  181. </style>