123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <template>
- <view class="pages">
-
-
-
- <mescroll-body class="wrap" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
- <view class="results write-radius">
- <view v-for="(item,index) in dataList" :key="index" @click="productdetails(item.id)" class="results-item">
- <view class="results-item-img-wrap"><image :src="$getimg+item.pic|miniImg(50)+'/thumbnail/358x358'" mode="scaleToFill" class="results-item-img cover-img"></image></view>
- <view class="results-item-info">
- <view class="results-item-info-til">{{item.name}}</view>
- <view class="results-item-info-brand">{{item.brandName}}</view>
- {{item.placeOfProduction}}
- <view class="results-item-info-label">
- <text v-if="item.postage" class="postage">包邮</text>
- </view>
- <view class="item-spec f-ellipsis">
- <text>规格:</text><text>{{item.spec}}</text>
- </view>
- <view class="results-item-info-company f-ellipsis">{{item.compName}}</view>
- <view class="results-item-info-price">
- <text class="rmb">¥</text>
- <text class="price">{{item.price}}</text>
- <text class="unit">/{{item.unit}}</text>
-
- </view>
- </view>
- </view>
- </view>
- </mescroll-body>
- </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 {
- title:'',
- searchtxt:'产品名称',
- params:{
- token:'',
- keyword:'',
- subjectId:'',
- },
- mescroll: null,
-
- downOption: {
-
- },
-
- upOption: {
- page: {
- size: 10
- },
- noMoreSize: 5,
- empty: {
- tip: '暂无相关数据'
- }
- },
-
- dataList:[],
-
- }
- },
- onShow() {
- let serf = this;
-
-
-
-
- },
- onReady() {
- uni.setNavigationBarTitle({
- title: this.title
- });
- },
- onLoad(option) {
- console.log('option',option);
- if(option.subjectId){
- this.params.subjectId = option.subjectId;
- this.searchtxt = option.name;
- }
- if(option.title){
- this.title = option.title
- }
-
-
-
-
-
- },
- methods: {
-
- search(e) {
- console.log(e);
- this.params.keyword = e.value;
- this.params.subjectId = '';
- this.searchtxt = e.value;
- this.downCallback();
-
-
-
-
-
- },
-
-
- 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,{pageNum:pageNum,pageSize:pageSize});
- this.$api.http.get(this.config.apiBaseurl+'/home/subjectProductList',{params: this.params}).then(data => {
- if(data.data.code=='1001'){
-
-
-
- };
- console.log('data',JSON.parse(JSON.stringify(data)));
-
- let curPageData = data.data.data;
- console.log('curPageData',JSON.parse(JSON.stringify(curPageData)));
-
- let curPageLen = curPageData.length;
-
- let totalPage = data.data.data.totalPage;
-
- let totalSize = data.data.data.total;
-
-
- console.log('totalPage',totalPage,'curPageLen',curPageLen);
-
- if(page.num == 1) this.dataList = [];
- this.dataList = this.dataList.concat(curPageData);
-
-
- this.mescroll.endByPage(curPageLen, totalPage);
-
-
-
-
-
-
-
- }).catch(err => {
- this.mescroll.endErr()
- console.log(err)
-
- });
- },
-
- productdetails(id){
- uni.navigateTo({
- url:`/pages/product/product?id=${id}`
- })
- },
- }
- }
- </script>
- <style scoped>
- @import url("./subject.css");
- </style>
|