diff --git a/api/moment.js b/api/moment.js index c7e022e..9df1d96 100644 --- a/api/moment.js +++ b/api/moment.js @@ -37,6 +37,8 @@ const commentMoment = (params) => mPost(`/information-center/article-reply/reply const getCategoryPrice = (params) => mGet(`/information-center/getPaperCategoryPrice/new`, params, mconfig) const getCategoryList = (params) => mGet(`/information-center/paper-index-category`, params, mconfig) +const getCategoryType = (params) => mGet(`/ztb-market-information-service/get/scrap-paper-main-category`, params, mconfig) +const getMomentList = (params) => mGet(`/ztb-market-information-service/get/price-compare-info/by-scrap-paper-main-category`, params, mconfig) export { mconfig, @@ -53,5 +55,7 @@ export { likeComment, commentMoment, getCategoryPrice, - getCategoryList + getCategoryList, + getCategoryType, + getMomentList } \ No newline at end of file diff --git a/components/button/index.wxss b/components/button/index.wxss index 0d1aea2..66eb9d9 100644 --- a/components/button/index.wxss +++ b/components/button/index.wxss @@ -108,6 +108,17 @@ border-radius: 50rpx; } +.wux-button--city { + min-height: 64rpx!important; + font-size: 28rpx; + line-height: 56rpx; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + max-width: 150rpx; + width: 150rpx; +} + .wux-button--sale { padding: 4rpx 24rpx 2rpx 24rpx; min-width: 180rpx; @@ -407,11 +418,11 @@ .wux-button--stable.wux-button--outline { border-color: #b2b2b2!important; background-color: transparent!important; - color: #b2b2b2!important; + color: #333!important; } .wux-button--stable.wux-button--clear.wux-button--hover { background-color: rgba(0,0,0,0)!important; - color: #b2b2b2!important + color: #333!important } .wux-button--stable.wux-button--hover { background-color: #dfdfdf!important; diff --git a/components/date-picker/index.wxml b/components/date-picker/index.wxml index ac3c35a..a17907a 100644 --- a/components/date-picker/index.wxml +++ b/components/date-picker/index.wxml @@ -1,45 +1,22 @@ - + - {{ toolbar.cancelText }} + {{ toolbar.cancelText }} {{ toolbar.title }} - {{ toolbar.confirmText }} + {{ toolbar.confirmText }} - + - + \ No newline at end of file diff --git a/components/date-picker/index.wxss b/components/date-picker/index.wxss index 3f12a5c..32bc4ef 100644 --- a/components/date-picker/index.wxss +++ b/components/date-picker/index.wxss @@ -1,10 +1,11 @@ .wux-date-picker__toolbar { position: relative; width: 100%; - font-size: 34rpx; + font-size: 28rpx; line-height: 1.5; color: rgba(0,0,0,.85); - background: #f7f7f8 + /* background: #f7f7f8 */ + border-bottom: 1rpx solid #f3f3f3 } .wux-date-picker__toolbar::before { content: " "; @@ -29,7 +30,7 @@ display: block; width: 100%; padding: 0; - font-size: 34rpx; + font-size: 28rpx; font-weight: 400; line-height: 88rpx; color: rgba(0,0,0,.85); diff --git a/pages/agent/fragment/index.js b/pages/agent/fragment/index.js index 8409e7f..fb70ef9 100644 --- a/pages/agent/fragment/index.js +++ b/pages/agent/fragment/index.js @@ -81,6 +81,9 @@ Component({ searchList: function(){ util.navigateTo('/pages/mall/search-list/index') }, + chooseCity: function(){ + this.triggerEvent("picker", {type: 2, cityId: this.data.form.cityId}) + }, toAbility: function(){ util.navigateTo('/pages/agent/ability/index') }, @@ -93,6 +96,15 @@ Component({ this.setData({ tabList: this.data.tabList, scrolled: this.data.cateList.length >= 5 }) }) }, + onCityChange: function({ detail }){ + for (let index = 0; index < this.data.cateList.length; index++) { + if(this.data.cateList[index].cityId == detail.cityId){ + detail.index = index + this.onTabChange({detail}) + break + } + } + }, onTabChange: function ({ detail }) { if (this.data.tabIndex == Number(detail.index)) { return diff --git a/pages/agent/fragment/index.wxml b/pages/agent/fragment/index.wxml index f37db08..df36402 100644 --- a/pages/agent/fragment/index.wxml +++ b/pages/agent/fragment/index.wxml @@ -6,6 +6,7 @@ 输入纸名/品名/纸厂/规格 + diff --git a/pages/article/feedback/index.js b/pages/article/feedback/index.js index 449ffdd..75f8f99 100644 --- a/pages/article/feedback/index.js +++ b/pages/article/feedback/index.js @@ -3,7 +3,6 @@ const util = require('../../../utils/util') const app = getApp() Page({ - /** * 页面的初始数据 */ @@ -22,7 +21,6 @@ Page({ type: null } }, - /** * 生命周期函数--监听页面加载 */ diff --git a/pages/index/index.js b/pages/index/index.js index b1bf847..8886331 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,5 +1,5 @@ import { config, getUserInfo } from "../../api/user" -import { zconfig, loginToken, getBaseInfo, getPopupInfo } from "../../api/ztb" +import { zconfig, loginToken, getBaseInfo, getPopupInfo, getFactoryCity } from "../../api/ztb" import { pconfig } from "../../api/payment" import { mconfig } from "../../api/moment" const util = require('../../utils/util') @@ -28,7 +28,10 @@ Page({ path: null, landInfo: null, visible: false, - show: false + show: false, + hotList: [], + cityId: null, + visible2: false }, /************************************** 初始化流程 ********************************************/ onLoad: function (options) { @@ -166,6 +169,7 @@ Page({ }) }, toIndex: function () { + this.fetchRegionList() if (!app.globalData.token) { wx.hideLoading() this.defaultIndex() @@ -232,13 +236,17 @@ Page({ }, // 弹出框的处理; onClose: function () { - this.setData({ visible: false, landInfo: null }) + this.setData({ visible: false, landInfo: null, visible2: false }) }, onImageLoad: function () { this.setData({ visible: true }) }, - onCalendarClick: function(){ - this.setData({ show: true }) + onPicker: function({detail}){ + if(detail.type == 1){ + this.setData({ show: true }) + } else if(detail.type == 2 && this.data.cityList && this.data.cityList.length){ + this.setData({ visible2: true, cityId: detail.cityId }) + } }, onVisibleChange({detail}) { this.setData({ show: detail.visible }) @@ -264,6 +272,36 @@ Page({ } util.navigateTarget(this.data.landInfo.ruleRedirectInfo) }, + fetchRegionList: function () { + var hotstring = storage.get('ztb-city-list') + var hotList = [] + if(!util.isEmpty(hotstring)){ + hotList = JSON.parse(hotstring) + } + getFactoryCity().then(result => { + this.setData({ cityList: result.data, hotList }) + }) + }, + clickCity: function(e){ + this.setData({cityId: e.currentTarget.dataset.id, visible2: false }) + if(fragments[2].onCityChange){ + fragments[2].onCityChange({detail: {cityId: e.currentTarget.dataset.id}}) + } + if(!util.isEmpty(e.currentTarget.dataset.index)){ + var item = this.data.cityList[e.currentTarget.dataset.index] + var flag = false + for (let index = 0; index < this.data.cityList.length; index++) { + if(this.data.cityList[index].cityId == item.cityId){ + flag = true + break + } + } + if(!flag){ + hotList.push(item) + storage.put('ztb-hot-list', JSON.stringify(hotList)) + } + } + }, onUnload: function(){ event.remove('EventMessage', this) }, @@ -279,5 +317,5 @@ Page({ title: '纸通宝--废纸交易、最新情报、最优资讯', path: '/pages/index/index' } - }, + } }) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json index 65b2f90..d141da7 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -1,12 +1,15 @@ { "usingComponents": { - "mall": "/pages/moment/fragment/index", + "moment": "/pages/moment/fragment/index", "article": "/pages/mall/fragment/index", "agent": "/pages/agent/fragment/index", "home": "/pages/home/index/index", "wux-date-picker": "/components/date-picker/index", "wux-image": "/components/image/index", "wux-dialog": "/components/dialog/index", + "wux-grids": "/components/grids/index", + "wux-grid": "/components/grid/index", + "wux-button": "/components/button/index", "wux-popup": "/components/popup/index" } } \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index b333e36..237fd60 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -3,10 +3,10 @@
- + - + @@ -44,6 +44,39 @@ + + + + 选择城市 + 取消 + + + 历史选择 + + + + + + + {{item.cityName}} + + + + + + 全部城市 + + + + + + {{item.cityName}} + + + + + + function tabImage(tabIndex, index) { diff --git a/pages/index/index.wxss b/pages/index/index.wxss index bd54354..ecacb86 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -24,4 +24,8 @@ .wux-landscape__inner > image { width: 100%; max-width: 100% +} + +.button--hover { + background-color: #ececec } \ No newline at end of file diff --git a/pages/mall/fragment/index.js b/pages/mall/fragment/index.js index b4cb08b..349ca82 100644 --- a/pages/mall/fragment/index.js +++ b/pages/mall/fragment/index.js @@ -1,11 +1,12 @@ // pages/message/index.js import { getFactoryPrice, getBannerList } from "../../../api/ztb" -import { getPreferList } from "../../../api/moment" +import { getCategoryType, getPreferList, getMomentList } from "../../../api/moment" const event = require('../../../utils/event') const storage = require('../../../utils/storage') const util = require('../../../utils/util') const app = getApp() -var form = {} +var form = {sortBy: 1, pageNum: 10, pageSize: 1, categoryId: ''} +var typeList = [] Component({ options: { @@ -26,7 +27,7 @@ Component({ firstShow: false, bannerList: [], momentList: [], - tabList: [ '黄纸', '白纸', '灰纸', '杂纸' ], + tabList: [], tabIndex: 0, requesting: false, orderList: [], @@ -62,7 +63,17 @@ Component({ getPreferList().then(result => { this.setData({ momentList: result.data.records.slice(0, 3) }) }) - this.fetchAgentList() + getCategoryType().then(result => { + typeList = result.data + var tabList = [] + for (let index = 0; index < typeList.length; index++) { + tabList.push(typeList[index].categoryName) + } + form.categoryId = typeList[0].categoryId + console.log(form) + this.setData({ tabList }) + this.fetchAgentList() + }) } this.data.firstShow = true var bannerstring = storage.get('ztb-banner-list') @@ -119,7 +130,7 @@ Component({ if(this.data.tabIndex == Number(detail.index)){ return } - form.cateId = Number(detail.index) + form.categoryId = typeList[Number(detail.index)].categoryId this.fetchAgentList() }, topBubble: function(e){ @@ -130,7 +141,7 @@ Component({ if(!util.isEmpty(e.currentTarget.dataset.index)){ this.data.sortIndex = Number(e.currentTarget.dataset.index) if(this.data.popover){ - form.sort = this.data.sortIndex + form.sortBy = this.data.sortIndex this.fetchAgentList() } } @@ -142,7 +153,8 @@ Component({ return } this.setData({ requesting: true, orderList: [] }) - getFactoryPrice(form).then(result => { + getMomentList(form).then(result => { + console.log(result) if (result.data.records.length) { this.setData({ orderList: result.data.records, requesting: false }) } else { diff --git a/pages/mall/fragment/index.wxml b/pages/mall/fragment/index.wxml index ac4ce71..bd07d26 100644 --- a/pages/mall/fragment/index.wxml +++ b/pages/mall/fragment/index.wxml @@ -56,7 +56,7 @@ - + 价格比一比 @@ -70,12 +70,12 @@ - + - + @@ -88,5 +88,6 @@ 查看更多行情 + \ No newline at end of file diff --git a/pages/moment/fragment/index.js b/pages/moment/fragment/index.js index 5ad206d..66a12ce 100644 --- a/pages/moment/fragment/index.js +++ b/pages/moment/fragment/index.js @@ -65,7 +65,7 @@ Component({ } }, chooseCalendar: function(){ - this.triggerEvent("calendar", {}) + this.triggerEvent("picker", {type: 1}) }, onCalendarChange: function(date){ console.log(date)