mechanism.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. this.city_name = res.address.address_component.city
  69. this.options1.forEach((item,index)=>{
  70. if(item.name.indexOf(this.city_name.split('市')[0])>-1){
  71. this.value1 = index
  72. console.log(this.value1)
  73. }
  74. })
  75. this.getMechanismList()
  76. }).catch(res => {})
  77. },
  78. xuanzephone(item) {
  79. this.value = item.id
  80. let pages = getCurrentPages(); //获取所有页面栈实例列表
  81. let nowPage = pages[pages.length - 1]; //当前页页面实例
  82. let prevPage = pages[pages.length - 2]; //上一页页面实例
  83. prevPage.$vm.doctor = item
  84. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  85. delta: 1
  86. });
  87. },
  88. PickerChange(e) {
  89. this.value1 = e.detail.value
  90. this.city_name = this.options1[this.value1].name
  91. this.pageindex = 1
  92. this.mechanismList = []
  93. this.getMechanismList()
  94. },
  95. getMechanismList: async function() {
  96. // let area = ""
  97. // if (this.options1.length != 0) {
  98. // area = this.options1[this.value1].name
  99. // }
  100. let res = await this.$request.post("/api/v1/organization/organizationList", {
  101. page: this.pageindex,
  102. // city_id: area,
  103. latitude: uni.getStorageSync('latitude'), //25.123157,
  104. longitude: uni.getStorageSync('longitude'), //102.758524,
  105. schedule_type: this.type,
  106. city_name: this.city_name //'昆明市'
  107. })
  108. console.log(res)
  109. if (res.status == 0) {
  110. if (this.pageindex > res.data.last_page) {
  111. uni.showToast({
  112. title: "没有更多了",
  113. icon: "none"
  114. })
  115. } else {
  116. this.mechanismList = this.mechanismList.concat(res.data.data)
  117. this.pageindex++
  118. }
  119. }
  120. if (this.mechanismList.length == 0) {
  121. this.show = true
  122. } else {
  123. this.show = false
  124. }
  125. },
  126. getareaList: async function() {
  127. let res = await this.$request.post("/api/v1/organization/organizationCityList")
  128. console.log(res)
  129. if (res.status == 0) {
  130. this.options1 = res.data
  131. }
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss">
  137. page {
  138. background-color: #fff;
  139. }
  140. .main {}
  141. </style>