Browse Source

情报列表,计算精度问题

featrue/v4.3
DESKTOP-A1SENDA\HUzy 5 years ago
parent
commit
d342681cf9
4 changed files with 60 additions and 30 deletions
  1. 77
      pages/article/allNewInfo/index.js
  2. 4
      pages/article/allNewInfo/index.wxml
  3. 5
      pages/article/newInfo/index.js
  4. 4
      pages/article/newInfo/index.wxml

77
pages/article/allNewInfo/index.js

@ -1,6 +1,9 @@
const util = require('../../../utils/util') const util = require('../../../utils/util')
const math = require('../../../utils/math') //导入模块
const app = getApp() const app = getApp()
import { getPaperMillOfInformationList } from "../../api/ztb"
import {
getPaperMillOfInformationList
} from "../../api/ztb"
Page({ Page({
@ -13,12 +16,12 @@ Page({
orderList: [], orderList: [],
tableSgin: null, tableSgin: null,
loading: false, loading: false,
pximg:'/assets/info/px-mr.png',
querFrom:{
pximg: '/assets/info/px-mr.png',
querFrom: {
queryWay: 1, queryWay: 1,
priceSort:0
priceSort: 0
}, },
factoryList:[]
factoryList: []
}, },
/** /**
@ -30,58 +33,80 @@ Page({
CustomBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 80), CustomBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 80),
height: app.globalData.fragmentHeight - 80 height: app.globalData.fragmentHeight - 80
}) })
this.getPaperMillOfInformationListFct({ queryWay: 1 })
this.getPaperMillOfInformationListFct({
queryWay: 1
})
}, },
toPage: function (e) { toPage: function (e) {
if (e.currentTarget.id == 'toqb') { if (e.currentTarget.id == 'toqb') {
util.navigateTo('/pages/article/index/index') util.navigateTo('/pages/article/index/index')
} }
if(e.currentTarget.id == 'toAttentionPaperFctory'){
if (e.currentTarget.id == 'toAttentionPaperFctory') {
util.navigateTo('/pages/article/attentionPaperFactory/index') util.navigateTo('/pages/article/attentionPaperFactory/index')
} }
if(e.currentTarget.id == 'toFactoryDetails'){
util.navigateTo('/pages/agent/factory/index?id='+e.currentTarget.dataset.factoryid)
if (e.currentTarget.id == 'toFactoryDetails') {
util.navigateTo('/pages/agent/factory/index?id=' + e.currentTarget.dataset.factoryid)
} }
if(e.currentTarget.id == 'toDmai'){
util.navigateTo('/pages/agent/edit/index?id='+e.currentTarget.dataset.fcid+'&categoryId='+e.currentTarget.dataset.paperid)
if (e.currentTarget.id == 'toDmai') {
util.navigateTo('/pages/agent/edit/index?id=' + e.currentTarget.dataset.fcid + '&categoryId=' + e.currentTarget.dataset.paperid)
} }
}, },
changeTable: function (e) { changeTable: function (e) {
var a = e.currentTarget.id var a = e.currentTarget.id
if (e.currentTarget.id === this.data.tableSgin) { if (e.currentTarget.id === this.data.tableSgin) {
this.setData({ tableSgin: null })
this.setData({
tableSgin: null
})
} else { } else {
this.setData({ tableSgin: e.currentTarget.id })
this.setData({
tableSgin: e.currentTarget.id
})
} }
}, },
getPaperMillOfInformationListFct(model) { getPaperMillOfInformationListFct(model) {
this.setData({ loading: true })
wx.showLoading({ title: '加载中' })
this.setData({
loading: true
})
wx.showLoading({
title: '加载中'
})
getPaperMillOfInformationList(model).then(res => { getPaperMillOfInformationList(model).then(res => {
this.setData({ orderList: res.data, loading: false })
this.setData({
orderList: res.data,
loading: false
})
wx.hideLoading() wx.hideLoading()
}).catch((e) => { }).catch((e) => {
wx.hideLoading() wx.hideLoading()
}) })
}, },
changeSort:function(){
if(this.data.pximg=='/assets/info/px-mr.png'){
this.setData({ pximg:'/assets/info/px-sx.png' })
this.data.querFrom.priceSort=1
changeSort: function () {
if (this.data.pximg == '/assets/info/px-mr.png') {
this.setData({
pximg: '/assets/info/px-sx.png'
})
this.data.querFrom.priceSort = 1
this.getPaperMillOfInformationListFct(this.data.querFrom) this.getPaperMillOfInformationListFct(this.data.querFrom)
return return
} }
if(this.data.pximg=='/assets/info/px-sx.png'){
this.setData({ pximg:'/assets/info/px-jx.png' })
this.data.querFrom.priceSort=0
if (this.data.pximg == '/assets/info/px-sx.png') {
this.setData({
pximg: '/assets/info/px-jx.png'
})
this.data.querFrom.priceSort = 0
this.getPaperMillOfInformationListFct(this.data.querFrom) this.getPaperMillOfInformationListFct(this.data.querFrom)
return return
} }
if(this.data.pximg=='/assets/info/px-jx.png'){
this.setData({ pximg:'/assets/info/px-mr.png' })
this.data.querFrom.priceSort=0
if (this.data.pximg == '/assets/info/px-jx.png') {
this.setData({
pximg: '/assets/info/px-mr.png'
})
this.data.querFrom.priceSort = 0
this.getPaperMillOfInformationListFct(this.data.querFrom) this.getPaperMillOfInformationListFct(this.data.querFrom)
return return
} }
}, },
mathTimesRtrun: function (text) {
return math.times(text, 1000)
}
}) })

4
pages/article/allNewInfo/index.wxml

@ -57,8 +57,8 @@
</view> </view>
<view class="flex flex-justify" style="margin-top:20rpx" wx:for="{{ item.paperCategoryList }}" wx:for-item="cell" wx:key="index" style="background-color:white;margin-top:10rpx"> <view class="flex flex-justify" style="margin-top:20rpx" wx:for="{{ item.paperCategoryList }}" wx:for-item="cell" wx:key="index" style="background-color:white;margin-top:10rpx">
<view class="text-df {{cell.categoryName>0?'text-red':(cell.categoryName<0?'text-green':'text-black')}}" style="flex:1;text-align: center">{{cell.categoryName|| '---'}}</view> <view class="text-df {{cell.categoryName>0?'text-red':(cell.categoryName<0?'text-green':'text-black')}}" style="flex:1;text-align: center">{{cell.categoryName|| '---'}}</view>
<view class="text-df {{cell.unitPrice>0?'text-red':(cell.unitPrice<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{cell.unitPrice*1000|| 0}}</view>
<view class="text-df {{cell.floatPrice>0?'text-red':(cell.floatPrice<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{cell.floatPrice*1000|| 0}}</view>
<view class="text-df {{cell.unitPrice>0?'text-red':(cell.unitPrice<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{formate.formatePrice(cell.unitPrice)}}</view>
<view class="text-df {{cell.floatPrice>0?'text-red':(cell.floatPrice<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{formate.formatePrice(cell.floatPrice)}}</view>
<view class="text-df {{cell.curDeductionPoint>0?'text-red':(cell.curDeductionPoint<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{cell.curDeductionPoint|| 0}}</view> <view class="text-df {{cell.curDeductionPoint>0?'text-red':(cell.curDeductionPoint<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{cell.curDeductionPoint|| 0}}</view>
<view class="text-df text-balck" style="flex:1;text-align: center" id="toDmai" data-fcId="{{item.paperMillId}}" data-paperId="{{cell.categoryId}}" catchtap="toPage"> <view class="text-df text-balck" style="flex:1;text-align: center" id="toDmai" data-fcId="{{item.paperMillId}}" data-paperId="{{cell.categoryId}}" catchtap="toPage">
<view class="son-table-btn">代卖</view> <view class="son-table-btn">代卖</view>

5
pages/article/newInfo/index.js

@ -1,5 +1,6 @@
// pages/stock/index.js // pages/stock/index.js
const util = require('../../../utils/util') const util = require('../../../utils/util')
const math = require('../../../utils/math') //导入模块
const app = getApp() const app = getApp()
import { import {
getPaperMillOfInformationList, getPaperMillOfInformationList,
@ -123,6 +124,10 @@ Component({
}, },
toMill(e){ toMill(e){
util.navigateTo('/pages/agent/factory/index?id=' + e.currentTarget.id) util.navigateTo('/pages/agent/factory/index?id=' + e.currentTarget.id)
},
mathTimesRtrun:function(text){
return math.times(text, 1000)
} }
} }

4
pages/article/newInfo/index.wxml

@ -83,8 +83,8 @@
</view> </view>
<view class="flex flex-justify" style="margin-top:20rpx" wx:for="{{ item.paperCategoryList }}" wx:for-item="cell" wx:key="index" style="background-color:white;margin-top:10rpx"> <view class="flex flex-justify" style="margin-top:20rpx" wx:for="{{ item.paperCategoryList }}" wx:for-item="cell" wx:key="index" style="background-color:white;margin-top:10rpx">
<view class="text-df {{cell.categoryName>0?'text-red':(cell.categoryName<0?'text-green':'text-black')}}" style="flex:1;text-align: center">{{cell.categoryName|| '---'}}</view> <view class="text-df {{cell.categoryName>0?'text-red':(cell.categoryName<0?'text-green':'text-black')}}" style="flex:1;text-align: center">{{cell.categoryName|| '---'}}</view>
<view class="text-df {{cell.unitPrice>0?'text-red':(cell.unitPrice<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{cell.unitPrice*1000|| 0}}</view>
<view class="text-df {{cell.floatPrice>0?'text-red':(cell.floatPrice<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{cell.floatPrice*1000|| 0}}</view>
<view class="text-df {{cell.unitPrice>0?'text-red':(cell.unitPrice<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{formate.formatePrice(cell.unitPrice)}}</view>
<view class="text-df {{cell.floatPrice>0?'text-red':(cell.floatPrice<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{formate.formatePrice(cell.floatPrice)}}</view>
<view class="text-df {{cell.curDeductionPoint>0?'text-red':(cell.curDeductionPoint<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{formate.formateDescripe(cell.curDeductionPoint)}}</view> <view class="text-df {{cell.curDeductionPoint>0?'text-red':(cell.curDeductionPoint<0?'text-green':'text-black')}}" style="flex:1;text-align: center" style="flex:1;text-align: center">{{formate.formateDescripe(cell.curDeductionPoint)}}</view>
<view class="text-df text-balck" style="flex:1;text-align: center" id="toDmai" data-fcId="{{item.paperMillId}}" data-paperId="{{cell.categoryId}}" catchtap="toPage"> <view class="text-df text-balck" style="flex:1;text-align: center" id="toDmai" data-fcId="{{item.paperMillId}}" data-paperId="{{cell.categoryId}}" catchtap="toPage">
<view class="son-table-btn">代卖</view> <view class="son-table-btn">代卖</view>

Loading…
Cancel
Save