平板端快衣店
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.
 
 
 
 
 

203 lines
5.2 KiB

<template>
<view class="page1">
<view style="position: fixed;top: 0;z-index: 99;height: 70px;width: 100%;display: flex;background: #fff;padding-top: 30px;">
<uni-icons type="left" size='10' @tap="backPage"></uni-icons>
</view>
<view class="search" style="position: fixed;top: 70px;z-index: 99;">
<button size="default" type="default" @tap="addStock" hover-class="is-hover">新增盘点</button>
<uni-datetime-picker style="margin-bottom:20rpx;" v-model="range" @change="searchList" type="daterange" />
</view>
<view class="formBox">
<u-alert description="点击可查看盘点功能使用教程" @click="goTutorial" type="primary"></u-alert>
<view class="pd-box" v-for="(item,index) in stockList" :key="index" style="">
<view style="display: flex;border-bottom: 1px solid #eee;">
<view style="width: 90%;">
<view style="font-size: 18px;font-weight: bold;">
{{item.createTime}}
</view>
<view style="">{{'盘点人:'+item.createByName}}</view>
</view>
<view style="width: 10%;line-height: 60px;font-size: 18px;text-align: center;color: #777;">
{{item.delFlag == 0?'盘点中':'已完成'}}
</view>
</view>
<view style="display: flex;">
<view style="width: 50%;">
<view style="height: 30px;line-height: 30px;">
总盘款数:{{item.totalCount == null ? 0 : item.totalCount}}
<text v-if="item.extraCount > 0" style="margin-left: 20px;">
盘盈总数:{{item.extraCount}} <text style="margin-left: 20px;">盘盈总额:{{item.extraTotal}}</text>
</text>
<text v-if="item.lessCount > 0" style="margin-left: 20px;">
盘亏总数:{{item.lessCount}} <text style="margin-left: 20px;">盘亏总额:{{item.lessTotal}}</text>
</text>
</view>
</view>
<view style="width: 50%;">
<view class="btn" v-if="item.delFlag == 0" @tap="onItemClick(item)">继续盘点</view>
<view class="btn" v-else @tap="onItemClick(item)">查看详情</view>
<view class="btn" v-if="item.delFlag == 0" @tap.stop="delStock(item.id)">删除</view>
</view>
</view>
</view>
</view>
<u-loadmore :status="status" />
</view>
</template>
<script>
export default {
data() {
return {
status: 'loadmore',
pages: 1,
totalPages: 0,
range:[],
stockList:[]
}
},
onShow() {
this.getList()
},
onReachBottom() {
if (this.pages >= this.totalPages) return;
this.status = 'loading';
this.pages = ++this.pages;
this.getList();
},
methods: {
getList() {
this.status = 'loading';
this.tui.request("/app/checkStock/getCheckStockList", "POST", {
startDate:this.range[0],
endDate:this.range[1],
pageNum:this.pages,
pageSize:10
}, false, false).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
if (this.pages == 1) {
this.stockList = res.result.records
} else {
this.stockList = [...this.stockList, ...res.result.records]
}
this.totalPages = res.result.pages
} else {
this.tui.toast(res.message)
}
})
},
searchList(res) {
this.pages = 1;
this.stockList = [];
this.getList()
},
addStock(){
this.tui.request("/app/checkStock/addCheckStock", "POST", {}, false, false).then((res) => {
if (res.code == 200) {
uni.setStorageSync('stockId',res.result.id);
uni.navigateTo({
url: '/package2/stock/addStockList'
})
} else {
this.tui.toast(res.message)
}
})
},
onItemClick(target) {
uni.setStorageSync('stockId',target.id);
uni.navigateTo({
url: '/package2/stock/addStockList'
})
},
backPage(){
uni.navigateBack()
},
goTutorial(){
uni.navigateTo({
url: `/package2/other/tutorialList`
})
},
delStock(id){
let that = this;
uni.showModal({
title: "提示",
content: "确认要删除此条盘点信息吗?",
success: function(res) {
if(res.confirm){
that.tui.request("/app/checkStock/deleteCheckStock", "post", {
id:id
}, false, true).then((res) => {
if (res.code == 200) {
uni.showToast({
title: "删除成功",
icon: 'none'
})
setTimeout(res=> {
that.getList();
},2000)
} else {
uni.showToast({
title: "盘点失败",
icon: 'none'
})
}
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
page,.page1{
font-size: 14px;
}
.formBox {
margin-top: 170px;
}
.btn{
width: 80px;
height: 30px;
line-height: 30px;
color: #fff;
background: #5fd9ee;
margin-top: 5px;
padding: 0;
float: right;
margin-left:10px;
border-radius: 10px;
text-align: center;
}
button {
color: #ffffff;
background: #5fd9ee;
width: 100%;
margin-bottom: 10px;
height: 40px;
line-height: 40px;
}
.search {
padding: 0 20px 10px;
background-color: #fff;
width: 100%;
background-color: #fff;
}
.u-alert{
padding: 10px 20px !important;
}
.pd-box{
width: 95%;
margin: 10px auto 0;
background: #fff;
padding: 10px 20px;
line-height: 30px;
border-radius: 10px;
box-shadow: 0 0px 6px 1px rgba(7,7,7,0.2);
}
</style>