|
@@ -14,16 +14,20 @@
|
|
|
</uni-grid-item>
|
|
|
</uni-grid>
|
|
|
</view>
|
|
|
- <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-view" @scroll="scroll">
|
|
|
- <view class="list-scroll-view">
|
|
|
- <view class="thr">
|
|
|
+ <view class="thr">
|
|
|
+ <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
|
|
|
+ <view class="list-scroll-view">
|
|
|
<view class="list" v-for="(item,index) in list" :key="index" @tap="toBuy(item)">
|
|
|
- <image :src="item.file" class="image" mode="aspectFill" />
|
|
|
+ <image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="aspectFill">
|
|
|
+ </image>
|
|
|
<view class="name textOver">{{item.name}}</view>
|
|
|
</view>
|
|
|
+ <view class="is_bottom" v-if="is_bottom">
|
|
|
+ <text>已经到底了!</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- </scroll-view>
|
|
|
+ </scroll-view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -32,60 +36,13 @@
|
|
|
data() {
|
|
|
return {
|
|
|
moduleList: [],
|
|
|
- list: [{
|
|
|
- name: '联想(Lenovo)LT201黑色墨粉盒(适用S1801/LJ2205/M1851/M7206W/M7255F/F2081/LJ2206W/M7256WHF打印机)',
|
|
|
- type: '0',
|
|
|
- file: '/static/lenovo.jpeg',
|
|
|
- brief: '联想(Lenovo)LT201黑色墨粉盒',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '联想(Lenovo)LT201黑色墨粉盒(适用S1801/LJ2205/M1851/M7206W/M7255F/F2081/LJ2206W/M7256WHF打印机)',
|
|
|
- type: '0',
|
|
|
- file: '/static/lenovo.jpeg',
|
|
|
- brief: '联想(Lenovo)LT201黑色墨粉盒',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '联想(Lenovo)LT201黑色墨粉盒(适用S1801/LJ2205/M1851/M7206W/M7255F/F2081/LJ2206W/M7256WHF打印机)',
|
|
|
- type: '0',
|
|
|
- file: '/static/lenovo.jpeg',
|
|
|
- brief: '联想(Lenovo)LT201黑色墨粉盒',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '联想(Lenovo)LT201黑色墨粉盒(适用S1801/LJ2205/M1851/M7206W/M7255F/F2081/LJ2206W/M7256WHF打印机)',
|
|
|
- type: '0',
|
|
|
- file: '/static/lenovo.jpeg',
|
|
|
- brief: '联想(Lenovo)LT201黑色墨粉盒',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '联想(Lenovo)LT201黑色墨粉盒(适用S1801/LJ2205/M1851/M7206W/M7255F/F2081/LJ2206W/M7256WHF打印机)',
|
|
|
- type: '0',
|
|
|
- file: '/static/lenovo.jpeg',
|
|
|
- brief: '联想(Lenovo)LT201黑色墨粉盒',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '联想(Lenovo)LT201黑色墨粉盒(适用S1801/LJ2205/M1851/M7206W/M7255F/F2081/LJ2206W/M7256WHF打印机)',
|
|
|
- type: '0',
|
|
|
- file: '/static/lenovo.jpeg',
|
|
|
- brief: '联想(Lenovo)LT201黑色墨粉盒',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '联想(Lenovo)LT201黑色墨粉盒(适用S1801/LJ2205/M1851/M7206W/M7255F/F2081/LJ2206W/M7256WHF打印机)',
|
|
|
- type: '0',
|
|
|
- file: '/static/lenovo.jpeg',
|
|
|
- brief: '联想(Lenovo)LT201黑色墨粉盒',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '联想(Lenovo)LT201黑色墨粉盒(适用S1801/LJ2205/M1851/M7206W/M7255F/F2081/LJ2206W/M7256WHF打印机)',
|
|
|
- type: '0',
|
|
|
- file: '/static/lenovo.jpeg',
|
|
|
- brief: '联想(Lenovo)LT201黑色墨粉盒',
|
|
|
- }
|
|
|
- ],
|
|
|
+ list: [],
|
|
|
total: 0,
|
|
|
skip: 0,
|
|
|
limit: 6,
|
|
|
page: 0,
|
|
|
- // 返回顶部
|
|
|
+ // 数据是否触底
|
|
|
+ is_bottom: false,
|
|
|
scrollTop: 0,
|
|
|
}
|
|
|
},
|
|
@@ -96,6 +53,12 @@
|
|
|
},
|
|
|
onShow() {
|
|
|
|
|
|
+ },
|
|
|
+ onPullDownRefresh: async function() {
|
|
|
+ const that = this;
|
|
|
+ that.clearPage();
|
|
|
+ await that.search();
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
},
|
|
|
methods: {
|
|
|
async searchToken() {
|
|
@@ -133,10 +96,28 @@
|
|
|
},
|
|
|
async search() {
|
|
|
const that = this;
|
|
|
- let res = await that.$api(`/Module`, 'GET', {
|
|
|
+ let res;
|
|
|
+ res = await that.$api(`/Module`, 'GET', {
|
|
|
is_use: '0'
|
|
|
});
|
|
|
if (res.errcode == '0') that.$set(that, `moduleList`, res.data);
|
|
|
+ let info = {
|
|
|
+ skip: that.skip,
|
|
|
+ limit: that.limit,
|
|
|
+ is_use: '0'
|
|
|
+ }
|
|
|
+ res = await that.$api(`/Good`, 'GET', {
|
|
|
+ ...info
|
|
|
+ })
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ let list = [...that.list, ...res.data];
|
|
|
+ that.$set(that, `list`, list)
|
|
|
+ that.$set(that, `total`, res.total)
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.errmsg,
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
async toSearch(res) {
|
|
|
console.log(res);
|
|
@@ -161,15 +142,18 @@
|
|
|
that.$set(that, `page`, page)
|
|
|
let skip = page * limit;
|
|
|
that.$set(that, `skip`, skip)
|
|
|
- that.searchMarket();
|
|
|
+ that.search();
|
|
|
uni.hideLoading();
|
|
|
- }
|
|
|
+ } else that.$set(that, `is_bottom`, true)
|
|
|
},
|
|
|
- // 计算高度
|
|
|
- scroll: function(e) {
|
|
|
+ toScroll(e) {
|
|
|
const that = this;
|
|
|
- that.old_scrollTop = e.detail.scrollTop
|
|
|
+ let up = that.scrollTop;
|
|
|
+ that.$set(that, `scrollTop`, e.detail.scrollTop);
|
|
|
+ let num = Math.sign(up - e.detail.scrollTop);
|
|
|
+ if (num == 1) that.$set(that, `is_bottom`, false);
|
|
|
},
|
|
|
+ // 清空列表
|
|
|
clearPage() {
|
|
|
const that = this;
|
|
|
that.$set(that, `moduleList`, [])
|
|
@@ -186,6 +170,8 @@
|
|
|
.content {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
+ width: 100vw;
|
|
|
+ height: 100vh;
|
|
|
|
|
|
.one {
|
|
|
width: 100%;
|
|
@@ -193,7 +179,7 @@
|
|
|
|
|
|
.two {
|
|
|
padding: 1vw 2vw;
|
|
|
- background-color: var(--f8Color);
|
|
|
+ background-color: var(--f9Color);
|
|
|
|
|
|
.grid {
|
|
|
display: flex;
|
|
@@ -217,11 +203,13 @@
|
|
|
}
|
|
|
|
|
|
.thr {
|
|
|
+ position: relative;
|
|
|
+ flex-grow: 1;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
flex-wrap: wrap;
|
|
|
padding: 2vw;
|
|
|
- background-color: var(--f8Color);
|
|
|
+ background-color: var(--f9Color);
|
|
|
|
|
|
.list {
|
|
|
position: relative;
|
|
@@ -246,6 +234,26 @@
|
|
|
}
|
|
|
|
|
|
.scroll-view {
|
|
|
- // height: 100vw;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+
|
|
|
+ .list-scroll-view {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .is_bottom {
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
+ text {
|
|
|
+ padding: 2vw 0;
|
|
|
+ display: inline-block;
|
|
|
+ color: var(--f85Color);
|
|
|
+ font-size: var(--font14Size);
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|