123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <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="customer-ul">
- <view class="customer-li" v-for="(item, index) in staff_list" :key="index" @click="changeSupplier(item)">
- <view class="customer-name clearfix">
- <text class="float_left">{{ item.staffName }}</text>
- <text class="float_right">{{ item.departmentName }}</text>
- </view>
- <view class="other">
- <view class="concat clearfix">
- <text class="float_left">{{ item.roleName }}</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>
- </view>
- </view>
- <u-loadmore :status="load_status" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- keyword: '',
- load_status: 'nomore',
- page: 1,
- pageSize: 10,
- total: 0,
- staff_list: []
- };
- },
- onLoad(options) {
- if(options.departmentId){
- this.departmentId = options.departmentId
- }
- this.getAllStaff();
- },
- onPullDownRefresh() {
- this.getAllStaff();
- },
- // 上拉加载
- onReachBottom() {
- if (this.total / this.pageSize > this.page) {
- this.page += 1;
- this.getAllStaff();
- }
- },
- methods: {
- changeSupplier(item) {
- // 选择返回上一页
- this._prePage().staffData = item;
- uni.navigateBack();
- },
- search() {
- this.page = 1;
- this.getAllStaff();
- },
- getAllStaff() {
- this.loading_status = 'loading';
- this.$u.api
- .getAllStaff({
- page: this.page,
- pageSize: this.pageSize,
- departmentId:this.departmentId,
- keyword:this.keyword
- })
- .then(res => {
- uni.stopPullDownRefresh();
- if (this.page === 1) {
- this.staff_list = res.data;
- } else {
- this.staff_list = this.staff_list.concat(res.data);
- }
- this.total = res.pageTotal;
- 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: 20rpx 0;
- .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;
- }
- }
- }
- .customer-ul {
- padding-top: 90rpx;
- padding-bottom: 20rpx;
- .customer-li {
- width: 702rpx;
- margin: 0 auto;
- background-color: #ffffff;
- border-radius: 10rpx;
- margin-top: 20rpx;
- .customer-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>
|