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.
 
 
 

102 lines
2.1 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. ...data
  43. }
  44. uni.setStorageSync("buildingID", lopan);
  45. uni.setStorageSync("remind", 0);
  46. this.$u.post('/user/addLoginCount', { houseId: data.id}).then(res=> {
  47. uni.navigateBack({
  48. delta: -1
  49. })
  50. }).catch(() => {
  51. uni.navigateBack({
  52. delta: -1
  53. })
  54. })
  55. },
  56. init(e) {
  57. let data = {
  58. houseName: decodeURI(e) || ''
  59. }
  60. uni.request({
  61. url: config.service.getUser,
  62. method: "GET",
  63. data,
  64. header: {
  65. 'content-type': 'application/json',
  66. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  67. },
  68. success: (res) => {
  69. console.log(res)
  70. this.list = res.data.data.zkProperties
  71. }
  72. })
  73. }
  74. },
  75. onLoad() {
  76. this.init("")
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .selectBuilding {
  82. .searchStyle {
  83. padding: 20rpx;
  84. }
  85. .searchResultStyle {
  86. padding: 0 30rpx;
  87. .searchList {
  88. border-bottom: 1rpx solid #E0E0E0;
  89. padding: 30rpx 0;
  90. font-size: 30rpx;
  91. display: flex;
  92. justify-content: space-between;
  93. }
  94. }
  95. }
  96. </style>