Browse Source

修改价格指数/关注纸品品类;wz

featrue/v4.3
wangzhen 5 years ago
parent
commit
aed48051ff
7 changed files with 122 additions and 5 deletions
  1. 7
      pages/api/moment.js
  2. 1
      pages/api/ztb.js
  3. 7
      pages/mall/price-index/index.js
  4. 95
      pages/moment/paper/index.js
  5. 6
      pages/moment/paper/index.json
  6. 10
      pages/moment/paper/index.wxml
  7. 1
      pages/moment/paper/index.wxss

7
pages/api/moment.js

@ -34,7 +34,9 @@ const likeMoment = (params) => mPost(`/information-center/article-reply/like-or-
const likeComment = (params) => mPost(`/information-center/article-reply/like-or-cancel/reply`, params, mconfig)
// /article-reply/reply 评论
const commentMoment = (params) => mPost(`/information-center/article-reply/reply`, params, mconfig)
const getCategoryPrice = (params) => mGet(`/information-center/getPaperCategoryPrice`, params, mconfig)
const getCategoryPrice = (params) => mGet(`/information-center/getPaperCategoryPrice/new`, params, mconfig)
const getCategoryList = (params) => mGet(`/information-center/paper-index-category`, params, mconfig)
export {
mconfig,
@ -50,5 +52,6 @@ export {
likeMoment,
likeComment,
commentMoment,
getCategoryPrice
getCategoryPrice,
getCategoryList
}

1
pages/api/ztb.js

@ -136,6 +136,7 @@ const getPaperMillOfInformationList = (params) => mGet(`/recycle-service/get/pap
const feedbackMillInformation = (params) => mPost(`/recycle-service/feedback/mill-information`, params, zconfig)
export {
zconfig,
loginToken,

7
pages/mall/price-index/index.js

@ -122,7 +122,8 @@ Page({
if(index == 0){
element.list.forEach(item => {
categoriesList.push(item.data.substring(5))
var price = math.times(item.unitPrice, 1000)
// var price = math.times(item.unitPrice, 1000)
var price = item.unitPrice
if(min > price){
min = price
}
@ -133,7 +134,7 @@ Page({
})
} else {
element.list.forEach(item => {
var price = math.times(item.unitPrice, 1000)
var price = item.unitPrice
if(min > price){
min = price
}
@ -141,7 +142,7 @@ Page({
})
}
var series = {
name: element.list[0].name,
name: element.name,
data: dataList,
format: function (val, name) {
return val + '元/吨'

95
pages/moment/paper/index.js

@ -0,0 +1,95 @@
// pages/moment/paper/index.js
import { getCategoryList } from "../../api/moment"
const util = require('../../../utils/util')
const storage = require('../../../utils/storage')
const event = require('../../../utils/event.js')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
categoryList: [],
cateIds: null,
cateIdList: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.showLoading({
title: '加载中',
mask: true
})
this.data.cateIds = storage.get('cateIdList' + app.globalData.userInfo.userId)
if(!util.isEmpty(this.data.cateIds)){
this.data.cateIdList = this.data.cateIds.toString().split(',')
}
getCategoryList().then(result => {
//成功回调
if(!util.isEmpty(this.data.cateIds)){
for (let index = 0; index < result.data.records.length; index++) {
if(this.checkCategory(result.data.records[index].id)){
result.data.records[index].checked = true
}
}
}
this.setData({categoryList: result.data.records})
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
})
},
checkCategory: function(id){
if(!this.data.cateIdList || !this.data.cateIdList.length){
return false
}
for (let index = 0; index < this.data.cateIdList.length; index++) {
if(id == this.data.cateIdList[index]){
return true
}
}
return false
},
checkPaper: function(e) {
var index = e.target.dataset.index
var item = this.data.categoryList[index]
if(item.checked){
this.setData({ ['categoryList[' + index + '].checked']: !item.checked})
return
}
var sum = 0
for (let i = 0; i < this.data.categoryList.length; i++) {
if(this.data.categoryList[i].checked){
sum++
}
}
if(sum >= 5){
util.showToast('最多只能关注5个纸品')
return
}
this.setData({ ['categoryList[' + index + '].checked']: !item.checked})
},
onUnload: function(){
var cateString = ''
for (let i = 0; i < this.data.categoryList.length; i++) {
if(this.data.categoryList[i].checked){
if(util.isEmpty(cateString)){
cateString = this.data.categoryList[i].id
} else {
cateString += ',' + this.data.categoryList[i].id
}
}
}
if(util.isEmpty(cateString) && util.isEmpty(this.data.cateIds)){
return
}
if(cateString != this.data.cateIds){
storage.put('cateIdList' + app.globalData.userInfo.userId, cateString)
event.emit('EventMessage', { what: 502, desc: 'CateChange' })
}
}
})

6
pages/moment/paper/index.json

@ -0,0 +1,6 @@
{
"usingComponents": {
"wux-cell-group": "/components/cell-group/index",
"wux-cell": "/components/cell/index"
}
}

10
pages/moment/paper/index.wxml

@ -0,0 +1,10 @@
<!--pages/moment/paper/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">纸品列表</view>
</cu-custom>
<wux-cell-group>
<wux-cell wx:for="{{categoryList}}" wx:key="index" title="{{item.name}}" data-index="{{index}}" bind:click="checkPaper">
<image slot="footer" style="width:48rpx;height:48rpx;" src="/assets/image/ico_checked.png" wx:if="{{item.checked}}"></image>
<image slot="footer" style="width:48rpx;height:48rpx;" src="/assets/image/ico_uncheck.png" wx:else></image>
</wux-cell>
</wux-cell-group>

1
pages/moment/paper/index.wxss

@ -0,0 +1 @@
/* pages/moment/paper/index.wxss */
Loading…
Cancel
Save