|
@@ -1,14 +1,16 @@
|
|
<template>
|
|
<template>
|
|
<view>
|
|
<view>
|
|
<view class='search'>
|
|
<view class='search'>
|
|
- <u-search v-model='searchKeyWord' placeholder='可按货源查找' search-icon-color='#AFB3BF' bg-color='#F5F6F9' :shape='"round"' :clearabled="true" :show-action='false'></u-search>
|
|
|
|
|
|
+ <u-search v-model='searchKeyWord' placeholder='可按货源查找' search-icon-color='#AFB3BF' bg-color='#F5F6F9'
|
|
|
|
+ :shape='"round"' :clearabled="true" :show-action='false'></u-search>
|
|
</view>
|
|
</view>
|
|
-
|
|
|
|
|
|
+
|
|
<view style='justify-content: space-between;background:#fff;padding:20rpx;' class='flex'>
|
|
<view style='justify-content: space-between;background:#fff;padding:20rpx;' class='flex'>
|
|
<view @click='show=true'>{{startDate}}~{{endDate}}></view>
|
|
<view @click='show=true'>{{startDate}}~{{endDate}}></view>
|
|
<view @click='show1=true'>{{warehouse?warehouse:'全部仓库'}}></view>
|
|
<view @click='show1=true'>{{warehouse?warehouse:'全部仓库'}}></view>
|
|
</view>
|
|
</view>
|
|
- <u-picker mode="selector" @confirm='confirm' v-model="show1" range-key='warehouseName' :default-selector="[0]" :range="warehouseList"></u-picker>
|
|
|
|
|
|
+ <u-picker mode="selector" @confirm='confirm' v-model="show1" range-key='warehouseName' :default-selector="[0]"
|
|
|
|
+ :range="warehouseList"></u-picker>
|
|
<u-calendar @change='calendarchange' v-model="show" :mode="mode"></u-calendar>
|
|
<u-calendar @change='calendarchange' v-model="show" :mode="mode"></u-calendar>
|
|
<view>
|
|
<view>
|
|
<view class='contractwrap' v-for='(item,index) in warehouseList'>
|
|
<view class='contractwrap' v-for='(item,index) in warehouseList'>
|
|
@@ -17,7 +19,9 @@
|
|
<view class='contractNo'>{{item.issuingTime}}</view>
|
|
<view class='contractNo'>{{item.issuingTime}}</view>
|
|
</view>
|
|
</view>
|
|
<view v-for='(item1,index1) in item.goodsNameList ' style='background:#EFFAF4;border-radius:10rpx;'>
|
|
<view v-for='(item1,index1) in item.goodsNameList ' style='background:#EFFAF4;border-radius:10rpx;'>
|
|
- <view style='color:#22C572;padding:20rpx;border-bottom:1rpx solid #D8E8E0;justify-content: space-between;' class='flex'>
|
|
|
|
|
|
+ <view
|
|
|
|
+ style='color:#22C572;padding:20rpx;border-bottom:1rpx solid #D8E8E0;justify-content: space-between;'
|
|
|
|
+ class='flex'>
|
|
<view style='width:33.3333%;text-align:left;'>{{item1.goodsName}}</view>
|
|
<view style='width:33.3333%;text-align:left;'>{{item1.goodsName}}</view>
|
|
<view style='width:33.3333%;'>均水{{item1.weightedMoisture}}</view>
|
|
<view style='width:33.3333%;'>均水{{item1.weightedMoisture}}</view>
|
|
<view style='width:33.3333%;text-align:right;'>均价{{item1.avgCost}}</view>
|
|
<view style='width:33.3333%;text-align:right;'>均价{{item1.avgCost}}</view>
|
|
@@ -27,7 +31,7 @@
|
|
<view>{{item2.inWarehouseWeight}}吨</view>
|
|
<view>{{item2.inWarehouseWeight}}吨</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
-
|
|
|
|
|
|
+
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-if='show2' style='text-align:center;background:#F2F6FA;margin-top:20rpx;'>暂无更多数据</view>
|
|
<view v-if='show2' style='text-align:center;background:#F2F6FA;margin-top:20rpx;'>暂无更多数据</view>
|
|
@@ -38,32 +42,32 @@
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- startDate:'',
|
|
|
|
- endDate:'',
|
|
|
|
- mode:'range',
|
|
|
|
- show:false,
|
|
|
|
- show1:false,
|
|
|
|
- show2:false,
|
|
|
|
- currentPage:1,
|
|
|
|
- pageSize:10,
|
|
|
|
- baseId:'',
|
|
|
|
- warehouse:'',
|
|
|
|
- searchKeyWord:'',
|
|
|
|
- warehouseList:[],
|
|
|
|
- isLoadMore:false
|
|
|
|
|
|
+ startDate: '',
|
|
|
|
+ endDate: '',
|
|
|
|
+ mode: 'range',
|
|
|
|
+ show: false,
|
|
|
|
+ show1: false,
|
|
|
|
+ show2: false,
|
|
|
|
+ currentPage: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ baseId: '',
|
|
|
|
+ warehouse: '',
|
|
|
|
+ searchKeyWord: '',
|
|
|
|
+ warehouseList: [],
|
|
|
|
+ isLoadMore: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
- title: "正在加载"
|
|
|
|
- })
|
|
|
|
|
|
+ title: "正在加载"
|
|
|
|
+ })
|
|
this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseSelf', {
|
|
this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseSelf', {
|
|
- compId:uni.getStorageSync('pcUserInfo').compId,
|
|
|
|
|
|
+ compId: uni.getStorageSync('pcUserInfo').compId,
|
|
}).then(res => {
|
|
}).then(res => {
|
|
- if(res.data.code==200){
|
|
|
|
|
|
+ if (res.data.code == 200) {
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
- this.warehouseList=res.data.data
|
|
|
|
- }else{
|
|
|
|
|
|
+ this.warehouseList = res.data.data
|
|
|
|
+ } else {
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: "系统异常,请联系管理员",
|
|
title: "系统异常,请联系管理员",
|
|
@@ -74,62 +78,107 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
- var date=new Date()
|
|
|
|
- this.startDate=date.getFullYear()+'-'+((date.getMonth()+1)<10?('0'+(date.getMonth()+1)):(date.getMonth()+1))+'-'+(date.getDate()-1)
|
|
|
|
- this.endDate=date.getFullYear()+'-'+((date.getMonth()+1)<10?('0'+(date.getMonth()+1)):(date.getMonth()+1))+'-'+date.getDate()
|
|
|
|
|
|
+ Date.prototype.format = function(format) {
|
|
|
|
+ var o = {
|
|
|
|
+ "M+": this.getMonth() + 1, //month
|
|
|
|
+ "d+": this.getDate(), //day
|
|
|
|
+ "h+": this.getHours(), //hour
|
|
|
|
+ "m+": this.getMinutes(), //minute
|
|
|
|
+ "s+": this.getSeconds(), //second
|
|
|
|
+ "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
|
|
|
|
+ "S": this.getMilliseconds() //millisecond
|
|
|
|
+ }
|
|
|
|
+ if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
|
|
|
|
+ (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
|
|
+ for (var k in o)
|
|
|
|
+ if (new RegExp("(" + k + ")").test(format))
|
|
|
|
+ format = format.replace(RegExp.$1,
|
|
|
|
+ RegExp.$1.length == 1 ? o[k] :
|
|
|
|
+ ("00" + o[k]).substr(("" + o[k]).length));
|
|
|
|
+ return format;
|
|
|
|
+ }
|
|
|
|
+ var day = new Date();
|
|
|
|
+ this.endDate = day.format('yyyy-MM-dd'); //今天
|
|
|
|
+ this.startDate = new Date(new Date().setDate(new Date().getDate() - 1)).format('yyyy-MM-dd'); //昨天
|
|
|
|
+ // this.startDate=date.getFullYear()+'-'+((date.getMonth()+1)<10?('0'+(date.getMonth()+1)):(date.getMonth()+1))+'-'+(date.getDate()-1)
|
|
|
|
+ // this.endDate=date.getFullYear()+'-'+((date.getMonth()+1)<10?('0'+(date.getMonth()+1)):(date.getMonth()+1))+'-'+date.getDate()
|
|
this.getList()
|
|
this.getList()
|
|
},
|
|
},
|
|
onReachBottom() { //上拉触底函数
|
|
onReachBottom() { //上拉触底函数
|
|
// if (this.statusFlag == 3) {
|
|
// if (this.statusFlag == 3) {
|
|
- if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
|
|
|
|
- this.pageSize += 1
|
|
|
|
- this.currentPage += 1
|
|
|
|
- this.getList()
|
|
|
|
- }
|
|
|
|
|
|
+ if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
|
|
|
|
+ this.pageSize += 1
|
|
|
|
+ this.currentPage += 1
|
|
|
|
+ this.getList()
|
|
|
|
+ }
|
|
// }
|
|
// }
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- confirm(e){
|
|
|
|
|
|
+ format(format) {
|
|
|
|
+ var o = {
|
|
|
|
+ "M+": this.getMonth() + 1, //month
|
|
|
|
+ "d+": this.getDate(), //day
|
|
|
|
+ "h+": this.getHours(), //hour
|
|
|
|
+ "m+": this.getMinutes(), //minute
|
|
|
|
+ "s+": this.getSeconds(), //second
|
|
|
|
+ "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
|
|
|
|
+ "S": this.getMilliseconds() //millisecond
|
|
|
|
+ }
|
|
|
|
+ if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
|
|
|
|
+ (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
|
|
+ for (var k in o)
|
|
|
|
+ if (new RegExp("(" + k + ")").test(format))
|
|
|
|
+ format = format.replace(RegExp.$1,
|
|
|
|
+ RegExp.$1.length == 1 ? o[k] :
|
|
|
|
+ ("00" + o[k]).substr(("" + o[k]).length));
|
|
|
|
+ return format;
|
|
|
|
+ },
|
|
|
|
+ confirm(e) {
|
|
console.log(e)
|
|
console.log(e)
|
|
- this.warehouse=this.warehouseList[e[0]].warehouseName
|
|
|
|
- this.baseId=this.warehouseList[e[0]].id
|
|
|
|
|
|
+ this.warehouse = this.warehouseList[e[0]].warehouseName
|
|
|
|
+ this.baseId = this.warehouseList[e[0]].id
|
|
this.getList()
|
|
this.getList()
|
|
},
|
|
},
|
|
- calendarchange(e){
|
|
|
|
- this.startDate=e.startDate
|
|
|
|
- this.endDate=e.endDate
|
|
|
|
|
|
+ calendarchange(e) {
|
|
|
|
+ this.startDate = e.startDate
|
|
|
|
+ this.endDate = e.endDate
|
|
this.getList()
|
|
this.getList()
|
|
console.log(e)
|
|
console.log(e)
|
|
},
|
|
},
|
|
- getList(){
|
|
|
|
-
|
|
|
|
|
|
+ getList() {
|
|
|
|
+
|
|
// warehouseBaseInfo/selectWarehouseSelf
|
|
// warehouseBaseInfo/selectWarehouseSelf
|
|
-
|
|
|
|
|
|
+
|
|
this.$api.doRequest('get', '/warehousingOrder/selectInfo', {
|
|
this.$api.doRequest('get', '/warehousingOrder/selectInfo', {
|
|
currentPage: this.currentPage,
|
|
currentPage: this.currentPage,
|
|
pageSize: this.pageSize,
|
|
pageSize: this.pageSize,
|
|
- searchKeyWord:this.searchKeyWord,
|
|
|
|
- compId:uni.getStorageSync('pcUserInfo').compId,
|
|
|
|
- baseId:this.baseId,
|
|
|
|
- startDate:this.startDate,
|
|
|
|
- endDate:this.endDate
|
|
|
|
|
|
+ searchKeyWord: this.searchKeyWord,
|
|
|
|
+ compId: uni.getStorageSync('pcUserInfo').compId,
|
|
|
|
+ baseId: this.baseId,
|
|
|
|
+ startDate: this.startDate,
|
|
|
|
+ endDate: this.endDate
|
|
}).then(res => {
|
|
}).then(res => {
|
|
- if(res.data.code==200){
|
|
|
|
-
|
|
|
|
- if(res.data.data.records.length>0){
|
|
|
|
- this.show2=false
|
|
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
+
|
|
|
|
+ if (res.data.data.records.length > 0) {
|
|
|
|
+ this.show2 = false
|
|
for (var i = 0; i < res.data.data.records.length; i++) {
|
|
for (var i = 0; i < res.data.data.records.length; i++) {
|
|
- var arr=[]
|
|
|
|
- if(res.data.data.records[i].warehousingOrderList){
|
|
|
|
- var data=res.data.data.records[i].warehousingOrderList
|
|
|
|
|
|
+ var arr = []
|
|
|
|
+ if (res.data.data.records[i].warehousingOrderList) {
|
|
|
|
+ var data = res.data.data.records[i].warehousingOrderList
|
|
for (let q = 0; q < data.length; q++) {
|
|
for (let q = 0; q < data.length; q++) {
|
|
- if(arr.every((item)=>{return item.goodsName!=data[q].goodsName})){
|
|
|
|
- var list=[]
|
|
|
|
|
|
+ if (arr.every((item) => {
|
|
|
|
+ return item.goodsName != data[q].goodsName
|
|
|
|
+ })) {
|
|
|
|
+ var list = []
|
|
list.push(data[q])
|
|
list.push(data[q])
|
|
- arr.push({goodsName:data[q].goodsName,list:list})
|
|
|
|
- }else{
|
|
|
|
|
|
+ arr.push({
|
|
|
|
+ goodsName: data[q].goodsName,
|
|
|
|
+ list: list
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
for (var t = 0; t < arr.length; t++) {
|
|
for (var t = 0; t < arr.length; t++) {
|
|
- if(arr[t].goodsName=data[q].goodsName){
|
|
|
|
|
|
+ if (arr[t].goodsName = data[q].goodsName) {
|
|
arr[t].list.push(data[q])
|
|
arr[t].list.push(data[q])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -137,35 +186,36 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (var q = 0; q < arr.length; q++) {
|
|
for (var q = 0; q < arr.length; q++) {
|
|
- var weight=0
|
|
|
|
- var weightedMoisture=0
|
|
|
|
- var avgCost=0
|
|
|
|
|
|
+ var weight = 0
|
|
|
|
+ var weightedMoisture = 0
|
|
|
|
+ var avgCost = 0
|
|
for (var t = 0; t < arr[q].list.length; t++) {
|
|
for (var t = 0; t < arr[q].list.length; t++) {
|
|
- weight+=arr[q].list[t].inWarehouseWeight
|
|
|
|
- weightedMoisture+=(arr[q].list[t].weightedMoisture*arr[q].list[t].inWarehouseWeight)
|
|
|
|
- avgCost+=(arr[q].list[t].avgCost*arr[q].list[t].inWarehouseWeight)
|
|
|
|
|
|
+ weight += arr[q].list[t].inWarehouseWeight
|
|
|
|
+ weightedMoisture += (arr[q].list[t].weightedMoisture * arr[q].list[t]
|
|
|
|
+ .inWarehouseWeight)
|
|
|
|
+ avgCost += (arr[q].list[t].avgCost * arr[q].list[t].inWarehouseWeight)
|
|
}
|
|
}
|
|
- arr[q].weight=weight
|
|
|
|
- arr[q].weightedMoisture=(weightedMoisture/weight).toFixed(2)
|
|
|
|
- arr[q].avgCost=(avgCost/weight).toFixed(2)
|
|
|
|
-
|
|
|
|
|
|
+ arr[q].weight = weight
|
|
|
|
+ arr[q].weightedMoisture = (weightedMoisture / weight).toFixed(2)
|
|
|
|
+ arr[q].avgCost = (avgCost / weight).toFixed(2)
|
|
|
|
+
|
|
}
|
|
}
|
|
console.log(arr)
|
|
console.log(arr)
|
|
- res.data.data.records[i].goodsNameList=arr
|
|
|
|
|
|
+ res.data.data.records[i].goodsNameList = arr
|
|
}
|
|
}
|
|
console.log(res.data.data.records)
|
|
console.log(res.data.data.records)
|
|
- if(this.currentPage==1){
|
|
|
|
- this.warehouseList=res.data.data.records
|
|
|
|
- }else{
|
|
|
|
- this.warehouseList=this.warehouseList.concat(res.data.data.records)
|
|
|
|
|
|
+ if (this.currentPage == 1) {
|
|
|
|
+ this.warehouseList = res.data.data.records
|
|
|
|
+ } else {
|
|
|
|
+ this.warehouseList = this.warehouseList.concat(res.data.data.records)
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- this.show2=true
|
|
|
|
- if(this.currentPage==1){
|
|
|
|
- this.warehouseList=[]
|
|
|
|
|
|
+ } else {
|
|
|
|
+ this.show2 = true
|
|
|
|
+ if (this.currentPage == 1) {
|
|
|
|
+ this.warehouseList = []
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: "系统异常,请联系管理员",
|
|
title: "系统异常,请联系管理员",
|
|
@@ -173,44 +223,48 @@
|
|
duration: 2000
|
|
duration: 2000
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style lang='scss' scoped>
|
|
|
|
|
|
+<style lang='scss' scoped>
|
|
|
|
+ .contractwrap {
|
|
|
|
+ background: #fff;
|
|
|
|
+ margin: 20rpx;
|
|
|
|
+ padding: 20rpx 20rpx 40rpx 20rpx;
|
|
|
|
+ border-radius: 20rpx;
|
|
|
|
+
|
|
|
|
+ .contractwrap-title {
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
+ padding: 20rpx;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ align-items: center;
|
|
|
|
|
|
-.contractwrap{
|
|
|
|
- background:#fff;
|
|
|
|
- margin:20rpx;
|
|
|
|
- padding:20rpx 20rpx 40rpx 20rpx;
|
|
|
|
- border-radius:20rpx;
|
|
|
|
- .contractwrap-title{
|
|
|
|
- font-size:28rpx;
|
|
|
|
- padding:20rpx;
|
|
|
|
- justify-content: space-between;
|
|
|
|
- align-items: center;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- .contractwrap-item{
|
|
|
|
- display:flex;
|
|
|
|
- justify-content: space-between;
|
|
|
|
- padding:10rpx 20rpx;
|
|
|
|
- font-size:28rpx;
|
|
|
|
- .title{
|
|
|
|
- font-size:24rpx;
|
|
|
|
- color:#8F8F8F;
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ .contractwrap-item {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ padding: 10rpx 20rpx;
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
+
|
|
|
|
+ .title {
|
|
|
|
+ font-size: 24rpx;
|
|
|
|
+ color: #8F8F8F;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .search {
|
|
|
|
+ width: 100vw;
|
|
|
|
+ background: #fff;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .u-search {
|
|
|
|
+ width: 94%;
|
|
|
|
+ margin: 0 auto !important;
|
|
}
|
|
}
|
|
-}
|
|
|
|
-.search{
|
|
|
|
- width:100vw;
|
|
|
|
- background:#fff;
|
|
|
|
-}
|
|
|
|
-.u-search{
|
|
|
|
- width:94%;
|
|
|
|
- margin:0 auto !important;
|
|
|
|
-}
|
|
|
|
</style>
|
|
</style>
|