123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <template>
- <view class="selSupplier">
- <view class="search-view">
- <view class="input-view">
- <input type="text" @confirm="search" confirm-type="search" placeholder-class="input-pl" placeholder="供应商名称/编码" v-model="keyword" />
- <u-icon class="add-icon" name="search" size="40" color="#666666" @click="search"></u-icon>
- </view>
- </view>
- <view class="supplier-ul">
- <view class="supplier-li" v-for="(item, index) in supplier_list" :key="index" @click="changeSupplier(item)">
- <view class="supplier-name">{{ item.title }}</view>
- <view class="other">
- <view class="concat clearfix">
- <text class="float_left">{{ item.realName }}</text>
- <view class="float_right" v-if="item.mobile">
- <u-icon name="phone-fill" size="26"></u-icon>
- <text class="phone-text">{{ item.mobile }}</text>
- </view>
- </view>
- <view class="address">{{ item.area.provinceName }}-{{ item.area.cityName }}-{{ item.area.districtName }}-{{ item.area.address }}</view>
- </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,
- supplier_list: []
- };
- },
- onLoad() {
- this.getAllSupplier();
- },
- onPullDownRefresh() {
- this.getAllSupplier();
- },
- // 上拉加载
- onReachBottom() {
- if (this.total / this.pageSize > this.page) {
- this.page += 1;
- this.getAllSupplier();
- }
- },
- methods: {
- changeSupplier(item) {
- // 选择供应商返回上一页
- this._prePage().supplierData = item;
- uni.navigateBack();
- },
- search() {
- this.page = 1;
- this.getAllSupplier();
- },
- getAllSupplier() {
- this.loading_status = 'loading';
- this.$u.api
- .getAllSupplier({
- page: this.page,
- pageSize: this.pageSize,
- keyword: this.keyword
- })
- .then(res => {
- uni.stopPullDownRefresh();
- this.total = res.pageTotal;
- if (this.page === 1) {
- this.supplier_list = res.data;
- } else {
- this.supplier_list = this.supplier_list.concat(res.data);
- }
- this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
- })
- .catch(err => {
- uni.stopPullDownRefresh();
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .search-view {
- position: fixed;
- z-index: 99;
- top: 0;
- left: 0;
- width: 100%;
- background-color: #ffffff;
- border-bottom: 1px solid #f5f5f5;
- padding-bottom: 20rpx;
- .input-view {
- padding: 0 24rpx;
- input {
- height: 60rpx;
- line-height: 60rpx;
- padding: 0 24rpx;
- display: inline-block;
- width: 580rpx;
- border: 1px solid #f5f5f5;
- vertical-align: middle;
- border-radius: 8rpx;
- background-color: #f7f8fa;
- }
- .add-icon {
- margin-left: 14rpx;
- display: inline-block;
- vertical-align: middle;
- }
- }
- }
- .supplier-ul {
- padding-top: 90rpx;
- padding-bottom: 20rpx;
- .supplier-li {
- width: 702rpx;
- margin: 0 auto;
- background-color: #ffffff;
- border-radius: 10rpx;
- margin-top: 20rpx;
- .supplier-name {
- padding: 0 20rpx;
- line-height: 80rpx;
- border-bottom: 1px solid #f5f5f5;
- }
- .other {
- font-size: 24rpx;
- padding: 10rpx 20rpx;
- line-height: 50rpx;
- .concat {
- .float_right {
- color: $uni-color-primary;
- .phone-text {
- margin-left: 10rpx;
- }
- }
- }
- }
- }
- }
- </style>
|