Browse Source

数据店铺开发

master
wanghongjun 2 years ago
parent
commit
075b63e5b4
  1. 228
      pages/category/index.vue

228
pages/category/index.vue

@ -18,13 +18,14 @@
</scroll-view>
<!-- 右侧 二级分类 -->
<scroll-view class="cate-right" :scroll-top="scrollTop" :scroll-y="true" :style="{ height: `${scrollHeight}px` }">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ native: true }" @down="downCallback" :up="upOption" @up="upCallback">
<!-- 有数据的时候 -->
<view v-if="list.length>0 && type==0" class="cate-right-cont">
<view class="cate-two-box">
<view class="cate-cont-box">
<view class="flex-two" v-for="(item, idx) in list" :key="idx" @click="onTargetGoods(item.goods_islicode)">
<view class="cate-img-padding">
<view v-if="item.goods_image" class="cate-img">
<view class="cate-img">
<image class="image" mode="scaleToFill" :src="item.goods_image|gdimg"></image>
</view>
</view>
@ -33,6 +34,25 @@
</view>
</view>
</view>
<view v-else-if="userList.length>0 && type==1" class="cate-right-cont">
<view class="cate-two-box">
<view class="cate-cont-box">
<view class="flex-two-data" v-for="(item, idx) in userList" :key="idx" @click="onGoodsList(item.user.name)">
<view class="cate-two-img-padding">
<view v-if="item.user.doorHeadPhoto" class="cate-two-img">
<image class="two-image" mode="scaleToFill" :src="item.user.doorHeadPhoto"></image>
</view>
</view>
<view class="two-name">
<text class="two-name-name">{{ item.user.name }}</text>
<view class="two-name-bottom">
<text class="two-name-type">标的数量{{ item.goods_count}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view v-else-if="informationList.length>0 && type==2" class="cate-right-cont">
<view class="cate-two-box">
<view class="cate-cont-box">
@ -71,16 +91,16 @@
</view>
<!-- 空白提示 -->
<view v-else class="cate-right-cont">
<view class="empty-content">
<view class="empty-icon">
<image class="image" src="/static/empty.png" mode="widthFix"></image>
</view>
<view class="tips">暂无数据</view>
</view>
<!-- <view v-else class="cate-right-cont">-->
<!-- <view class="empty-content">-->
<!-- <view class="empty-icon">-->
<!-- <image class="image" src="/static/empty.png" mode="widthFix"></image>-->
<!-- </view>-->
<!-- <view class="tips">暂无数据</view>-->
<!-- </view>-->
</view>
<!-- </view>-->
</mescroll-body>
</scroll-view>
</view>
@ -92,6 +112,8 @@
<script>
import MescrollCompMixin from '@/components/mescroll-uni/mixins/mescroll-comp'
import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
import { PageCategoryStyleEnum } from '@/common/enum/store/page/category'
@ -104,6 +126,7 @@
import pako from '@/core/pako'
import transaction from 'utils/json/transaction.json'
import {getMoreListData} from "../../api/category";
// ()
@ -126,8 +149,9 @@
Search,
Empty,
Secondary,
MescrollBody
},
mixins: [MescrollCompMixin],
mixins: [MescrollCompMixin,MescrollMixin],
data() {
return {
//
@ -152,6 +176,20 @@
informationList: [], // selected
serviceProvidersList: [], //
transactionList: transaction.data, //
userList: [], //
//
upOption: {
//
auto: true,
// ; 10
page: { size: limit },
// 4
noMoreSize: 4,
//
empty: {
tip: '暂无记录'
}
},
}
},
@ -190,7 +228,24 @@
//
this.getPageData()
//
this.getCatList()
//this.getCatList()
},
/**
* 上拉加载的回调 (页面初始化时也会执行一次)
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10
* @param {Object} page
*/
async upCallback(page) {
const app = this
//
await app.getCatList(page.num)
.then(list => {
console.log('list',list)
const curPageLen = list.data.length
const totalSize = list.total
app.mescroll.endBySize(curPageLen, totalSize)
})
.catch(() => app.mescroll.endErr())
},
//
@ -220,38 +275,52 @@
this.getCatList()
},
//
getCatList(){
getCatList(pageNo = 1){
const app = this
let item = menus[this.curIndex]
let type = item.type
this.type = type
if (type === 1) {
app.type = type
app.page = pageNo
} else if (type === 2) {
this.getConsultingContextSelection()
} else if (type === 3) {
this.getServiceProviders()
} else if (type === 4) {
} else {
let rd={"goods_status":1,"page":this.page,"limit":limit}
this.bindData(rd)
}
return new Promise((resolve, reject) => {
if (type === 1) {
app.getUserData().then(resolveList=> {
resolve(resolveList)
})
} else if (type === 2) {
app.getConsultingContextSelection()
} else if (type === 3) {
app.getServiceProviders()
} else if (type === 4) {
} else {
let rd={"goods_status":1,"page":app.page,"limit":limit}
app.bindData(rd).then(bindList=> {
resolve(bindList)
})
}
})
},
//
onTargetGoods(gislicode){
this.$navTo('pages/goods/detail', { gislicode })
},
//
//
onGoodsList(spname){
this.$navTo("pages/goods/list?k="+spname+'&dt='+new Date().getTime())
},
//
onConsulting(consultingId){
this.$navTo('pages/category/consulting/list', { consultingId })
},
//
async bindData(rd){
GoodsApi.nbgoods(rd).then(res=>{
this.list = res.data.data
this.page=res.data.current_page
this.getHomeListImage()
});
return new Promise((resolve, reject) => {
GoodsApi.nbgoods(rd).then(res=>{
this.list = CategoryApi.getMoreListData(res.data.data,this.list,this.page)
this.getHomeListImage()
resolve(res.data)
});
})
},
async getHomeListImage() {
this.list.forEach((item, key) => {
@ -265,6 +334,21 @@
}
})
},
//
getUserData() {
const app = this
let param = {
page: app.page,
limit: limit,
userType: 2
}
return new Promise((resolve, reject) => {
GoodsApi.souser(param).then(res=>{
app.userList = CategoryApi.getMoreListData(res.data.data,app.userList,this.page)
resolve(res.data)
})
})
},
//
getConsultingContextSelection() {
const app = this
@ -472,20 +556,74 @@
padding: 16rpx 16rpx 4rpx 16rpx;
}
.cate-img {
position: relative;
width: 100%;
padding-top: 100%;
.image {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius: 10rpx;
}
}
.cate-img {
position: relative;
width: 100%;
padding-top: 100%;
.image {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius: 10rpx;
}
}
.two-name {
width: 42%;
height: 200rpx;
position: absolute;
display: inline-block;
margin-left: 260rpx;
margin-top: -225rpx;
font-weight: bold;
.two-name-name {
font-size: 26rpx;
color: #444444;
}
.two-name-bottom {
position: absolute;
top: 170rpx;
.two-name-type{
color: #cec7bf;
}
}
}
.flex-two-data{
float: left;
width: 100%;
margin-bottom: 20rpx;
background-color: #f7f7f7;
.cate-two-img-padding {
width: 250rpx;
height: 250rpx;
background-color: #f7f7f7;
margin-right: 20rpx;
padding: 16rpx 16rpx 4rpx 16rpx;
.cate-two-img {
position: relative;
width: 100%;
padding-top: 100%;
.two-image {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius: 10rpx;
}
}
}
}
}
</style>

Loading…
Cancel
Save