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.
 
 
 
 
xuan-pay-cweb/pages/index/mcc-list/mcc-list.vue

94 lines
2.2 KiB

<template>
<view>
<!-- 搜索框 -->
<unisearchbar v-model="searchValue" @input="focusInput" placeholder="搜索内容" radius="100">
</unisearchbar>
<!-- 商户名字 -->
<view class="mart20 width100">
<view class=" mcclist font15 fcor666" v-for="(item,index) in mccList" @click="changemcc(item)">
{{item.maccCode}}
</view>
</view>
</view>
</template>
<script>
import unisearchbar from '../../../components/uni-search-bar/components/uni-search-bar/uni-search-bar.vue';
import {
getLklMcc
} from '../../../Utils/Api.js';
let app = getApp();
export default {
components: {
unisearchbar
},
data() {
return {
//搜索内容
searchValue: '',
//列表数据
mccList: [],
pageNum: 1,
pagesize: 15,
isLoadMore: false, //是否加载中
}
},
onLoad() {
this.getLklMcc();
},
onReachBottom() { //上拉触底函数
if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore = true
this.pageNum += 1
this.getLklMcc()
}
},
methods: {
//查询mcc商户
getLklMcc() {
let params = {
pageNum: this.pageNum,
pageSize: this.pagesize,
name: this.searchValue
}
getLklMcc(params).then(res => {
if (res.return_code == '000000' && res.return_data.list) {
this.mccList = this.mccList.concat(res.return_data.list);
if (res.return_data.pages == this.pageNum) {
this.isLoadMore = true;
} else {
this.isLoadMore = false
}
} else {
this.isLoadMore = true
}
});
},
// 搜索商户
focusInput() {
this.pageNum = 1;
this.pagesize = 15;
this.mccList = [];
this.getLklMcc();
},
//选择某个mcc 并返回
changemcc(item){
app.globalData.mccid = item.name;
app.globalData.mccname = item.maccCode;
uni.navigateBack({})
}
}
}
</script>
<style lang="scss">
.mcclist {
width: calc(100% - 50upx);
height: 100upx;
display: flex;
align-items: center;
background-color: rgba($color: #ffffff, $alpha: 0.1);
border-bottom: 1px solid #f6f6f6;
padding: 12upx 25upx;
}
</style>