123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <template>
- <view class="moreShelfPart flex flex_column">
- <view class="search_box u-flex u-row-between">
- <!-- <u-search
- placeholder="请输入客户名称/拼音首字母查询"
- v-model="customerName"
- @input="$u.debounce(search, 800)"
- @custom="search"
- @search="search"
- @clear="clearSearch"
- :action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': '#57a3f3', 'border-radius': '6upx', 'padding': '12upx 0'}">
- </u-search> -->
- <view class="moreShelfPart-search u-flex u-row-between" :style="{width: !searchBtn? '100%' : 'calc(100% - 120rpx)'}">
- <icon type="search" color="#333" @click="search" size="18"/>
- <input class="uni-input" @focus="focus" @blur="blur" placeholder="请输入客户名称/拼音首字母查询" :value="customerName" @input="clearInput"/>
- <icon type="clear" :style="{'opacity':isGobleSearch?1:0}" @click="$delayDel(clearSearch)" size="18"/>
- </view>
- <view @click="search" v-if="searchBtn">
- <u-button size="mini" type="primary" :custom-style="{'color': '#fff', 'font-size': '24upx', 'background-color': '#57a3f3'}">搜索</u-button>
- </view>
- </view>
- <view class="moreShelfPart-body">
- <scroll-view
- class="nav-right"
- scroll-y
- @scrolltolower="onreachBottom">
- <view class="nav-right-item" v-for="(item, index) in shelfList" :key="index" @click="viewDetail(item)">
- <view class="item-info uni-col-10">
- <view class="item-name" v-if="item.customer">
- <text>{{item.customer.customerName}}</text>
- </view>
- </view>
- <view class="arrow" v-if="item.targetSn == checkedSn">
- <u-icon name="checkbox-mark" color="#3dc50b" size="28"></u-icon>
- </view>
- </view>
- <view v-if="shelfList&&shelfList.length==0">
- <u-empty v-if="status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="180" :text="noDataText" mode="list" :margin-top="50"></u-empty>
- </view>
- <view style="padding: 20upx;" v-else>
- <u-loadmore :status="status" />
- </view>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- import { queryCustomerPage } from '@/api/verify.js';
- export default {
- data() {
- return {
- customerName: '',
- isGobleSearch: false,
- shelfList: [],
- pageNo:1,
- pageSize: 30,
- total: 0, // 列表总数
- noDataText: '暂无客户',
- status: 'loading',
- vinstatus: 'loading',
- checkedSn: null,
- customer:{
- queryWord:''
- },
- searchBtn:false
- }
- },
- onLoad(opts) {
- this.checkedSn = opts.customerSn
- this.getShelfList()
- },
- methods: {
- focus(){
- this.searchBtn=true
- },
- blur(){
- this.searchBtn=false
- },
- clearInput: function(event) {
- this.customerName = event.detail.value;
- if (event.detail.value.length > 0) {
- this.isGobleSearch = true;
- } else {
- this.isGobleSearch = false;
- }
- this.search()
- },
- clearSearch(){
- this.customerName = ''
- this.isGobleSearch = false;
- this.search()
- },
- // change(v){
- // if(v==''){
- // this.clearSearch()
- // }
- // },
- search(){
- this.pageNo = 1
- this.shelfList = []
- this.customer.queryWord = this.customerName;
- this.getShelfList()
- },
- // 获取客户列表
- getShelfList(){
- const _this = this
- let params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- allCustomerFlag: 1,
- stateSet: [ 'ENABLE', 'SUSPEND', 'DISABLED' ]
- }
- params.customer = _this.customer
- _this.status = 'loading'
- queryCustomerPage(params).then(res => {
- uni.hideLoading()
- if(res.status == 200){
- let list = res.data.list
- if (list && list.length){
- // 分页 拼接数据
- if(_this.pageNo>1){
- _this.shelfList = _this.shelfList.concat(res.data.list || [])
- }else{
- _this.shelfList = res.data.list || []
- let obj={}
- obj.targetSn = ''
- obj.customer={
- customerSn: '',
- customerName: '全部客户'
- }
- _this.shelfList.unshift(obj)
- }
- _this.total = res.data.count
- if (_this.shelfList.length == res.data.count) {
- _this.status = 'nomore'
- } else {
- _this.status = 'loadmore'
- }
- } else {
- _this.shelfList = list || []
- _this.total = 0
- _this.status = 'nomore'
- }
- _this.noDataText = '暂无客户'
- }else{
- _this.status = 'loadmore'
- _this.shelfList = []
- _this.total = 0
- _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
- }
- })
- },
- // 加载更多
- onreachBottom () {
- if(this.shelfList.length < this.total ){
- if(this.isGobleSearch&&this.customerName==''){
- return
- }
- this.pageNo++
- this.getShelfList()
- }else{
- this.status = "nomore"
- }
- },
- viewDetail(item){
- uni.$emit('chooseShelfOk',item.customer)
- uni.navigateBack()
- }
- }
- }
- </script>
- <style lang="less">
- .moreShelfPart{
- width: 100%;
- height: 100vh;
- padding: 0;
- background-color: #fff;
- .search_box{
- padding: 12rpx 20rpx;
- box-sizing: border-box;
- width: 100%;
- .moreShelfPart-search{
- padding: 12rpx 20rpx;
- border-radius: 40rpx;
- background-color: rgb(242, 242, 242);
- input{
- width: 80%;
- font-size: 30rpx;
- }
- }
- }
-
- .moreShelfPart-body{
- flex-grow: 1;
- background-color: #fff;
- }
- .nav-right{
- padding: 0 0;
- height: calc(100vh - 110rpx);
- box-sizing: border-box;
-
- .nav-right-item{
- padding:20upx;
- border-bottom: 2rpx solid #f5f5f5;
- display: flex;
- align-items: center;
- &:active{
- background: #f8f8f8;
- }
- .arrow{
- text-align: right;
- padding-left: 20rpx;
- }
- .item-info{
- .item-name{
- font-size: 30upx;
- display: flex;
- align-items: center;
- }
- .item-detail{
- margin-top: 10rpx;
- .item-detail-text{
- font-size: 30upx;
- color: #9DA8B5;
- word-break: break-all;
- }
- }
- }
- }
- }
- }
- </style>
|