Browse Source

no message

feature/v2.1
xpz2018 4 years ago
parent
commit
b5b7066732
4 changed files with 89 additions and 32 deletions
  1. 2
      components/textarea/index.wxml
  2. 98
      xtends/statics/index/index.js
  3. 20
      xtends/statics/index/index.wxml
  4. 1
      xtends/statics/sale-report/index.js

2
components/textarea/index.wxml

@ -1,4 +1,4 @@
<view class="textarea {{ value ? 'text-black' : 'text-gray' }}" bindtap="onEdit" wx:if="{{!editing}}">{{value || placeholder }}</view>
<textarea id="remark" wx:else maxlength="100" value="{{value}}" style="padding-top:16rpx" class="textarea"
cursor-spacing="60" focus="{{editing}}" bindblur="onBlur" bindfocus="onEdit" show-confirm-bar="{{false}}"
cursor-spacing="60" adjust-position="{{false}}" focus="{{editing}}" bindblur="onBlur" bindfocus="onEdit" show-confirm-bar="{{false}}"
bindinput="bindInput" placeholder-style="color:#aaa" placeholder="{{placeholder}}"></textarea>

98
xtends/statics/index/index.js

@ -1,7 +1,7 @@
// xtends//statics/index/index.js
import Scene from '../../../pages/index/scene'
import uCharts from '../../libs/u-charts';
import { getReceiptReport } from "../../../api/saas"
import { getReceiptReport, getSalesReport } from "../../../api/saas"
const math = require('../../../utils/math')
import util from '../../../utils/util'
const app = getApp()
@ -19,8 +19,21 @@ Scene({
// cHeight: '',
form1: {},
form2: {},
percent: 85,
show: false
percent: 50,
show: false,
selectId: '',
reportInfo:{
totalOffsiteSettleWeight: 0,
totalOnsideSettleWeight: 0,
totalSettlePrice: 0,
totalSettleWeight: 0
},
saleReportInfo:{
carNumber: 0,
totalOutboundDeliveryNetWeight: 0,
totalSettlePrice: 0,
totalSettleWeight: 0
}
},
/**
* 生命周期函数--监听页面加载
@ -46,21 +59,14 @@ Scene({
var vdateString = util.formatDate(new Date(), 'Y-M-D') + '至' + util.formatDate(max, 'Y-M-D')
this.data.form1.dimensionDateStart = util.formatDate(today, 'Y-M-D')
this.data.form1.dimensionDateEnd = util.formatDate(max, 'Y-M-D')
this.data.form2.startTime = util.formatDate(today, 'Y-M-D') + ' 00:00:00'
this.data.form2.endTime = util.formatDate(max, 'Y-M-D') + ' 00:00:00'
this.setData({ minDate, maxDate, vdate, vdateString })
this.fetchSummaryInfo(this.data.form1)
},
fetchSummaryInfo: function(form){
getReceiptReport(form).then(result => {
// this.setData({ })
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
})
this.data.form2.dimensionDateStart = util.formatDate(today, 'Y-M-D')
this.data.form2.dimensionDateEnd = util.formatDate(max, 'Y-M-D')
this.setData({ minDate, maxDate, vdate, vdateString1: vdateString, vdateString2: vdateString })
this.fetchSummaryInfo(false)
this.fetchStatisticsInfo(true)
},
showCalendar: function(e){
console.log(e.currentTarget.id)
this.data.selectId = e.currentTarget.id
this.setData({ show: true })
},
onClose: function() {
@ -69,13 +75,63 @@ Scene({
onSelect: function({detail}) {
var start = new Date(detail[0])
var end = new Date(detail[1])
var vdateString = util.formatDate(start, 'Y-M-D') + '至' + util.formatDate(end, 'Y-M-D')
this.data.form.startTime = util.formatDate(start, 'Y-M-D') + ' 00:00:00'
this.data.form.endTime = util.formatDate(end, 'Y-M-D') + ' 00:00:00'
this.setData({ show: false, vdateString })
wx.showLoading({ title: '加载中', mask: true })
this.fetchStatisticsInfo()
if(this.data.selectId == 'form1') {
var vdateString1 = util.formatDate(start, 'Y-M-D') + '至' + util.formatDate(end, 'Y-M-D')
this.data.form1.dimensionDateStart = util.formatDate(start, 'Y-M-D')
this.data.form1.dimensionDateEnd = util.formatDate(end, 'Y-M-D')
this.setData({ show: false, vdateString1 })
this.fetchStatisticsInfo(true)
} else {
var vdateString2 = util.formatDate(start, 'Y-M-D') + '至' + util.formatDate(end, 'Y-M-D')
this.data.form2.dimensionDateStart = util.formatDate(start, 'Y-M-D')
this.data.form2.dimensionDateEnd = util.formatDate(end, 'Y-M-D')
this.setData({ show: false, vdateString2 })
this.fetchStatisticsInfo(true)
}
},
fetchSummaryInfo: function(hide){
getReceiptReport(this.data.form1).then(result => {
if(result.data){
if(result.data.totalOffsiteSettleWeight == 0 && result.data.totalOnsideSettleWeight == 0){
this.data.percent = 50
} else if(result.data.totalOffsiteSettleWeight == 0){
this.data.percent = 0
} else if(result.data.totalOnsideSettleWeight == 0){
this.data.percent = 100
} else {
var totalWeight = math.plus(result.data.totalOffsiteSettleWeight, result.data.totalOnsideSettleWeight)
this.data.percent = parseInt(math.times(math.divide(result.data.totalOffsiteSettleWeight, totalWeight), 100))
}
this.setData({ reportInfo: result.data, percent: this.data.percent })
} else {
this.setData({ reportInfo: { totalOffsiteSettleWeight: 0, totalOnsideSettleWeight: 0, totalSettlePrice: 0, totalSettleWeight: 0 }, percent: 50 })
}
if(hide){
wx.hideLoading()
}
}).catch(err => {
if(hide){
wx.hideLoading()
}
})
},
fetchStatisticsInfo: function(hide){
getSalesReport(this.data.form2).then(result => {
if(result.data){
this.setData({ saleReportInfo: result.data })
} else {
this.setData({ saleReportInfo: { carNumber: 0, totalOutboundDeliveryNetWeight: 0, totalSettlePrice: 0, totalSettleWeight: 0 } })
}
if(hide){
wx.hideLoading()
}
}).catch(err => {
if(hide){
wx.hideLoading()
}
})
}
// rpx2px: function(rpx) {
// return rpx / 750 * windowWidth;
// },

20
xtends/statics/index/index.wxml

@ -51,7 +51,7 @@
<view class="text-black text-lg text-bold" style="margin-left: 12rpx">收货统计</view>
</view>
<view class="flex flex-center" style="padding: 2rpx 32rpx">
<view class="text-black text-df" style="margin-right:8rpx">{{vdateString}}</view>
<view class="text-black text-df" style="margin-right:8rpx">{{vdateString1}}</view>
<van-icon name="{{show ? 'arrow-up' : 'arrow-down'}}" />
</view>
</view>
@ -65,21 +65,21 @@
<view class="flex" style="margin-left:24rpx;">
<view style="width:220rpx">
<view class="text-black text-sm">收货合计(吨)</view>
<view class="text-xxl" style="color:#278CC8;margin-top:8rpx">1230.45</view>
<view class="text-xxl" style="color:#278CC8;margin-top:8rpx">{{reportInfo.totalSettleWeight}}</view>
<view class="flex" style="margin-top:24rpx;align-items: center">
<text style="background-image: linear-gradient(270deg, #FF222C 0%, #FF691C 100%);border-radius:50%;height:16rpx;width:16rpx"></text>
<text class="text-black text-sm" style="margin-left:12rpx">场外收货(吨)</text>
</view>
<view class="text-black text-bold">1230.45</view>
<view class="text-black text-bold">{{reportInfo.totalOffsiteSettleWeight}}</view>
</view>
<view style="width:220rpx">
<view class="text-black text-sm">收货总金额(元)</view>
<view class="text-xxl" style="color:#278CC8;margin-top:8rpx">1230.45</view>
<view class="text-xxl" style="color:#278CC8;margin-top:8rpx">{{reportInfo.totalSettlePrice}}</view>
<view class="flex" style="margin-top:24rpx;align-items: center">
<text style="background-image: linear-gradient(90deg, #007AFF 0%, #6BCDFF 100%);border-radius:50%;height:16rpx;width:16rpx"></text>
<text class="text-black text-sm" style="margin-left:12rpx">场内收货(吨)</text>
</view>
<view class="text-black text-bold">1230.45</view>
<view class="text-black text-bold">{{reportInfo.totalOnsideSettleWeight}}</view>
</view>
</view>
</view>
@ -90,18 +90,18 @@
<view class="text-black text-lg text-bold" style="margin-left: 12rpx">销售统计</view>
</view>
<view class="flex flex-center" style="padding: 2rpx 32rpx">
<view class="text-black text-df" style="margin-right:8rpx">{{vdateString}}</view>
<view class="text-black text-df" style="margin-right:8rpx">{{vdateString2}}</view>
<van-icon name="{{show ? 'arrow-up' : 'arrow-down'}}" />
</view>
</view>
<view class="bg-white flex flex-center">
<view class="flex flex-center flex-column" style="flex:1;padding:32rpx">
<view class="text-xxl text-bold" style="color:#278CC8">{{formate.formateWeight(totalInfo.totalWeight || 0)}}</view>
<view class="text-xxl text-bold" style="color:#278CC8">{{formate.formateWeight(saleReportInfo.totalOutboundDeliveryNetWeight || 0)}}</view>
<view class="text-black text-sm">总出货重量(吨)</view>
</view>
<view class="van-hairline--left" style="height:100rpx"></view>
<view class="flex flex-center flex-column" style="flex:1;padding:32rpx;">
<view class="text-xxl text-bold" style="color:#278CC8">{{formate.formateWeight(totalInfo.totalWeight || 0)}}</view>
<view class="text-xxl text-bold" style="color:#278CC8">{{formate.formateWeight(saleReportInfo.totalSettleWeight || 0)}}</view>
<view class="text-black text-sm">总结算重量(吨)</view>
</view>
</view>
@ -111,12 +111,12 @@
</view>
<view class="bg-white flex flex-center">
<view class="flex flex-center flex-column" style="flex:1;padding:32rpx;">
<view class="text-xxl text-bold" style="color:#278CC8">{{formate.formateWeight(totalInfo.totalWeight || 0)}}</view>
<view class="text-xxl text-bold" style="color:#278CC8">{{formate.formateWeight(saleReportInfo.carNumber || 0)}}</view>
<view class="text-black text-sm">总出车数(车)</view>
</view>
<view class="van-hairline--left" style="height:100rpx"></view>
<view class="flex flex-center flex-column" style="flex:1;padding: 32rpx;">
<view class="text-xxl text-bold" style="color:#278CC8">{{formate.formateWeight(totalInfo.totalWeight || 0)}}</view>
<view class="text-xxl text-bold" style="color:#278CC8">{{formate.formateWeight(saleReportInfo.totalSettlePrice || 0)}}</view>
<view class="text-black text-sm">总结算金额(元)</view>
</view>
</view>

1
xtends/statics/sale-report/index.js

@ -20,6 +20,7 @@ Scene({
],
reportInfo:{
productSalesDailyReportList: [],
carNumber: 0,
totalOutboundDeliveryNetWeight: 0,
totalSettlePrice: 0,
totalSettleWeight: 0

Loading…
Cancel
Save