123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <view>
- <view class="customer-ul">
- <view class="customer-li" v-for="(item, index) in account_list" :key="index" @click="changeSupplier(item)">
- <view class="customer-name">{{ item.name }}</view>
- <view class="accountNumber">{{ item.accountNumber }}</view>
- </view>
- </view>
- <u-loadmore :status="load_status" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- keyword: '',
- load_status: 'nomore',
- page: 1,
- pageSize: 10,
- total: 0,
- account_list: [],
- shopId: ''
- };
- },
- onLoad(options) {
- if (options.shopId) {
- this.shopId = options.shopId;
- }
- this.getAllAccount();
- },
- onPullDownRefresh() {
- this.getAllAccount();
- },
- // 上拉加载
- onReachBottom() {
- if (this.total / this.pageSize > this.page) {
- this.page += 1;
- this.getAllAccount();
- }
- },
- methods: {
- changeSupplier(item) {
- // 选择返回上一页
- this._prePage().AccountData = item;
- uni.navigateBack();
- },
- search() {
- this.page = 1;
- this.getAllAccount();
- },
- getAllAccount() {
- this.loading_status = 'loading';
- this.$u.api
- .getAllAccount({
- page: this.page,
- pageSize: this.pageSize,
- enableStatus: 5,
- shopId: this.shopId
- })
- .then(res => {
- uni.stopPullDownRefresh();
- if (this.page === 1) {
- this.account_list = res.data;
- } else {
- this.account_list = this.account_list.concat(res.data);
- }
- this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
- this.total = res.pageTotal;
- })
- .catch(err => {
- uni.stopPullDownRefresh();
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .customer-ul {
- padding-bottom: 20rpx;
- .customer-li {
- border-bottom: 1px solid #eeeeee;
- background-color: #ffffff;
- border-radius: 10rpx;
- padding: 20rpx;
- &:last-child {
- border-bottom: 0 none;
- }
- .customer-name {
- padding-bottom: 10rpx;
- }
- .accountNumber {
- font-size: 24rpx;
- color: #999999;
- }
- }
- }
- </style>
|