You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

171 lines
4.6 KiB

<template>
<view class="container">
<uni-datetime-picker style="margin-bottom:20rpx;" :clear-icon="false" v-model="range" type="daterange"
@change="searchList" />
<view style="background: #fff;margin: 0 auto 20rpx;">
<view style="width: 100%;height: 80rpx;line-height: 80rpx;text-align: center;font-weight: bold;font-size: 32rpx;">
客户:{{name}}
</view>
<uni-table border stripe emptyText="暂无更多数据">
<!-- 表头行 -->
<uni-tr style="background: #eee;">
<uni-th align="center" width="50">总件数</uni-th>
<uni-th align="center" width="70">拿货总额</uni-th>
<uni-th align="center" width="70">成本</uni-th>
<uni-th align="center" width="70">利润</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr>
<uni-td
align="center">{{listData.zongshu}}</uni-td>
<uni-td align="center">{{listData.zongjia}}</uni-td>
<uni-td
align="center">{{userType == 0 ?(listData.chengben).toFixed(2):'0'}}</uni-td>
<uni-td
align="center">{{userType == 0 ?(listData.zongjia - listData.chengben).toFixed(2):0}}</uni-td>
</uni-tr>
</uni-table>
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [],
listData:{
zongjia:0,
zongshu:0,
chengben:0
},
range: [],
userId: '',
shopId: '',
type: '',
customId:'',
userType: uni.getStorageSync('type'),
shopName: "",
name:''
}
},
filters: {
removeStr(val) {
if (val == null) {
return "";
} else {
var dotIndex = val.indexOf('.');
if (dotIndex !== -1) {
return val.substring(0, dotIndex);
}
return val;
}
}
},
onLoad(option) {
let that = this;
this.customId = option.id
this.userId = option.userId
this.type = option.popleType
this.shopName = option.shopName ? option.shopName : uni.getStorageSync('shopName')
this.shopId = option.shopId ? option.shopId : uni.getStorageSync('shopId')
this.name = option.name
this.getMonth();
uni.setNavigationBarTitle({
title: this.shopName
});
this.getList()
},
onShow(){
let that = this;
if(this.range ==''){
this.getMonth();
}
},
methods: {
//获取当月1日到当前时间
getMonth() {
let date = new Date()
let year = date.getFullYear().toString() //'年'
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : (date.getMonth() + 1)
.toString() //'月'
let da = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate().toString() //'日'
let end = year + '-' + month + '-' + da //当天
let beg = (year - 1) + '-' + month + '-' + da
this.range = [beg, end]
},
getList() {
this.tui.request("/app/sale/listPages", "post", {
userId: this.customId,
pageVo: {
pageSize: 100000,
pageNumber: 1
},
searchStr: "",
startTime: this.range[0],
endTime: this.range[1],
shopId: this.shopId,
fromWhere: 1
}, false, false).then((res) => {
if (res.code == 200) {
this.list = res.result.records
this.listData.userName = res.result.records[0].userName
for (let i = 0; i < this.list.length; i++) {
for (let j = 0; j < this.list[i].saleDetailDTOList.length; j++) {
for (let m = 0; m < this.list[i].saleDetailDTOList[j].stockLogList1.length; m++) {
this.listData.zongjia += this.list[i].saleDetailDTOList[j].discountAmount * this.list[i].saleDetailDTOList[j].stockLogList1[m].productCount
this.listData.zongshu += this.list[i].saleDetailDTOList[j].stockLogList1[m].productCount
this.listData.chengben += this.list[i].saleDetailDTOList[j].purchasePrice * this.list[i].saleDetailDTOList[j].stockLogList1[m].productCount
// this.list[i].productCount += this.list[i]
// .saleDetailDTOList[j].stockLogList1[m].productCount
// this.list[i].saleDetailDTOList[j].productCount += this.list[i]
// .saleDetailDTOList[j].stockLogList1[m].productCount
}
}
}
this.$forceUpdate()
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
searchList() {
this.list = []
this.listData = {
zongjia:0,
zongshu:0,
chengben:0
}
this.getList()
},
},
}
</script>
<style lang="scss">
page{
font-size:24rpx;
}
.uni-card__header-box {
text-align: center !important;
}
.uni-card__header-content-title {
font-weight: bold;
}
.uni-table-scroll {
width: 100%;
overflow-x: auto;
border-radius: 10px;
}
.uni-table-th {
background: #FAE7B5 !important;
color: #000 !important;
}
</style>