Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
6373c0e727
14 changed files with 160 additions and 65 deletions
  1. 6
      api/moment.js
  2. 15
      components/button/index.wxss
  3. 51
      components/date-picker/index.wxml
  4. 7
      components/date-picker/index.wxss
  5. 12
      pages/agent/fragment/index.js
  6. 1
      pages/agent/fragment/index.wxml
  7. 2
      pages/article/feedback/index.js
  8. 50
      pages/index/index.js
  9. 5
      pages/index/index.json
  10. 37
      pages/index/index.wxml
  11. 4
      pages/index/index.wxss
  12. 26
      pages/mall/fragment/index.js
  13. 7
      pages/mall/fragment/index.wxml
  14. 2
      pages/moment/fragment/index.js

6
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
}

15
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;

51
components/date-picker/index.wxml

@ -1,45 +1,22 @@
<wux-popup
position="bottom"
visible="{{ popupVisible }}"
hasHeader="{{ false }}"
hasFooter="{{ false }}"
mountOnEnter="{{ false }}"
safeArea="bottom"
bind:close="close"
bind:closed="onClosed"
>
<wux-popup position="bottom" visible="{{ popupVisible }}" hasHeader="{{ false }}" hasFooter="{{ false }}"
mountOnEnter="{{ false }}" safeArea="bottom" bind:close="close" bind:closed="onClosed">
<view class="{{ classes.wrap }}" wx:if="{{ mounted }}">
<view class="{{ classes.toolbar }}" wx:if="{{ toolbar }}" catchtouchmove="noop">
<view class="{{ classes.inner }}">
<view class="{{ classes.cancel }}" hover-class="{{ classes.hover }}" bindtap="onCancel" wx:if="{{ toolbar.cancelText }}">{{ toolbar.cancelText }}</view>
<view class="{{ classes.cancel }}" hover-class="{{ classes.hover }}" bindtap="onCancel"
wx:if="{{ toolbar.cancelText }}">{{ toolbar.cancelText }}</view>
<view class="{{ classes.title }}">{{ toolbar.title }}</view>
<view class="{{ classes.confirm }}" hover-class="{{ classes.hover }}" bindtap="onConfirm" wx:if="{{ toolbar.confirmText }}">{{ toolbar.confirmText }}</view>
<view class="{{ classes.confirm }}" hover-class="{{ classes.hover }}" bindtap="onConfirm"
wx:if="{{ toolbar.confirmText }}">{{ toolbar.confirmText }}</view>
</view>
</view>
<wux-date-picker-view
id="wux-picker"
multiPickerPrefixCls="{{ multiPickerPrefixCls }}"
pickerPrefixCls="{{ pickerPrefixCls }}"
value="{{ inputValue }}"
itemHeight="{{ itemHeight }}"
itemStyle="{{ itemStyle }}"
indicatorStyle="{{ indicatorStyle }}"
indicatorClass="{{ indicatorClass }}"
maskStyle="{{ maskStyle }}"
maskClass="{{ maskClass }}"
labelAlign="{{ labelAlign }}"
mode="{{ mode }}"
minuteStep="{{ minuteStep }}"
use12Hours="{{ use12Hours }}"
minDate="{{ minDate }}"
maxDate="{{ maxDate }}"
minHour="{{ minHour }}"
maxHour="{{ maxHour }}"
minMinute="{{ minMinute }}"
maxMinute="{{ maxMinute }}"
lang="{{ lang }}"
bind:valueChange="onValueChange"
/>
<wux-date-picker-view id="wux-picker" multiPickerPrefixCls="{{ multiPickerPrefixCls }}"
pickerPrefixCls="{{ pickerPrefixCls }}" value="{{ inputValue }}" itemHeight="{{ itemHeight }}"
itemStyle="{{ itemStyle }}" indicatorStyle="{{ indicatorStyle }}" indicatorClass="{{ indicatorClass }}"
maskStyle="{{ maskStyle }}" maskClass="{{ maskClass }}" labelAlign="{{ labelAlign }}" mode="{{ mode }}"
minuteStep="{{ minuteStep }}" use12Hours="{{ use12Hours }}" minDate="{{ minDate }}" maxDate="{{ maxDate }}"
minHour="{{ minHour }}" maxHour="{{ maxHour }}" minMinute="{{ minMinute }}" maxMinute="{{ maxMinute }}"
lang="{{ lang }}" bind:valueChange="onValueChange" />
</view>
</wux-popup>
<slot></slot>
<slot></slot>

7
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);

12
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

1
pages/agent/fragment/index.wxml

@ -6,6 +6,7 @@
<image src="/assets/image/icon-search.png" style="height: 30rpx;width: 30rpx;margin-left: 16rpx"></image>
<text class="text-gray text-sm" style="flex: 1;margin-left: 8rpx">输入纸名/品名/纸厂/规格</text>
</view>
<image src="/assets/image/icon-calendar.png" style="height: 42rpx;width: 42rpx;margin-left: 24rpx;" bindtap="chooseCity"></image>
</view>
</view>

2
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
}
},
/**
* 生命周期函数--监听页面加载
*/

50
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'
}
},
}
})

5
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"
}
}

37
pages/index/index.wxml

