278 lines
6.5 KiB
Vue
278 lines
6.5 KiB
Vue
|
<template>
|
|||
|
<view class="page">
|
|||
|
<u-navbar title="存取酒记录" :border-bottom="false" :background="bgc" back-icon-color="#fff" title-color='#fff'
|
|||
|
title-size='36' height='36' id="navbar">
|
|||
|
</u-navbar>
|
|||
|
<view class="top">
|
|||
|
<view :class="topindex == 1 ? 'wzactive' : ''" @click="btntop(1)">
|
|||
|
我的存酒
|
|||
|
<text></text>
|
|||
|
</view>
|
|||
|
<view :class="topindex == 2 ? 'wzactive' : ''" @click="btntop(2)">
|
|||
|
取酒记录
|
|||
|
<text></text>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<!-- 我的存酒 -->
|
|||
|
<view class="" v-if="topindex == 1">
|
|||
|
<scroll-view v-if="cunlist.length > 0" @scrolltolower="handqixing" scroll-y refresher-enabled @refresherrefresh="onRefresh" :refresher-triggered="isRefreshing" refresher-default-style="white" class="cunbd">
|
|||
|
<view class="cunlist" v-for="(item,index) in cunlist" :key="index">
|
|||
|
<image :src="item.picture" mode="aspectFill"></image>
|
|||
|
<view class="cen">
|
|||
|
<view class="name">
|
|||
|
{{item.goodsName}}
|
|||
|
</view>
|
|||
|
<view class="sy">
|
|||
|
剩余 x{{item.currentNum}}
|
|||
|
</view>
|
|||
|
<view class="bz">
|
|||
|
备注:{{item.remark == null ? '--' : item.remark}}
|
|||
|
</view>
|
|||
|
<view class="time">
|
|||
|
到期时间:{{item.deadline == null ? '--' : item.deadline}}
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</scroll-view>
|
|||
|
<view class="wu" v-else>
|
|||
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uPdbLmeDSl3KHgPKAT1b" mode=""></image>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<!-- 我的记录 -->
|
|||
|
<view class="" v-if="topindex == 2">
|
|||
|
<scroll-view v-if="cunlist.length > 0" @scrolltolower="handqixing" scroll-y refresher-enabled @refresherrefresh="onRefresh" :refresher-triggered="isRefreshing" refresher-default-style="white" class="cunbd">
|
|||
|
<view class="qulist" v-for="(item,index) in cunlist" :key="index">
|
|||
|
<view class="qujiutime">
|
|||
|
取酒时间:{{item.createTime == null ? '--' : item.createTime}}
|
|||
|
</view>
|
|||
|
<view class="cen">
|
|||
|
<image :src="item.picture" mode=""></image>
|
|||
|
<text style="color: #fff;">{{item.goodsName == null ? '--' : item.goodsName}}</text>
|
|||
|
<text>X{{item.number}}</text>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</scroll-view>
|
|||
|
<view class="wu" v-else>
|
|||
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uPdbLmeDSl3KHgPKAT1b" mode=""></image>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
export default {
|
|||
|
data() {
|
|||
|
return {
|
|||
|
bgc: {
|
|||
|
backgroundColor: "#010000",
|
|||
|
},
|
|||
|
topindex:1,
|
|||
|
cunlist:[],
|
|||
|
isRefreshing: false,
|
|||
|
pageNum:1,
|
|||
|
total:0,
|
|||
|
|
|||
|
}
|
|||
|
},
|
|||
|
onLoad() {
|
|||
|
this.getcun()
|
|||
|
},
|
|||
|
methods: {
|
|||
|
// 上拉加载更多
|
|||
|
handqixing(){
|
|||
|
if(this.total > this.cunlist.length){
|
|||
|
if(this.topindex == 1){
|
|||
|
this.getcun()
|
|||
|
}else{
|
|||
|
this.getqujiu()
|
|||
|
}
|
|||
|
}else{
|
|||
|
console.log(11);
|
|||
|
}
|
|||
|
},
|
|||
|
// 请求取酒记录
|
|||
|
getqujiu(){
|
|||
|
this.$u.get(`/app/storageRecord/getWineRecord?storeId=${this.$store.state.storeId}&pageNum=${this.pageNum}&pageSize=10`).then(res => {
|
|||
|
if (res.code == 200) {
|
|||
|
this.total = res.total
|
|||
|
if(this.pageNum == 1){
|
|||
|
this.cunlist = res.rows
|
|||
|
this.pageNum++
|
|||
|
}else{
|
|||
|
this.cunlist = this.cunlist.concat(res.rows)
|
|||
|
this.pageNum++
|
|||
|
}
|
|||
|
}else if(res.code == 401){
|
|||
|
uni.showModal({
|
|||
|
title: '提示',
|
|||
|
content: '你还未登录,是否去登录?',
|
|||
|
success: function (res) {
|
|||
|
if (res.confirm) {
|
|||
|
console.log('用户点击确定')
|
|||
|
uni.reLaunch({
|
|||
|
url:'/pages/login/login'
|
|||
|
})
|
|||
|
} else if (res.cancel) {
|
|||
|
console.log('用户点击取消')
|
|||
|
}
|
|||
|
}
|
|||
|
})
|
|||
|
}
|
|||
|
})
|
|||
|
},
|
|||
|
|
|||
|
// 下拉刷新
|
|||
|
onRefresh() {
|
|||
|
this.isRefreshing = true
|
|||
|
this.pageNum = 1
|
|||
|
if(this.topindex == 1){
|
|||
|
this.getcun()
|
|||
|
}else{
|
|||
|
this.getqujiu()
|
|||
|
}
|
|||
|
setTimeout(() => {
|
|||
|
this.isRefreshing = false
|
|||
|
}, 1000)
|
|||
|
},
|
|||
|
// 获取我的存酒
|
|||
|
getcun(){
|
|||
|
this.$u.get(`/app/storage/myWine?storeId=${this.$store.state.storeId}&pageNum=${this.pageNum}&pageSize=10`).then(res => {
|
|||
|
if (res.code == 200) {
|
|||
|
this.total = res.total
|
|||
|
if(this.pageNum == 1){
|
|||
|
this.cunlist = res.rows
|
|||
|
this.pageNum++
|
|||
|
}else{
|
|||
|
this.cunlist = this.cunlist.concat(res.rows)
|
|||
|
this.pageNum++
|
|||
|
}
|
|||
|
}else if(res.code == 401){
|
|||
|
uni.showModal({
|
|||
|
title: '提示',
|
|||
|
content: '你还未登录,是否去登录?',
|
|||
|
success: function (res) {
|
|||
|
if (res.confirm) {
|
|||
|
console.log('用户点击确定')
|
|||
|
uni.reLaunch({
|
|||
|
url:'/pages/login/login'
|
|||
|
})
|
|||
|
} else if (res.cancel) {
|
|||
|
console.log('用户点击取消')
|
|||
|
}
|
|||
|
}
|
|||
|
})
|
|||
|
}
|
|||
|
})
|
|||
|
},
|
|||
|
// 点击切换存取酒记录
|
|||
|
btntop(num){
|
|||
|
this.topindex = num
|
|||
|
this.pageNum = 1
|
|||
|
if(num == 1){
|
|||
|
this.getcun()
|
|||
|
}else if(num == 2){
|
|||
|
this.getqujiu()
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
</script>
|
|||
|
|
|||
|
<style lang="scss">
|
|||
|
page {
|
|||
|
background: #010000;
|
|||
|
}
|
|||
|
.wzactive{
|
|||
|
color: #FFFFFF !important;
|
|||
|
text{
|
|||
|
display: block;
|
|||
|
width: 40rpx;
|
|||
|
height: 6rpx;
|
|||
|
background: #FF8998;
|
|||
|
border-radius: 5rpx 5rpx 5rpx 5rpx;
|
|||
|
margin: auto;
|
|||
|
margin-top: 10rpx;
|
|||
|
}
|
|||
|
}
|
|||
|
.wu{
|
|||
|
width: 336rpx;
|
|||
|
height: 302rpx;
|
|||
|
margin: auto;
|
|||
|
margin-top: 200rpx;
|
|||
|
image{
|
|||
|
width: 336rpx;
|
|||
|
height: 302rpx;
|
|||
|
}
|
|||
|
}
|
|||
|
.cunbd{
|
|||
|
height: 80vh;
|
|||
|
overflow: scroll;
|
|||
|
margin-top: 30rpx;
|
|||
|
padding: 0 18rpx;
|
|||
|
box-sizing: border-box;
|
|||
|
.qulist{
|
|||
|
margin-top: 20rpx;
|
|||
|
background-color: #0E0C0C;
|
|||
|
padding: 22rpx 28rpx;
|
|||
|
box-sizing: border-box;
|
|||
|
.qujiutime{
|
|||
|
font-size: 24rpx;
|
|||
|
color: #808080;
|
|||
|
}
|
|||
|
.cen{
|
|||
|
image{
|
|||
|
width: 170rpx;
|
|||
|
height: 170rpx;
|
|||
|
margin-top: 20rpx;
|
|||
|
}
|
|||
|
text{
|
|||
|
display: block;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
.cunlist{
|
|||
|
display: flex;
|
|||
|
margin-top: 20rpx;
|
|||
|
padding: 0 18rpx;
|
|||
|
box-sizing: border-box;
|
|||
|
background-color: #0E0C0C;
|
|||
|
image{
|
|||
|
width: 170rpx;
|
|||
|
height: 170rpx;
|
|||
|
margin-right: 20rpx;
|
|||
|
}
|
|||
|
.cen{
|
|||
|
width: 70%;
|
|||
|
.name{
|
|||
|
font-size: 26rpx;
|
|||
|
color: #FFFFFF;
|
|||
|
}
|
|||
|
.sy{
|
|||
|
font-size: 26rpx;
|
|||
|
color: #7C7C7C;
|
|||
|
margin-top: 10rpx;
|
|||
|
}
|
|||
|
.bz{
|
|||
|
font-size: 26rpx;
|
|||
|
color: #7C7C7C;
|
|||
|
margin-top: 10rpx;
|
|||
|
}
|
|||
|
.time{
|
|||
|
font-size: 26rpx;
|
|||
|
color: #7C7C7C;
|
|||
|
margin-top: 10rpx;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
.top{
|
|||
|
display: flex;
|
|||
|
justify-content: space-between;
|
|||
|
padding: 0 118rpx;
|
|||
|
box-sizing: border-box;
|
|||
|
font-weight: 600;
|
|||
|
font-size: 32rpx;
|
|||
|
color: #808080;
|
|||
|
margin-top: 54rpx;
|
|||
|
}
|
|||
|
</style>
|