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.

selectBuilding.vue 2.1 KiB

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