search-payee.vue
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
<Page name="search-payee" flank>
<template #header>
<search-bar v-model="query" placeholder="搜索手机号或姓名" auto @confirm="onSearch" />
</template>
<template #content>
<List ref="list" v-model="list" :api="searchAPI">
<template v-for="(item, index) in list">
<view class="card" :key="index" @tap="choseIndex = index">
<view class="title">
<view>
<text style="color: #999999; margin-right: 30upx">收款人</text>
<text>{{ item.name }}</text>
<text>{{ item.mobile }}</text>
</view>
<view style="float: right" :class="{ action: choseIndex === index }">
<u-icon v-if="choseIndex !== index" name="checkmark-circle"></u-icon>
<u-icon v-else name="checkmark-circle-fill"></u-icon>
</view>
</view>
<payee :value="item"></payee>
</view>
</template>
</List>
</template>
<template #footer>
<u-button type="primary" @click="onSelect">确定</u-button>
</template>
</Page>
</template>
<script>
import payee from '../../components/card/payee.vue';
import UText from '../../uni_modules/uview-ui/components/u-text/u-text.vue';
export default {
name: 'change-payee',
components: { UText, payee },
data() {
return {
choseIndex: '',
list: [],
query: '',
};
},
methods: {
searchAPI(params) {
return uni.$u.api.filter.payeeCommonSelect({ query: this.query, ...params });
},
onSelect() {
let item = this.list[this.choseIndex];
uni.$emit('select-payee', item);
uni.navigateBack();
},
},
};
</script>
<style lang="scss">
.page-search-payee {
&__header {
padding: 15rpx 22rpx !important;
}
&__footer {
background: $color-white;
}
.title {
padding-bottom: $padding-md;
display: flex;
justify-content: space-between;
}
.card {
padding: $padding-md;
border-radius: $radius-md;
margin-bottom: $padding-md;
background: $color-white;
.action {
color: $color-primary;
}
}
}
</style>