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

514 lines
13 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class='container'>
<tui-list-cell :lineLeft="false">
<view class="tui-item-box">
<view class="tui-msg-box">
<image src="../../static/stockout.png" class="tui-msg-pic" mode="widthFix"></image>
<view class="tui-msg-item">
<view v-if="info" class="tui-msg-name">请先拍照再确认明细信息</view>
</view>
</view>
</view>
</tui-list-cell>
<tui-list-cell :lineLeft="false">
<view class="tui-item-box">
<view class="tui-msg-box">
<view v-if="tableData" class="tui-msg-item">
<button v-if="tableData.length > 0" @click="checkIn()">确认出库执行</button>
</view>
<view class="tui-msg-item" style="margin-left: 10px;">
<button v-if="imgList && imgList.length > 0"
@click="pickImage()">已选择{{imgList.length}}张图片</button>
<button v-else @click="pickImage()">请拍照</button>
</view>
</view>
</view>
</tui-list-cell>
<view class="uni-container" v-if="tableData">
<uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th width="100" align="center">车号</uni-th>
<uni-th width="150" align="center">条码号</uni-th>
<uni-th align="center">毛重 + 件数</uni-th>
<uni-th width="204" align="center">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
<uni-td>
<view class="name">{{ item.TRUCKNO }}</view>
</uni-td>
<uni-td>
<view class="name">{{ item.CNTRNO }}</view>
</uni-td>
<uni-td align="center">{{ item.KGS }}|{{ item.PKGS }}</uni-td>
<uni-td>
<view class="uni-group">
<button class="uni-button" size="mini" type="primary" v-if="!item.ISEXECUTE"
@click="edit(item)">修改</button>
<button class="uni-button" size="mini" type="warn" v-if="!item.ISEXECUTE"
@click="del(item)">删除</button>
</view>
</uni-td>
</uni-tr>
</uni-table>
</view>
<template v-if="info" >
<uni-card :title="info.GOODSNAME">
<view class="example">
<uni-forms ref="form" label-position="left">
<uni-forms-item label="条码号" name="CNTRNO">
<uni-easyinput type="text" :disabled="true" v-model="info.CNTRNO" />
</uni-forms-item>
<uni-forms-item label="箱号" name="MBLNO">
<uni-easyinput type="text" v-model="info.MBLNO" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="仓库" name="STOREHOUSENAME">
<uni-easyinput type="text" v-model="info.STOREHOUSENAME" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="库位" name="AREANAME">
<uni-easyinput type="text" v-model="info.AREANAME" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="毛重(千克)" name="KGS">
<uni-easyinput type="number" v-model="info.KGS" placeholder="请输入毛重" />
</uni-forms-item>
<uni-forms-item label="净重(千克)" name="NETWEIGHT">
<uni-easyinput type="number" v-model="info.NETWEIGHT" placeholder="请输入净重" />
</uni-forms-item>
<uni-forms-item label="体积(立方米)" name="CBM">
<uni-easyinput type="number" v-model="info.CBM" placeholder="请输入体积" />
</uni-forms-item>
<uni-forms-item label="件数" name="PKGS">
<uni-easyinput type="number" v-model="info.PKGS" placeholder="请输入件数" />
</uni-forms-item>
<uni-forms-item label="规格型号" name="GOODSMODEL">
<uni-easyinput type="text" v-model="info.GOODSMODEL" :disabled="true" placeholder="请输入规格型号" />
</uni-forms-item>
<uni-forms-item label="箱型" name="CTNALL">
<uni-easyinput type="text" v-model="info.CTNALL" :disabled="true" placeholder="请输入箱型" />
</uni-forms-item>
<uni-forms-item label="计费单位" name="STORAGEUNIT">
<uni-easyinput type="text" v-model="info.STORAGEUNIT" :disabled="true" placeholder="请输入计费单位" />
</uni-forms-item>
<uni-forms-item label="计费数量" name="STORAGEUNITCOUNT">
<uni-easyinput type="number" v-model="info.STORAGEUNITCOUNT" placeholder="请输入计费数量" />
</uni-forms-item>
</uni-forms>
<button @click="addTable()"></button>
</view>
</uni-card>
</template>
</view>
</template>
<script>
export default {
data() {
return {
isshow: false,
isbinding: true,
key: '',
temp: '',
info: null,
loading: false,
areaList: [],
imgList: [],
tempArea: '',
tableData: [],
}
},
onReady() {
// 需要在onReady中设置规则
// this.$refs.form.setRules(this.rules)
},
onLoad: function(option) {
var _this = this
// console.log('跳转信息:', JSON.parse(decodeURIComponent(option.info)))
if (option.info) {
let $info = JSON.parse(decodeURIComponent(option.info))
_this.info = JSON.parse(JSON.stringify($info))
_this.temp = JSON.parse(JSON.stringify($info))
// _this.getAreaList(_this.info.WMSPLANID)
_this.getInfo()
}
},
onShow: function() {
var _this = this
_this.getInfo()
},
methods: {
getInfo: function() {
uni.showLoading()
this.tui.request("/StockOut/GetStockOutDoGoods?id=" + uni.getStorageSync("TRUCKID"), "GET", null, false, false,
false)
.then((
res) => {
console.log(res)
if (res.Code == 0) {
this.tableData = res.Data
// console.log(this.list)
uni.hideLoading()
} else if (res.Code == -1) {
this.tui.toast(res.Message, 2000, 'none')
}
}).catch((err) => {
this.tui.toast('异常:' + err, 2000, 'none')
uni.hideLoading()
})
},
addTable: function() {
console.log('重复检测', this.info.CNTRNO)
let key = this.tableData.findIndex(item => {
if (item.CNTRNO == this.info.CNTRNO) {
return true
}
})
console.log('重复检测', key)
if (key == -1) {
console.log(uni.getStorageSync("TRUCKNO"))
this.info.TRUCKNO = uni.getStorageSync("TRUCKNO")
this.tableData.push(this.info)
this.$set(this, 'info', {})
// this.temp.AREACODE = this.tempArea
let _temp = JSON.parse(JSON.stringify(this.temp))
this.$set(this, 'info', _temp)
} else {
this.tui.toast('请勿重复添加', 2000, 'none')
}
},
edit: function(data) {
let key = this.tableData.findIndex(item => {
if (item.CNTRNO == data.CNTRNO) {
return true
}
})
this.tableData.splice(key, 1)
this.$set(this, 'info', {})
this.$set(this, 'info', data)
},
del: function(data) {
let key = this.tableData.findIndex(item => {
if (item.CNTRNO == data.CNTRNO) {
return true
}
})
this.tableData.splice(key, 1)
this.$set(this, 'info', {})
// this.temp.AREACODE = this.tempArea
let _temp = JSON.parse(JSON.stringify(this.temp))
this.$set(this, 'info', _temp)
},
checkIn: function() {
uni.showLoading()
this.$refs.form.validate().then(res => {
uni.hideLoading()
// console.log('表单数据信息:', res);
let postData = {
GID: this.info.WMSOUTDETAILID,
WMSPLANID: this.info.WMSPLANID,
TRUCKID:uni.getStorageSync("TRUCKID"),
CNTRNO:this.info.CNTRNO,
InfoFiles: this.imgList,
Goods: this.tableData
}
this.tui.request("/StockOut/StockOutGoods", "POST", postData, false, false, false)
.then((
res) => {
console.log(res)
if (res.Code == 0) {
this.tui.toast(res.Message, 2000, 'success')
uni.navigateBack();
} else if (res.Code == -1) {
this.tui.toast(res.Message, 2000, 'none')
}
}).catch((err) => {
this.tui.toast('异常:' + err, 2000, 'none')
})
}).catch(err => {
uni.hideLoading()
this.tui.toast('请检查表单!', 2000, 'none')
})
},
pickImage: function() {
console.log('==== picker ====')
uni.chooseImage({
count: 1, //可选择数量默认9
sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //从相册选择或从使用相机
success: (temp) => {
const files = temp.tempFiles;
// console.log(files[0])
var path = files[0].path
var filename = path.replace(/(.*\/)*([^.]+).*/ig,"$2")+".jpg"
uni.showLoading()
uni.uploadFile({
url: this.tui.uploadUrl(), //仅为示例,非真实的接口地址
fileType:"image",//ZFB必填,不然报错
filePath: temp.tempFilePaths[0],//这个就是我们上面拍照返回或者先中照片返回的数组
name: 'files',
success: res => {
console.log(res)
this.imgList.push({name: filename ,url:JSON.parse(res.data).data + filename})
console.log(this.imgList)
uni.hideLoading();
},
fail(err) {
console.log(err)
// this.tui.toast('上传失败', 2000, 'none')
uni.hideLoading();
}
});
// // const tempFilePaths = res.tempFilePaths;
// const files = temp.tempFiles;
// let imgArr = [];
// //这里是关键点
// for (let i = 0; i < files.length; i++) {
// let obj = new Object();
// obj.name = 'img' + i;
// obj.uri = files[i].path;
// imgArr.push(obj);
// }
// console.log(imgArr)
// uni.showLoading()
// uni.uploadFile({
// url: this.tui.interfaceUrl() + '/Home/UploadFile', //仅为示例,非真实的接口地址
// files: imgArr,
// fileType: "image",
// success: uploadFileRes => {
// //console.log(uploadFileRes)
// console.log(JSON.parse(uploadFileRes.data).Data)
// this.imgList = JSON.parse(uploadFileRes.data).Data
// this.tui.toast('上传成功', 2000, 'success')
// uni.hideLoading();
// },
// fail() {
// this.tui.toast('上传失败', 2000, 'none')
// uni.hideLoading();
// }
// });
}
})
}
}
}
</script>
<style>
/* @import '../../static/style/thorui.css'; */
.tui-msg-box {
display: flex;
align-items: center;
}
.example {
padding: 15px;
background-color: #fff;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.form-item {
display: flex;
align-items: center;
}
.button {
display: flex;
align-items: center;
height: 35px;
margin-left: 10px;
}
.tui-msg-pic {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
display: block;
margin-right: 24rpx;
flex-shrink: 0;
}
.tui-msg-item {
max-width: 500rpx;
/* min-height: 100rpx; */
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.tui-msg-name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 45rpx;
line-height: 2;
justify-content: space-between;
color: #262b3a;
}
.tui-item-box {
width: 100%;
display: flex;
align-items: center;
}
.tui-list-cell_name {
padding-left: 20rpx;
display: flex;
align-items: center;
justify-content: center;
}
.tui-ml-auto {
margin-left: auto;
}
.tui-right {
margin-left: auto;
margin-right: 34rpx;
font-size: 26rpx;
color: #999;
}
.tui-logo {
height: 52rpx;
width: 52rpx;
flex-shrink: 0;
}
</style>
<style lang='scss'>
.fr-right-blue {
float: right;
font-family: 微软雅黑;
color: #4977E7;
}
.fr-left-blue {
float: left;
font-family: 微软雅黑;
color: #4977E7;
}
.fr-right-green {
float: right;
font-family: 微软雅黑;
color: #11AE11;
}
.color-999 {
color: #999;
}
.color-red {
color: red;
}
.fr-right {
float: right;
font-family: 微软雅黑;
color: #999;
}
.list-card {
margin: 20upx 0;
background-color: #ffffff;
/* font-size: 28upx; */
transform: all 1s;
.card-head {
padding: 20upx;
height: 80upx;
font-size: 35upx;
box-sizing: border-box;
border-bottom: 2upx solid #f5f5f5;
}
.card-body {
padding: 20upx;
display: flex;
flex-wrap: wrap;
text {
width: 50%;
font-size: 32upx;
line-height: 55upx;
}
}
.card-foot {
height: 88upx;
/* margin: 20upx 0; */
padding: 0 20upx;
border-top: 2upx solid #f5f5f5;
border-bottom: none;
line-height: 88upx;
.btn {
height: 60upx;
font-size: 28upx;
line-height: 60upx;
margin: 14upx 0;
}
}
}
.tui-searchbox {
padding: 30rpx 0;
box-sizing: border-box;
display: flex;
align-items: center;
}
.tui-search-input {
width: 100%;
height: 66rpx;
border-radius: 35rpx;
padding: 0 30rpx;
box-sizing: border-box;
background: #f2f2f2;
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.tui-input {
flex: 1;
color: #333;
padding: 0 16rpx;
font-size: 28rpx;
}
.tui-input-plholder {
font-size: 28rpx;
color: #b2b2b2;
}
.fr-btn {
float: right;
height: 60upx;
font-size: 28upx;
line-height: 60upx;
margin: 14upx 0;
}
;
.uni-group {
display: flex;
align-items: center;
}
</style>
-->