|
- <template>
- <view class="selectBuilding">
- <view class="searchStyle">
- <u-search placeholder="输入项目名称" v-model="search" @search="s" @custom="s"></u-search>
- </view>
- <view class="searchResultStyle">
- <view class="searchList" v-for="(item,index) in list" :key="index" @click="okSelect(item.id,item.propertyName)">
- {{item.propertyName}}
- </view>
- </view>
- </view>
-
- </template>
-
- <script>
- var config = require("@/config");
- export default {
- name: "selectBuilding",
- data() {
- return {
- search: "",
- list: [],
- };
- },
- methods:{
- s(e){
- this.init(e)
- },
- okSelect(id,name){
- let lopan = {
- id,
- name
- }
- uni.setStorageSync("buildingID", lopan);
- uni.setStorageSync("updatebuildingID", 'updatebuildingID');
- uni.navigateBack({
- delta:-1
- })
- },
- init(e){
- let data = {houseName:decodeURI(e)||''}
- uni.request({
- url: config.service.getUser,
- method: "GET",
- data,
- header: {
- 'content-type': 'application/json',
- 'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
- },
- success: (res) => {
- this.list = res.data.data.houseList
- }
- })
- }
- },
- onLoad() {
- this.init("")
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .selectBuilding {
- .searchStyle {
- padding: 20rpx;
- }
-
- .searchResultStyle {
- padding: 0 30rpx;
- .searchList{
- border-bottom: 1rpx solid #E0E0E0;
- padding: 30rpx 0;
- font-size: 30rpx;
- }
- }
- }
- </style>
|