@ -3,10 +3,10 @@
<article id="{{TabList[0].value}}" city-name="{{cityName}}" bind:click="onAgentClick"/>
</swiper-item>
<swiper-item catchtouchmove="stopTouchMove">
<mall id="{{TabList[1].value}}" city-name="{{cityName}}" bind:calendar="onCalendarClick"/>
<moment id="{{TabList[1].value}}" city-name="{{cityName}}" bind:picker="onPicker"/>
</swiper-item>
<swiper-item catchtouchmove="stopTouchMove">
<agent id="{{TabList[2].value}}" />
<agent id="{{TabList[2].value}}" bind:picker="onPicker"/>
</swiper-item>
<swiper-item catchtouchmove="stopTouchMove">
<home id="{{TabList[3].value}}" />
@ -44,6 +44,39 @@
<wux-dialog id="wux-dialog" />
<wux-date-picker visible="{{ show }}" controlled mode="date" min-date="{{minDate}}" max-date="{{maxDate}}" value="{{ calendar }}" lang="zh_CN" bind:confirm="onConfirm" bind:visibleChange="onVisibleChange" />
<wux-popup position="bottom" visible="{{ visible2 }}" mask="{{ true }}" bind:close="onClose">
<view class="flex flex-justify" style="height: 90rpx;border-bottom: 1rpx solid #f3f3f3;">
<view style="width: 120rpx;"></view>
<view class="text-black text-sg text-bold">选择城市</view>
<view class="text-gray text-df" hover-class="button--hover" style="width: 120rpx;line-height: 90rpx;" bindtap="onClose">取消</view>
</view>
<view class="flex flex-justify" style="padding: 24rpx 32rpx 0rpx 32rpx;" wx:if="{{hotList.length}}">
<view class="text-black text-df text-bold">历史选择</view>
<text class="cuIcon-delete" style="font-size: 17px" bindtap="clearHistory"></text>
</view>
<view class="bg-white" style="padding: 24rpx;" wx:if="{{hotList.length}}">
<wux-grids col="4" bordered="{{ false }}">
<wux-grid wx:for="{{hotList}}" wx:key="index" hover-class="none">
<view style="width: 160rpx;margin-bottom: 16rpx;">
<wux-button outline="{{cityId != item.cityId}}" block type="{{cityId == item.cityId ? 'positive' : 'stable'}}" size="city" data-id="{{item.cityId}}" bind:click="clickCity">{{item.cityName}}</wux-button>
</view>
</wux-grid>
</wux-grids>
</view>
<view class="flex flex-justify" style="padding: 24rpx 32rpx 0rpx 32rpx;">
<view class="text-black text-df text-bold">全部城市</view>
</view>
<view class="bg-white" style="padding: 24rpx;">
<wux-grids col="4" bordered="{{ false }}">
<wux-grid wx:for="{{cityList}}" wx:key="index" hover-class="none">
<view style="width: 160rpx;margin-bottom: 16rpx;">
<wux-button outline="{{cityId != item.cityId}}" block type="{{cityId == item.cityId ? 'positive' : 'stable'}}" size="city" data-id="{{item.cityId}}" data-index="{{index}}" bind:click="clickCity">{{item.cityName}}</wux-button>
</view>
</wux-grid>
</wux-grids>
</view>
</wux-popup>
<wxs module="tabImage">
function tabImage(tabIndex, index) {

4
pages/index/index.wxss

@ -24,4 +24,8 @@
.wux-landscape__inner > image {
width: 100%;
max-width: 100%
}
.button--hover {
background-color: #ececec
}

26
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 {

7
pages/mall/fragment/index.wxml

@ -56,7 +56,7 @@
</view>
</view>
<view class="bg-white" style="margin-top:16rpx;border-radius: 24rpx;">
<view class="bg-white" style="margin-top:16rpx;border-radius: 24rpx 24rpx 0rpx 0rpx;">
<view class="flex flex-justify" style="padding: 0rpx 24rpx;height: 88rpx;">
<view class="text-lg text-bold text-black">价格比一比</view>
<view style="box-sizing: border-box;position: relative">
@ -70,12 +70,12 @@
</bubble-popup>
</view>
</view>
<view class="bg-white" style="height:90rpx;border-bottom:2rpx solid #f3f3f3;border-top:2rpx solid #f3f3f3">
<view class="bg-white" style="height:90rpx;border-bottom:2rpx solid #f3f3f3;border-top:2rpx solid #f3f3f3" wx:if="{{tabList.length}}">
<wux-tabi tab-data="{{tabList}}" tab-index="{{tabIndex}}" padding="{{12}}" line-height="{{3}}" bind:change="onTabChange"></wux-tabi>
</view>
</view>
<wux-skeleton active wx:if="{{!orderList.length}}">
<view class="flex" style="padding:16rpx 24rpx">
<view class="flex bg-white" style="padding: 24rpx">
<wux-skeleton-paragraph rounded rows="20" wux-class="case3-class" />
</view>
</wux-skeleton>
@ -88,5 +88,6 @@
<view class="flex flex-center" style="padding: 24rpx;" wx:if="{{orderList.length}}">
<wux-button id="moment" outline type="stable" size="small" bind:click="gridTap">查看更多行情</wux-button>
</view>
<view style="height: 24rpx;" wx:else></view>
</scroll-view>

2
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)

Loading…
Cancel
Save