14 changed files with 115 additions and 453 deletions
Split View
Diff Options
-
4api/moment.js
-
135pages/agent/factory-fragment/index.js
-
14pages/agent/factory-fragment/index.json
-
38pages/agent/factory-fragment/index.wxml
-
1pages/agent/factory-fragment/index.wxss
-
135pages/agent/focus-fragment/index.js
-
15pages/agent/focus-fragment/index.json
-
41pages/agent/focus-fragment/index.wxml
-
60pages/agent/focus-fragment/index.wxss
-
40pages/moment/attention/index.js
-
42pages/moment/recommend/index.js
-
4pages/moment/recommend/index.wxml
-
35pages/moment/theall/index.js
-
4pages/morder/index/index.js
@ -1,135 +0,0 @@ |
|||
// pages/agent/index/index.js
|
|||
import { getFactoryPrice, getFactoryCity, hasActivity } from "../../../api/ztb" |
|||
const app = getApp() |
|||
|
|||
Component({ |
|||
options: { |
|||
addGlobalClass: true, |
|||
multipleSlots: true |
|||
}, |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
height: app.globalData.fragmentHeight - 90, |
|||
CustomBar: app.globalData.CustomBar, |
|||
kg: app.globalData.kg, |
|||
loading: true, |
|||
requesting: false, |
|||
finished: false, |
|||
tabList: [], |
|||
tabIndex: 0, |
|||
cateList: [], |
|||
scrolled: false, |
|||
top: 0, |
|||
orderList: [], |
|||
form: { |
|||
cityId: '', |
|||
enableSalesAgent: 1, |
|||
pageNum: 1, |
|||
pageSize:15, |
|||
listType: 0 |
|||
}, |
|||
triggered: false, |
|||
firstShow: false, |
|||
hasActivity: false |
|||
}, |
|||
lifetimes: { |
|||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|||
attached: function () { |
|||
|
|||
if(app.globalData.userInfo){ |
|||
hasActivity().then(result => { |
|||
this.setData({ hasActivity: result.data }) |
|||
}) |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
onRestart: function(){ |
|||
if (!this.data.firstShow) { |
|||
this.setData({ height: app.globalData.fragmentHeight - 90, kg: app.globalData.kg }) |
|||
this.fetchRegionList() |
|||
this.fetchPapersList() |
|||
} |
|||
this.data.firstShow = true |
|||
}, |
|||
toAbility: function(){ |
|||
wx.navigateTo({ url: '/pages/agent/ability/index' }) |
|||
}, |
|||
fetchRegionList: function () { |
|||
getFactoryCity().then(result => { |
|||
//成功回调
|
|||
this.data.cateList = [{ cityId: '', cityName: '全部' }].concat(result.data) |
|||
for (let index = 0; index < this.data.cateList.length; index++) { |
|||
this.data.tabList.push(this.data.cateList[index].cityName) |
|||
} |
|||
this.setData({ tabList: this.data.tabList, scrolled: this.data.cateList.length >= 5 }) |
|||
}) |
|||
}, |
|||
onTabChange: function ({ detail }) { |
|||
if (this.data.tabIndex == Number(detail.index)) { |
|||
return |
|||
} |
|||
this.data.tabIndex = Number(detail.index) |
|||
this.data.form.cityId = this.data.cateList[this.data.tabIndex].cityId |
|||
this.onRefreshList() |
|||
}, |
|||
// 下拉刷新...
|
|||
onRefreshList: function () { |
|||
if (this.data.requesting) { |
|||
return |
|||
} |
|||
this.setData({ orderList: [], tabIndex: this.data.tabIndex, ['form.pageNum']: 1, loading: true, finished: false }) |
|||
this.fetchPapersList() |
|||
}, |
|||
// 获取特价列表
|
|||
fetchPapersList: function () { |
|||
if (this.data.requesting || this.data.finished) { |
|||
return |
|||
} |
|||
if (this.data.loading) { |
|||
this.data.requesting = true |
|||
} else { |
|||
this.setData({ requesting: true }) |
|||
} |
|||
getFactoryPrice(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({ requesting: false, finished: true, loading: false, }) |
|||
} |
|||
}).catch(err => { |
|||
//异常回调
|
|||
this.setData({ requesting: false, finished: true, loading: false, }) |
|||
}) |
|||
}, |
|||
goattentionIndex: function () { |
|||
wx.navigateTo({ url: '/pages/home/attention-paper/index' }) |
|||
} |
|||
} |
|||
|
|||
}) |
|||
@ -1,14 +0,0 @@ |
|||
{ |
|||
"component": true, |
|||
"usingComponents": { |
|||
"wux-skeleton": "/components/skeleton/index", |
|||
"wux-skeleton-avatar": "/components/skeleton-avatar/index", |
|||
"wux-skeleton-paragraph": "/components/skeleton-paragraph/index", |
|||
"wux-button": "/components/button/index", |
|||
"refresh-view": "/components/refresher/index", |
|||
"wux-tabi": "/components/tabi/index", |
|||
"wux-image": "/components/image/index", |
|||
"wux-divider": "/components/divider/index", |
|||
"agent-item": "/pages/agent/agent-item/index" |
|||
} |
|||
} |
|||
@ -1,38 +0,0 @@ |
|||
<!--pages/agent/index/index.wxml--> |
|||
<wxs module="formate" src="../../../pages/formate.wxs"></wxs> |
|||
|
|||
<view class="bg-white" style="height: 90rpx;"> |
|||
<wux-tabi scroll="{{scrolled}}" tab-data="{{tabList}}" tab-index="{{tabIndex}}" bind:change="onTabChange"></wux-tabi> |
|||
</view> |
|||
|
|||
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchPapersList"> |
|||
<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">{{loading? '正在加载' : '暂无数据'}}</view> |
|||
</view> |
|||
<view wx:else> |
|||
<view class="bg-white" wx:if="{{hasActivity}}" bindtap="toAbility"> |
|||
<wux-image width="{{750}}" height="{{160}}" nuit="{{'rpx'}}" src="https://img.imgdb.cn/item/603f4f7e360785be54c19c1d.png" mode="aspectFill"> |
|||
<view class="flex flex-center" slot="loading" style="height:146rpx;width:686rpx"> |
|||
<text class="icon--refresher"></text> |
|||
</view> |
|||
</wux-image> |
|||
</view> |
|||
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex"> |
|||
<view wx:for="{{pageItem}}" wx:key="index"> |
|||
<view style="height:16rpx" wx:if="{{pageIndex != 0 || index != 0 }}"></view> |
|||
<agent-item item="{{item}}"></agent-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 */ |
|||
@ -1,135 +0,0 @@ |
|||
import util from "../../../utils/util" |
|||
// pages/agent/index/index.js
|
|||
import { getFactoryPrice, getBaseInfo, updateUserInfo } from "../../../api/ztb" |
|||
const event = require('../../../utils/event') |
|||
const app = getApp() |
|||
|
|||
Component({ |
|||
options: { |
|||
addGlobalClass: true, |
|||
multipleSlots: true |
|||
}, |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
height: app.globalData.fragmentHeight - 90, |
|||
CustomBar: app.globalData.CustomBar, |
|||
kg: app.globalData.kg, |
|||
loading: true, |
|||
requesting: false, |
|||
finished: false, |
|||
tabList: [], |
|||
tabIndex: 0, |
|||
cateList: [], |
|||
scrolled: false, |
|||
top: 0, |
|||
orderList: [], |
|||
form: { |
|||
cityId: '', |
|||
enableSalesAgent: 1, |
|||
pageNum: 1, |
|||
listType: 1 |
|||
} |
|||
}, |
|||
lifetimes: { |
|||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|||
attached: function () { |
|||
this.setData({ height: app.globalData.fragmentHeight, kg: app.globalData.kg }) |
|||
this.fetchPapersList() |
|||
event.on('EventMessage', this, this.onEvent) |
|||
}, |
|||
detached: function () { |
|||
event.remove('EventMessage', this) |
|||
} |
|||
}, |
|||
methods: { |
|||
onEvent: function (message) { |
|||
if (message.what == 1100 || message.what == 1101 || message.what == 888) { |
|||
this.onRefreshList() |
|||
} |
|||
}, |
|||
onRestart: function () { |
|||
if(!app.globalData.userInfo){ |
|||
return |
|||
} |
|||
getBaseInfo().then(result => { |
|||
if (result.data.isSetProxyTag == false) { |
|||
updateUserInfo({ isSetProxyTag: true }).then(result => {}) |
|||
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') |
|||
this.wuxDialog.open({ |
|||
resetOnClose: true, |
|||
title: '温馨提示', |
|||
content: '是否选择关注您常卖的纸厂?', |
|||
buttons: [{ |
|||
text: '取消' |
|||
}, { |
|||
text: '确定', |
|||
type: 'primary', |
|||
onTap(e) { |
|||
util.navigateTo('/pages/home/attention-paper/index') |
|||
} |
|||
}] |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
// 下拉刷新...
|
|||
onRefreshList: function () { |
|||
this.setData({ |
|||
orderList: [], |
|||
['form.pageNum']: 1, |
|||
loading: true, |
|||
finished: false |
|||
}) |
|||
this.fetchPapersList() |
|||
}, |
|||
// 获取特价列表
|
|||
fetchPapersList: function () { |
|||
if (this.data.requesting || this.data.finished) { |
|||
return |
|||
} |
|||
if (this.data.loading) { |
|||
this.data.requesting = true |
|||
} else { |
|||
this.setData({ requesting: true }) |
|||
} |
|||
getFactoryPrice(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({ requesting: false, finished: true, loading: false }) |
|||
} |
|||
}).catch(err => { |
|||
this.setData({ requesting: false, finished: true, loading: false }) |
|||
}) |
|||
}, |
|||
goattentionIndex: function () { |
|||
util.navigateTo('/pages/home/attention-paper/index') |
|||
} |
|||
} |
|||
|
|||
}) |
|||
@ -1,15 +0,0 @@ |
|||
{ |
|||
"component": true, |
|||
"usingComponents": { |
|||
"wux-skeleton": "/components/skeleton/index", |
|||
"wux-skeleton-avatar": "/components/skeleton-avatar/index", |
|||
"wux-skeleton-paragraph": "/components/skeleton-paragraph/index", |
|||
"wux-button": "/components/button/index", |
|||
"refresh-view": "/components/refresher/index", |
|||
"wux-tabi": "/components/tabi/index", |
|||
"wux-image": "/components/image/index", |
|||
"wux-divider": "/components/divider/index", |
|||
"agent-item": "/pages/agent/agent-item/index", |
|||
"wux-dialog": "/components/dialog/index" |
|||
} |
|||
} |
|||
@ -1,41 +0,0 @@ |
|||
<!--pages/agent/index/index.wxml--> |
|||
<wxs module="formate" src="../../../pages/formate.wxs"></wxs> |
|||
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchPapersList"> |
|||
<view class="bg-white list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length && loading}}"> |
|||
<view class="load-spinner text-gray" style="margin-bottom:24px" /> |
|||
<view class="text-empty">正在加载</view> |
|||
</view> |
|||
<view class="bg-white" style="height:{{height}}rpx" wx:elif="{{!orderList.length}}"> |
|||
<view class="bgImgView"> |
|||
<image class="imgsj" src="https://636c-cloud1-1gjilu3e74c1a18a-1305669442.tcb.qcloud.la/noData.png?sign=c2f746eb85912444f9633f43fedb7fab&t=1631629208" /> |
|||
</view> |
|||
<view class="midText"> |
|||
<text class="midText2">暂无关注</text> |
|||
</view> |
|||
<view class="midText3"> |
|||
<text class="midText4">可前往纸厂列表添加关注</text> |
|||
</view> |
|||
<view class="bottomBtn"> |
|||
<wux-button block type="positive" data-page="{{pageIndex}}" data-index="{{index}}" bind:click="goattentionIndex">添加关注</wux-button> |
|||
</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 style="height:16rpx" wx:if="{{pageIndex != 0 || index != 0 }}"></view> |
|||
<agent-item item="{{item}}"></agent-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> |
|||
|
|||
<wux-dialog id="wux-dialog" /> |
|||
@ -1,60 +0,0 @@ |
|||
/* pages/agent/index/index.wxss */ |
|||
|
|||
.bgImgView { |
|||
width: 100%; |
|||
height: 548rpx; |
|||
padding: 160rpx 186rpx 94rpx 186rpx; |
|||
background-color: white; |
|||
} |
|||
|
|||
.imgsj { |
|||
height: 294rpx; |
|||
width: 378rpx; |
|||
} |
|||
|
|||
.midText { |
|||
width: 100%; |
|||
height: 67rpx; |
|||
padding: 0rpx 279rpx 0rpx 279rpx; |
|||
} |
|||
|
|||
.midText2 { |
|||
font-size: 48rpx; |
|||
color: #000000; |
|||
letter-spacing: 0; |
|||
text-align: left; |
|||
} |
|||
|
|||
.midText3 { |
|||
width: 100%; |
|||
height: 45px; |
|||
padding: 0rpx 199rpx 0rpx 199rpx; |
|||
margin-top: 12rpx; |
|||
} |
|||
|
|||
.midText4 { |
|||
font-size: 32rpx; |
|||
color: rgba(0, 0, 0, 0.75); |
|||
letter-spacing: 0; |
|||
text-align: left; |
|||
} |
|||
.bg-blue{ |
|||
color: #FFFFFF; |
|||
background-color: #008AFF; |
|||
} |
|||
|
|||
.offer-btn { |
|||
width: 480rpx; |
|||
height: 88rpx; |
|||
background: linear-gradient(312deg, rgba(38, 125, 214, 1) 0%, rgba(0, 138, 255, 1) 100%); |
|||
box-shadow: 0px 10px 13px -8px rgba(35, 126, 217, 0.53); |
|||
border-radius: 10rpx; |
|||
color: white; |
|||
font-size: 32rpx; |
|||
margin-left: 32rpx; |
|||
} |
|||
.bottomBtn{ |
|||
width: 100%; |
|||
height: 88rpx; |
|||
padding:0rpx 135rpx 0rpx 135rpx; |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save