123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <view>
- <u-navbar
- title="选择收费员"
- title-color="#fff"
- :border-bottom="false"
- :custom-back="customBack"
- back-icon-color="#CCE8FF"
- :background="{background: '#4D68DC' }">
- </u-navbar>
- <u-search placeholder="搜索收费员姓名" v-model="keyword" @search="search" @custom="search"></u-search>
- <mescroll-uni ref="mescrollRef" @init="mescrollInit" :top="config.platform=='h5'?220:300" @down="downCallback" :up="upOption" @up="upCallback" @emptyclick="emptyClick">
- <view class="">
- <u-radio-group v-model="selected" @change="radioGroupChange" width="50%">
- <u-radio
- @change="radioChange(item)"
- v-for="(item, index) in dataList" :key="item.id"
- :name="item.id"
- :disabled="item.disabled"
- >
- {{item.payeeName}}
- </u-radio>
- </u-radio-group>
- </view>
- </mescroll-uni>
- </view>
- </template>
- <script>
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default{
- mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
- data(){
- return{
- keyword:'',
- selected:'',
- upOption:{
- page: {
- size: 150 // 每页数据的数量
- },
- // auto:false,
- // use:false,
- noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
- empty:{
- tip: '~ 暂无数据 ~', // 提示
- // btnText: '去看看'
- }
- },
- dataList:[],
- }
- },
- onLoad(){
-
- },
- onShow(){
- },
- watch:{
- // keyword:{
- // handler(val, oldVal){
- // this.dataList.map((item)=>{
- // if(item.payeeName.indexOf(val)!=-1){
- // this.dataList.push(item);
- // }
- // })
- // },
- // },
- },
- methods:{
- customBack(){
- uni.navigateBack();
- },
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
- upCallback(page) {
- // console.log('vuex_user',this.vuex_user);
- // console.log('page',page)
- //联网加载数据
- // let keyword = this.tabs[this.tabIndex]?.text;
- let params ={
- pageNum:page.num,
- pageSize:page.size,
- payeeName:this.keyword,
- // roadNo:''
- }
- this.$u.api.payeeList(params).then(curPageData=>{
- console.log('curPageData',curPageData)
- //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
- this.mescroll.endSuccess(curPageData.data.length);
- // this.mescroll.endBySize(curPageData.rows.length, curPageData.total);
- //设置列表数据
- if(page.num == 1) this.dataList = []; //如果是第一页需手动制空列表
- // curPageData.rows.map((item)=>{
- // if(item.userId==this.vuex_user.userId){
- // item.disabled = true
- // }else{
- // item.disabled = false
- // }
- // });
- this.dataList=this.dataList.concat(curPageData.data); //追加新数据
- }).catch((err)=>{
- uni.showToast({
- title:'链接失败'
- });
- console.log('err',err)
- //联网失败, 结束加载
- this.mescroll.endErr();
- })
- },
- //点击空布局按钮的回调
- emptyClick(){
-
- },
- radioChange(item){
- // console.log('radioChange',e);
- // console.log('item',item);
- this.$u.vuex('vuex_selected_payee.name',item.payeeName)
- },
- radioGroupChange(e){
- // console.log('radioGroupChange',e);
- this.selected = e;
- this.$u.vuex('vuex_selected_payee.id',e)
- console.log('radioGroupChange');
- uni.navigateBack();
- },
- search(){
- this.dataList = [];
- this.mescroll.resetUpScroll();
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .u-search{
- margin: 24rpx!important;
- }
- .u-radio-group{
- display: flex;
- margin: 24rpx;
- .u-radio{
- margin-bottom: 24rpx;
- }
- }
- </style>
|