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.
227 lines
6.3 KiB
227 lines
6.3 KiB
<template>
|
|
<view class="page1">
|
|
<view>
|
|
<uni-datetime-picker style="margin-bottom:10px;" v-model="range" @change="searchList" type="daterange" />
|
|
</view>
|
|
<view class="content-list">
|
|
<view v-for="(item,index) in fireList" :key="index" class="content-item">
|
|
<view v-if="index == 0" style="width: 44rpx;justify-content: center;align-items: center;display: flex;">
|
|
<uni-icons type="medal-filled" size='22' color="#fcdb56"></uni-icons>
|
|
</view>
|
|
<view v-if="index == 1" style="width: 44rpx;justify-content: center;align-items: center;display: flex;">
|
|
<uni-icons type="medal-filled" size='22' color="#dedee0"></uni-icons>
|
|
</view>
|
|
<view v-if="index == 2" style="width: 44rpx;justify-content: center;align-items: center;display: flex;">
|
|
<uni-icons type="medal-filled" size='22' color="#f6bf6f"></uni-icons>
|
|
</view>
|
|
<view v-if="index != 0 && index != 1 && index != 2" style="width: 44rpx;justify-content: center;align-items: center;display: flex;">{{index + 1}}</view>
|
|
<view class="box-left" @tap.stop="largeImg(item)">
|
|
<img :src="item.productPicture" alt="" v-if="item.productPicture">
|
|
<view class="noPic" v-else>暂无</view>
|
|
</view>
|
|
<view class="box-right">
|
|
<view class="box-right-num">货号:{{item.productSn==null?'':item.productSn}}({{item.productName == null?'暂无':item.productName}})</view>
|
|
<view class="box-right-name">销量:{{item.totalSold}}</view>
|
|
<view class="box-right-name">供应商:{{item.supplierName == null?'暂无':item.supplierName}}</view>
|
|
</view>
|
|
</view>
|
|
<u-loadmore :status="status" />
|
|
</view>
|
|
<!-- 弹出多图轮播 -->
|
|
<uni-popup ref="imgPopup" background-color="#fff">
|
|
<view class="showImg-box" :style="{'height':screenHeight*0.9+'px !important'}">
|
|
<swiper indicator-dots class="swiper-box" @change="lunbochange" circular autoplay :current="swiperDotIndex">
|
|
<swiper-item v-for="(item, index) in bigImg" :key="index">
|
|
<view class="swiper-item">
|
|
<image mode='aspectFit' show-menu-by-longpress :src="item.productPicture" alt="" style="width: 100%;height: 100%;border-radius: 10px;" /></image>
|
|
</view>
|
|
</swiper-item>
|
|
</swiper>
|
|
</view>
|
|
</uni-popup>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
range:[],
|
|
status: 'loadmore',
|
|
fireList:[],
|
|
pageNum:1,
|
|
pages:1,
|
|
indexList: [],
|
|
bigImg:[],
|
|
swiperDotIndex:0,
|
|
screenWidth:0,
|
|
screenHeight:0
|
|
};
|
|
},
|
|
onShow(){
|
|
// 同步方式获取屏幕信息
|
|
const systemInfo = uni.getSystemInfoSync();
|
|
this.screenWidth = systemInfo.screenWidth
|
|
this.screenHeight = systemInfo.windowHeight
|
|
console.log('屏幕宽度:', systemInfo.screenWidth);
|
|
console.log('屏幕高度:', systemInfo.screenHeight);
|
|
console.log('可使用窗口宽度:', systemInfo.windowWidth);
|
|
console.log('可使用窗口高度:', systemInfo.windowHeight);
|
|
console.log('设备像素比:', systemInfo.pixelRatio);
|
|
this.getMonth()
|
|
this.getFireList()
|
|
},
|
|
onReachBottom() {
|
|
if (this.pageNum >= this.pages) return;
|
|
this.status = 'loading';
|
|
this.pageNum ++;
|
|
this.getFireList();
|
|
|
|
},
|
|
methods: {
|
|
lunbochange(e) {
|
|
this.current = e.detail.current
|
|
},
|
|
getFireList(){
|
|
this.tui.request("/app/product/getShareList", "POST", {
|
|
categoryId: "",
|
|
searchStr: "",
|
|
pageNum: this.pageNum,
|
|
pageSize: '20',
|
|
sortField:"totalSold",
|
|
startDate:this.range[0],
|
|
endDate:this.range[1]
|
|
}, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
this.status = 'nomore';
|
|
if (this.pages == 1) {
|
|
this.fireList = res.result.records
|
|
} else {
|
|
this.fireList = [...this.fireList, ...res.result.records]
|
|
}
|
|
this.pages = res.result.pages
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
searchList(res) {
|
|
this.pageNum = 1;
|
|
this.fireList = [];
|
|
this.getFireList()
|
|
},
|
|
//获取当月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 + '-' + month + '-01' //当月第一天
|
|
this.range = [beg,end]
|
|
},
|
|
largeImg(img) {
|
|
|
|
if((img.productPicture == null &&img.productPictures == null) || (img.productPicture == '' &&img.productPictures == '') || (img.productPicture == null &&img.productPictures == '') || (img.productPicture == '' &&img.productPictures == null)){
|
|
this.tui.toast("暂无可展示的图片",300)
|
|
return
|
|
}
|
|
this.bigImg = []
|
|
if(img.productPicture != null){
|
|
let data = {
|
|
productPicture:img.productPicture
|
|
}
|
|
this.bigImg.push(data)
|
|
}
|
|
if(img.productPictures != null){
|
|
for(let i=0;i<img.productPictures.length;i++){
|
|
this.bigImg.push(img.productPictures[i])
|
|
}
|
|
}
|
|
console.log(this.bigImg)
|
|
this.$refs.imgPopup.open()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page,.page1 {
|
|
font-size: 14px;
|
|
}
|
|
.content-list{
|
|
overflow: scroll;
|
|
background: #fff;
|
|
margin: 10px auto 0;
|
|
position: relative;
|
|
z-index: 98;
|
|
}
|
|
.content-item{
|
|
height: 60px;
|
|
width: 100%;
|
|
padding: 0 20rpx;
|
|
border-bottom: 1px solid #eee;
|
|
display: flex;
|
|
}
|
|
.box-left {
|
|
width: 40px;
|
|
height: 40px;
|
|
background-size: 100%;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.box-left img {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.box-right {
|
|
display: flex;
|
|
line-height: 60px;
|
|
width: 85%;
|
|
}
|
|
|
|
.box-right-price {
|
|
display: flex;
|
|
}
|
|
.noPic{
|
|
width: 40px;
|
|
height: 40px;
|
|
text-align: center;
|
|
line-height: 40px;
|
|
color: #777;
|
|
background: #eee;
|
|
}
|
|
.box-right-num {
|
|
color: #000;
|
|
font-weight: bold;
|
|
width: 50%;
|
|
padding-left: 15%;
|
|
}
|
|
.box-right-name {
|
|
height: 60px;
|
|
line-height: 60px;
|
|
width: 30%;
|
|
}
|
|
.showImg-box{
|
|
width: 700px;
|
|
border-radius: 10px;
|
|
}
|
|
.swiper-box {
|
|
height: 100%;
|
|
}
|
|
.swiper-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100%;
|
|
color: #fff;
|
|
background-color: #cee1fd;
|
|
border-radius: 10px;
|
|
}
|
|
.uniui-calendar,.uniui-clear,.uniui-medal-filled{
|
|
font-size: 31px !important;
|
|
}
|
|
</style>
|