mechanism.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="bg-white">
  3. <picker class="" @change="PickerChange" mode="selector" range-key="name" :value="value1" :range="options1">
  4. <view class="text-xl margin-sm">
  5. {{options1[value1].name||'加载中...'}}
  6. <text class="cuIcon-unfold lg text-gray margin-left-xs"></text>
  7. </view>
  8. </picker>
  9. <view class="margin-sm">
  10. <view v-for="(item,index) in mechanismList" :key="index" @click="xuanzephone(item)" class="padding bg-white margin-top-sm flex justify-between align-center"
  11. style="border-radius: 16rpx;box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
  12. <view class="">
  13. <view class="text-bold" style="color: #333333;font-size: 30rpx;">
  14. {{item.name}}
  15. </view>
  16. <view class="margin-top-sm" style="color: #999999; font-size: 26rpx;">
  17. 地址:<text style="color: #666666;">{{item.address}}</text>
  18. </view>
  19. <view class="margin-top-sm" style="color: #999999; font-size: 26rpx;">
  20. 距离:<text style="color: #666666;">{{parseInt(item.distance/1000)}}km</text>
  21. </view>
  22. </view>
  23. <view class="">
  24. <u-radio-group v-model="value">
  25. <u-radio @change="radioChange" :key="index" :name="item.id">
  26. </u-radio>
  27. </u-radio-group>
  28. </view>
  29. </view>
  30. </view>
  31. <u-empty text="暂无数据" :show="show" mode="order" margin-top="250"></u-empty>
  32. <view class="cu-tabbar-height"></view>
  33. <view class="cu-tabbar-height"></view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. getLocation
  39. } from "../../common/authorize.js"
  40. export default {
  41. onLoad(op) {
  42. this.type = op.type
  43. },
  44. onShow() {
  45. },
  46. mounted() {
  47. this.getareaList()
  48. this.GetCurrentAddress()
  49. },
  50. data() {
  51. return {
  52. value: "",
  53. value1: 0,
  54. mechanismList: [],
  55. options1: [],
  56. pageindex: 1,
  57. show: false,
  58. type: "",
  59. city_name: ""
  60. }
  61. },
  62. onReachBottom() {
  63. this.getMechanismList()
  64. },
  65. methods: {
  66. GetCurrentAddress() {
  67. getLocation().then(res => {
  68. console.log(res)
  69. this.city_name = res.address.address_component.city
  70. this.getMechanismList()
  71. }).catch(res => {})
  72. },
  73. xuanzephone(item) {
  74. this.value = item.id
  75. let pages = getCurrentPages(); //获取所有页面栈实例列表
  76. let nowPage = pages[pages.length - 1]; //当前页页面实例
  77. let prevPage = pages[pages.length - 2]; //上一页页面实例
  78. prevPage.$vm.doctor = item
  79. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  80. delta: 1
  81. });
  82. },
  83. PickerChange(e) {
  84. this.value1 = e.detail.value
  85. this.city_name = ""
  86. this.pageindex = 1
  87. this.mechanismList = []
  88. this.getMechanismList()
  89. },
  90. getMechanismList: async function() {
  91. let area = ""
  92. if (this.options1.length != 0) {
  93. area = this.options1[this.value1].id
  94. }
  95. let res = await this.$request.post("/api/v1/organization/organizationList", {
  96. page: this.pageindex,
  97. city_id: area,
  98. latitude: uni.getStorageSync('latitude'),
  99. longitude: uni.getStorageSync('longitude'),
  100. schedule_type: this.type,
  101. city_name: this.city_name
  102. })
  103. console.log(res)
  104. if (res.status == 0) {
  105. if (this.pageindex > res.data.last_page) {
  106. uni.showToast({
  107. title: "没有更多了",
  108. icon: "none"
  109. })
  110. } else {
  111. this.mechanismList = this.mechanismList.concat(res.data.data)
  112. this.pageindex++
  113. }
  114. }
  115. if (this.mechanismList.length == 0) {
  116. this.show = true
  117. } else {
  118. this.show = false
  119. }
  120. },
  121. getareaList: async function() {
  122. let res = await this.$request.post("/api/v1/organization/organizationCityList")
  123. console.log(res)
  124. if (res.status == 0) {
  125. this.options1 = res.data
  126. }
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="scss">
  132. page {
  133. background-color: #fff;
  134. }
  135. .main {}
  136. </style>