123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <template>
- <view class="pages">
- <view class="supplier-page translate open" >
- <view class="search-wrap search-left-color">
- <view class="search">
- <view class="searchTxt">
- <uni-search-bar placeholder="搜索供应商关键词" @confirm="searchsupplier" @input="searchsupplier" ></uni-search-bar>
- </view>
- </view>
- </view>
-
- <view class="simplepage-wrap">
- <mescroll-body ref="mescrollRef0" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
- <view>
- <view v-for="(item,index) in supplierlist" :key="index" @click="supplierclick(item.id)" class="simplepage-item">{{item.compName}}</view>
- </view>
- </mescroll-body>
- </view>
- </view>
-
- </view>
- </template>
- <script>
-
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
-
- import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue";
-
- import uniSearchBar from '@/components/uni-search-bar/uni-search-bar.vue'
- export default {
- mixins: [MescrollMixin],
- components: {
- MescrollBody,
- uniSearchBar,
-
-
- },
- data() {
- return {
- params:{
- token:'',
- tokenhead:'',
- key:'',
- },
- supplierlist:[],
- mescroll: null,
-
- downOption: {
-
- },
-
- upOption: {
- page: {
- size: 10
- },
- noMoreSize: 5,
- empty: {
- tip: '暂无相关数据'
- }
- },
-
- }
- },
- onShow() {
- let self = this;
-
-
-
-
- uni.getStorage({
- key:'token',
- success: function (res) {
- self.params.token = res.data;
-
- }
- });
- uni.getStorage({
- key:'tokenhead',
- success: function (res) {
- self.params.tokenhead = res.data;
-
- }
- });
- },
- onLoad() {
-
- },
- methods: {
- searchsupplier(e){
- console.log(e);
- this.params.key = e.value;
- this.mescroll.resetUpScroll();
- },
-
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- downCallback(){
- this.mescroll.resetUpScroll();
- },
-
- upCallback(page) {
- let pageNum = page.num;
- let pageSize = page.size;
- this.params = Object.assign(this.params,{page:pageNum,rows:pageSize});
- let thetoken = this.params.tokenhead+this.params.token;
- this.$api.http.get(this.config.apiBaseurl+'/company/cp/search',{header: {Authorization:thetoken},params:{key:this.params.key}}).then(data => {
- if(data.data.code=='1001'){
-
-
-
- };
- console.log(data);
-
- let curPageData = data.data.data;
- console.log('curPageData',curPageData);
-
- let curPageLen = curPageData.length;
-
-
-
- let totalSize = data.data.total;
-
-
-
-
- if(page.num == 1) this.supplierlist = [];
- this.supplierlist = this.supplierlist.concat(curPageData);
-
-
- this.mescroll.endBySize(curPageLen, totalSize);
-
-
-
-
-
- }).catch(err => {
- this.mescroll.endErr()
- console.log(err)
-
- });
- },
-
- supplierclick(id){
- console.log(id);
- uni.navigateTo({
- url:`/pages/supplier/supplierdetail/supplierdetail?id=${id}`
- })
- }
- }
- }
- </script>
- <style scoped>
-
- .simplepage-wrap{padding-left: 24rpx;}
- .simplepage-item{padding: 24rpx 0;border-bottom: 1px solid #eee;}
- </style>
|