jsy-app/pages/retrace/signBill.vue

160 lines
4.5 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<z-paging ref="paging" @query="queryList" v-model="dataList" :default-page-size="queryParams.pageSize"
:auto-show-system-loading="true" empty-view-text="抱歉,暂时还没有相关数据!">
<template #top>
<custom-nav-bar :left="true" title="签收单">
<template v-slot:right>
<view class="fixed">
<view align="right" class="iconfont icon-jia icon" v-hasPermi="['iot:signBill:add']"
@click="onAdd">
</view>
</view>
</template>
</custom-nav-bar>
<view style="padding: 5px 10px;background-color: #fff;">
<u-search placeholder="请输入仓库名称/操作者" v-model="queryParams.searchValue" @search="queryList" shape="square"
@custom="queryList" />
<uni-datetime-picker v-model="range" type="daterange" @maskClick="maskClick" style="margin-top: 5px;" />
</view>
</template>
<view class="card" v-for="item in dataList">
<view class="cards-title">
<view>
<view class="text">签收单编号:{{ item.billCode}}</view>
</view>
<view class="title-r" v-hasPermi="['iot:signBill:remove']">
<u-button class="bg-red" type="success" size="mini" text="删除" @click="deleteBill(item)" />
</view>
</view>
<view class="cards-content">
<view class="txt-list" @click="onEdit(item)">
<view class="left">
<view v-if="item.storageOutType==1"><text>签收仓库:</text>{{ item.storageInName}}</view>
<view v-if="item.storageOutType==2"><text>签收手持机:</text>{{ item.devicePdaCode}}</view>
<view><text>签收日期:</text>{{ item.billDate}}</view>
<view><text>签收人:</text>{{ item.operUser}}</view>
<view><text>签收时间:</text>{{ item.billTime}}</view>
</view>
<view class="right">
<view class="iconfont icon-you">
</view>
</view>
</view>
</view>
<view class="record">
<view v-for="itemType in item.deviceBillWmsVoCounts">{{itemType.deviceTypeName}}{{itemType.amount}} </view>
</view>
</view>
</z-paging>
</template>
<script>
import store from "@/store"
import plugin from "@/plugins"
import {
getDeviceBillBriefList,
deleteDeviceBill
} from "@/api/system/deviceBill"
export default {
data() {
return {
user: store.state.user.user,
dataList: [],
deviceStorageUser: {},
range: [],
queryParams: {
billTypeId: 2003,
pageNum: 1,
pageSize: 20,
searchValue: "",
params: {
beginTime: null,
endTime: null
}
}
}
},
watch: {
range(newval) {
if (newval && newval.length) {
this.queryParams.params.beginTime = newval[0];
this.queryParams.params.endTime = newval[1];
}
this.queryList(1, 20);
}
},
onLoad() {
this.range.push(this.getSevenDaysAgo())
this.range.push(this.getNowFormatDate())
if (this.range && this.range.length) {
this.queryParams.params.beginTime = this.range[0];
this.queryParams.params.endTime = this.range[1];
}
},
onShow() {
uni.$off("cancelpage");
uni.$on("cancelpage", e => {
this.queryList(1, 20);
})
},
mounted() {},
methods: {
queryList(pageNo, pageSize) {
this.queryParams.pageNum = pageNo;
getDeviceBillBriefList(this.queryParams).then(res => {
this.$refs.paging.completeByTotal(res.rows, res.total);
});
},
onEdit(item) {
uni.navigateTo({
url: '/pages/retrace/signBillAdd?type=edit&id=' + item.billId
});
},
//新增
onAdd() {
uni.navigateTo({
url: '/pages/retrace/signBillAdd'
});
},
deleteBill(row) {
plugin.modal.confirm("确定删除吗?").then(res => {
deleteDeviceBill(row.billId).then(res => {
uni.$u.toast("删除成功");
//重新刷新列表
this.queryList(1, 20);
})
})
},
maskClick(e) {
this.queryList(1, 20);
},
getNowFormatDate() {
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let d = date.getDate();
if (month < 10) {
month = "0" + month;
}
if (d < 10) {
d = "0" + d;
}
return year + "-" + month + "-" + d;
},
getSevenDaysAgo() {
const today = new Date();
const sevenDaysAgo = new Date(today);
sevenDaysAgo.setDate(today.getDate() - 7);
// 格式化为 YYYY-MM-DD 格式
const year = sevenDaysAgo.getFullYear();
const month = String(sevenDaysAgo.getMonth() + 1).padStart(2, '0');
const day = String(sevenDaysAgo.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
}
}
</script>
<style lang="scss" scoped>
.left1{border-bottom: 1px solid #eee;width: 100%;line-height: 30px;}
</style>