4 changed files with 0 additions and 200 deletions
Unified View
Diff Options
-
143pages/goods/fragment/index.js
-
15pages/goods/fragment/index.json
-
41pages/goods/fragment/index.wxml
-
1pages/goods/fragment/index.wxss
@ -1,143 +0,0 @@ |
|||||
// pages/agent/index/index.js
|
|
||||
import { paperCategoryList, getMiniProxyList } from "../../../api/ztb" |
|
||||
const app = getApp() |
|
||||
const statusList = [1, 2] |
|
||||
|
|
||||
Component({ |
|
||||
options: { |
|
||||
addGlobalClass: true, |
|
||||
multipleSlots: true |
|
||||
}, |
|
||||
/** |
|
||||
* 页面的初始数据 |
|
||||
*/ |
|
||||
data: { |
|
||||
height: app.globalData.fragmentHeight - 90, |
|
||||
kg: app.globalData.kg, |
|
||||
loading: true, |
|
||||
requesting: false, |
|
||||
finished: false, |
|
||||
cateList: [], |
|
||||
cateScroll: false, |
|
||||
tabiList: [], |
|
||||
pageIndex: 0, |
|
||||
top: 0, |
|
||||
orderList: [], |
|
||||
form: { |
|
||||
firstCategoryId: '', |
|
||||
bidType: statusList[0], |
|
||||
pageNum: 1, |
|
||||
pageSize:15 |
|
||||
}, |
|
||||
firstShow: false |
|
||||
}, |
|
||||
methods: { |
|
||||
onRestart: function(){ |
|
||||
if (!this.data.firstShow) { |
|
||||
this.setData({ height: app.globalData.fragmentHeight - 90, kg: app.globalData.kg }) |
|
||||
this.fetchCateList() |
|
||||
this.fetchGoodsList() |
|
||||
} |
|
||||
this.data.firstShow = true |
|
||||
}, |
|
||||
fetchCateList: function(){ |
|
||||
paperCategoryList({ type: 1 }).then(result => { |
|
||||
var tabList = ['全部'] |
|
||||
var size = 0 |
|
||||
for (let index = 0; index < result.data.length; index++) { |
|
||||
tabList.push(result.data[index].name) |
|
||||
size += result.data[index].name.length |
|
||||
} |
|
||||
this.data.cateList = result.data |
|
||||
this.setData({ tabiList: tabList, cateScroll: size > 14 }) |
|
||||
}) |
|
||||
}, |
|
||||
onCategoryChange: function ({detail}) { |
|
||||
if(this.data.pageIndex == Number(detail.index)){ |
|
||||
return |
|
||||
} |
|
||||
this.data.pageIndex = Number(detail.index) |
|
||||
if(this.data.pageIndex == 0){ |
|
||||
this.data.form.firstCategoryId = '' |
|
||||
} else { |
|
||||
this.data.form.firstCategoryId = this.data.cateList[this.data.pageIndex - 1].id |
|
||||
} |
|
||||
this.onRefreshList() |
|
||||
}, |
|
||||
onTabChange: function (e) { |
|
||||
if (this.data.form.bidType == Number(e.currentTarget.dataset.index)) { |
|
||||
return |
|
||||
} |
|
||||
var tabIndex = Number(e.currentTarget.dataset.index) |
|
||||
// this.data.form.bidType = statusList[this.data.tabIndex]
|
|
||||
this.data.form.firstCategoryId = '' |
|
||||
this.setData({ pageIndex: 0, ['form.bidType']: tabIndex }) |
|
||||
this.onRefreshList() |
|
||||
}, |
|
||||
// 下拉刷新...
|
|
||||
onRefreshList: function () { |
|
||||
if (this.data.requesting) { |
|
||||
return |
|
||||
} |
|
||||
this.setData({ |
|
||||
orderList: [], |
|
||||
['form.pageNum']: 1, |
|
||||
loading: true, |
|
||||
finished: false |
|
||||
}) |
|
||||
this.fetchGoodsList() |
|
||||
}, |
|
||||
// 获取特价列表
|
|
||||
fetchGoodsList: function () { |
|
||||
if (this.data.requesting || this.data.finished) { |
|
||||
return |
|
||||
} |
|
||||
if (this.data.loading) { |
|
||||
this.data.requesting = true |
|
||||
} else { |
|
||||
this.setData({ requesting: true }) |
|
||||
} |
|
||||
getMiniProxyList(this.data.form).then(result => { |
|
||||
if (result.data.records.length) { |
|
||||
var respList = result.data.records |
|
||||
let nowList = `orderList[${this.data.orderList.length}]` |
|
||||
var num = result.data.current |
|
||||
var finished = result.data.current >= result.data.pages |
|
||||
if(this.data.form.pageNum == 1){ |
|
||||
this.setData({ |
|
||||
[nowList]: respList, |
|
||||
total: result.data.total, |
|
||||
['form.pageNum']: (num + 1), |
|
||||
top: 0, |
|
||||
finished, |
|
||||
requesting: false, |
|
||||
loading: false |
|
||||
}) |
|
||||
} else { |
|
||||
this.setData({ |
|
||||
[nowList]: respList, |
|
||||
total: result.data.total, |
|
||||
['form.pageNum']: (num + 1), |
|
||||
finished, |
|
||||
requesting: false, |
|
||||
loading: false |
|
||||
}) |
|
||||
} |
|
||||
} else { |
|
||||
this.setData({ finished: true, requesting: false, loading: false }) |
|
||||
} |
|
||||
}).catch(err => { |
|
||||
this.setData({ requesting: false, finished: true, loading: false }) |
|
||||
}) |
|
||||
}, |
|
||||
lookItem: function (e) { |
|
||||
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] |
|
||||
wx.navigateTo({ url: '/pages/mall/detail/index?id=' + item.id }) |
|
||||
}, |
|
||||
offerGood: function(e){ |
|
||||
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] |
|
||||
wx.navigateTo({ url: '/pages/mall/detail/index?id=' + item.id }) |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
}) |
|
||||
@ -1,15 +0,0 @@ |
|||||
{ |
|
||||
"usingComponents": { |
|
||||
"wux-skeleton": "/components/skeleton/index", |
|
||||
"wux-skeleton-avatar": "/components/skeleton-avatar/index", |
|
||||
"wux-skeleton-paragraph": "/components/skeleton-paragraph/index", |
|
||||
"wux-row": "/components/row/index", |
|
||||
"wux-col": "/components/col/index", |
|
||||
"refresh-view": "/components/refresher/index", |
|
||||
"wux-button": "/components/button/index", |
|
||||
"wux-tabi": "/components/tabi/index", |
|
||||
"wux-image": "/components/image/index", |
|
||||
"wux-divider": "/components/divider/index", |
|
||||
"product-item": "/pages/goods/product-item/index" |
|
||||
} |
|
||||
} |
|
||||
@ -1,41 +0,0 @@ |
|||||
<!--pages/agent/index/index.wxml--> |
|
||||
<wxs module="formate" src="../../../pages/formate.wxs"></wxs> |
|
||||
<view class="bg-white" style="height:90rpx;border-bottom: 2rpx solid #eee"> |
|
||||
<wux-tabi scroll="{{cateScroll}}" tab-data="{{tabiList}}" tab-index="{{pageIndex}}" bind:change="onCategoryChange"></wux-tabi> |
|
||||
</view> |
|
||||
|
|
||||
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchGoodsList"> |
|
||||
<view class="bg-white list-empty" style="height:{{ height }}rpx" wx:if="{{!orderList.length}}"> |
|
||||
<view class="load-spinner text-gray" style="margin-bottom:24px" wx:if="{{loading}}" /> |
|
||||
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image> |
|
||||
<view class="text-empty"> |
|
||||
<text wx:if="{{loading}}">正在加载</text> |
|
||||
<view wx:else> |
|
||||
<view wx:if="{{form.bidType == 2}}"> |
|
||||
<view>特价商品发布中,</view> |
|
||||
<view>先去一口价专区逛逛吧。</view> |
|
||||
</view> |
|
||||
<view wx:else>暂无数据</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
<view wx:else> |
|
||||
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex"> |
|
||||
<view wx:for="{{pageItem}}" wx:key="index"> |
|
||||
<view class="bg-white" style="padding: 0rpx 32rpx" wx:if="{{pageIndex != 0 || index != 0 }}"> |
|
||||
<wux-divider show-text="{{ false }}"></wux-divider> |
|
||||
</view> |
|
||||
<product-item item="{{item}}"></product-item> |
|
||||
</view> |
|
||||
</view> |
|
||||
<!--加载更多的UI--> |
|
||||
<view wx:if="{{form.pageNum > 1}}" style="padding:20rpx"> |
|
||||
<wux-divider> |
|
||||
<view class="loadmore"> |
|
||||
<text class="icon--refresher" wx:if="{{!finished}}"></text> |
|
||||
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text> |
|
||||
</view> |
|
||||
</wux-divider> |
|
||||
</view> |
|
||||
</view> |
|
||||
</refresh-view> |
|
||||
@ -1 +0,0 @@ |
|||||
/* pages/agent/index/index.wxss */ |
|
||||
Write
Preview
Loading…
Cancel
Save