You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

94 rivejä
1.9 KiB

  1. <template>
  2. <view class="selectBuilding">
  3. <view class="searchStyle">
  4. <u-search placeholder="输入项目名称" v-model="search" @search="s" @custom="s"></u-search>
  5. </view>
  6. <view class="searchResultStyle">
  7. <view class="searchList" v-for="(item,index) in list" :key="index" @click="okSelect(item)">
  8. <text style="flex-grow: 1;">
  9. {{item.propertyName}}
  10. </text>
  11. <text v-if="item.daysRemaining < 0 || item.lockFlag == 1" style="color: #ff0000;flex-shrink: 0;font-size: 26rpx;">({{ item.daysRemaining < 0 ? '已过期' : '' }} {{ item.lockFlag == 1 ? '已禁用' : ''}})</text>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. var config = require("@/config");
  18. export default {
  19. name: "selectBuilding",
  20. data() {
  21. return {
  22. search: "",
  23. list: [],
  24. };
  25. },
  26. methods: {
  27. s(e) {
  28. this.init(e)
  29. },
  30. okSelect(data) {
  31. if (data.lockFlag == 1) {
  32. uni.showToast({
  33. title: `${data.propertyName}项目已禁用,不能操作`,
  34. icon: 'none',
  35. duration: 2000
  36. })
  37. return
  38. }
  39. let lopan = {
  40. id: data.id,
  41. name: data.propertyName
  42. }
  43. uni.setStorageSync("buildingID", lopan);
  44. uni.navigateBack({
  45. delta: -1
  46. })
  47. },
  48. init(e) {
  49. let data = {
  50. houseName: decodeURI(e) || ''
  51. }
  52. uni.request({
  53. url: config.service.getUser,
  54. method: "GET",
  55. data,
  56. header: {
  57. 'content-type': 'application/json',
  58. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  59. },
  60. success: (res) => {
  61. console.log(res)
  62. this.list = res.data.data.zkProperties
  63. }
  64. })
  65. }
  66. },
  67. onLoad() {
  68. this.init("")
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .selectBuilding {
  74. .searchStyle {
  75. padding: 20rpx;
  76. }
  77. .searchResultStyle {
  78. padding: 0 30rpx;
  79. .searchList {
  80. border-bottom: 1rpx solid #E0E0E0;
  81. padding: 30rpx 0;
  82. font-size: 30rpx;
  83. display: flex;
  84. justify-content: space-between;
  85. }
  86. }
  87. }
  88. </style>