mechanism.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. export default {
  38. onLoad() {
  39. },
  40. onShow() {
  41. },
  42. mounted() {
  43. this.getMechanismList()
  44. this.getareaList()
  45. },
  46. data() {
  47. return {
  48. value: "",
  49. value1: 0,
  50. mechanismList: [],
  51. options1: [],
  52. pageindex: 1,
  53. show: false
  54. }
  55. },
  56. onReachBottom() {
  57. this.getMechanismList()
  58. },
  59. methods: {
  60. xuanzephone(item) {
  61. this.value = item.id
  62. let pages = getCurrentPages(); //获取所有页面栈实例列表
  63. let nowPage = pages[pages.length - 1]; //当前页页面实例
  64. let prevPage = pages[pages.length - 2]; //上一页页面实例
  65. prevPage.$vm.doctor = item
  66. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  67. delta: 1
  68. });
  69. },
  70. PickerChange(e) {
  71. this.value1 = e.detail.value
  72. this.pageindex = 1
  73. this.mechanismList = []
  74. this.getMechanismList()
  75. },
  76. getMechanismList: async function() {
  77. let area = ""
  78. if (this.options1.length != 0) {
  79. area = this.options1[this.value1].id
  80. }
  81. let res = await this.$request.post("/api/v1/organization/organizationList", {
  82. page: this.pageindex,
  83. city_id: area,
  84. latitude: uni.getStorageSync('latitude'),
  85. longitude: uni.getStorageSync('longitude')
  86. })
  87. console.log(res)
  88. if (res.status == 0) {
  89. if (this.pageindex > res.data.last_page) {
  90. uni.showToast({
  91. title: "没有更多了",
  92. icon: "none"
  93. })
  94. } else {
  95. this.mechanismList = this.mechanismList.concat(res.data.data)
  96. this.pageindex++
  97. }
  98. }
  99. if (this.mechanismList.length == 0) {
  100. this.show = true
  101. } else {
  102. this.show = false
  103. }
  104. },
  105. getareaList: async function() {
  106. let res = await this.$request.post("/api/v1/organization/organizationCityList")
  107. console.log(res)
  108. if (res.status == 0) {
  109. this.options1 = res.data
  110. }
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. page {
  117. background-color: #fff;
  118. }
  119. .main {}
  120. </style>