<template>
|
<view class="content">
|
<view class="form">
|
<view class="form-item">
|
<view class="title"><text>*</text>条码:</view>
|
<view class="right" style="width: 380rpx;">
|
<input :focus="HBarCodeFocus" v-model="HBarCode" placeholder="请扫描(或输入)条码"
|
@confirm="getCode(HBarCode)" />
|
</view>
|
<uni-icons type="scan"
|
style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
|
size="20" @click="toScanCode"></uni-icons>
|
</view>
|
<view class="form-item">
|
<view class="title">单据号:</view>
|
<view class="righton">
|
<input v-model="baseInfo.HBillNo" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">供应商:</view>
|
<view class="righton">
|
<input v-model="baseInfo.HSupName" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">部门:</view>
|
<view class="righton">
|
<input v-model="baseInfo.HDeptName" disabled />
|
</view>
|
</view>
|
</view>
|
|
<view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
|
|
<view class="list" v-for="(item,index) in listData" :key="index" @tap="toSon(item)">
|
<uni-card :title="item.物料代码" :extra="'No. ' + Number(index+1)" style="margin: 10px;">
|
<view class="card-detail">
|
<view class="detail">
|
<text>物料名称:</text>{{item.物料名称}}
|
</view>
|
<view class="detail">
|
<text>规格型号:</text>{{item.规格型号}}
|
</view>
|
<view class="detail">
|
<text>订单数量:</text>{{item.数量}}
|
</view>
|
</view>
|
|
</uni-card>
|
</view>
|
|
<view class="over" v-if="listData.length == 0">暂无数据</view>
|
<view class="over" v-if="listData.length != 0">已到底</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
CommonUtils
|
} from "../../utils/common";
|
import {
|
getUserInfo
|
} from "@/utils/auth.js";
|
import BillTypeValueMap from "@/static/json/BillTypeValueMap"
|
export default {
|
data() {
|
return {
|
HBarCodeFocus: false,
|
|
userInfo: getUserInfo(),
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
HBarCode: '',
|
baseInfo: {
|
HBillNo: '',
|
HSupName: '',
|
HDeptName: '',
|
HInterID: '',
|
HBillType: 0,
|
},
|
sWhere: '',
|
listData: [],
|
}
|
},
|
onLoad(params) {
|
this.HBarCodeFocus = true
|
if (!CommonUtils.isEmpty(params.HBillType)) {
|
this.baseInfo.HBillType = params.HBillType
|
}
|
|
uni.setNavigationBarTitle({
|
title: BillTypeValueMap[this.baseInfo.HBillType]
|
})
|
},
|
methods: {
|
async refreshBarCodeState() {
|
this.HBarCodeFocus = false
|
await this.$nextTick(() => {
|
this.HBarCodeFocus = true
|
this.HBarCode = ""
|
})
|
},
|
playSound(e) {
|
const innerAudioContext = uni.createInnerAudioContext();
|
if (e == 1) {
|
innerAudioContext.src = '/static/success.wav';
|
} else {
|
innerAudioContext.src = '/static/jingbao.wav';
|
}
|
innerAudioContext.play(); // 播放音频
|
},
|
//扫码
|
toScanCode() {
|
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
mpaasScanModule.mpaasScan({
|
'hideAlbum': true,
|
'timeoutInterval': '10', //超时时间
|
'timeoutText': '未识别到二维码' //超时提醒
|
}, (ret) => {
|
console.log(ret.resp_result)
|
this.HBarCode = ret.resp_result
|
this.getCode(this.HBarCode)
|
})
|
},
|
//扫条码处理
|
getCode(HBarCode) {
|
if (!HBarCode) {
|
CommonUtils.playSound(0)
|
this.refreshBarCodeState()
|
uni.showToast({
|
title: '条码不能为空',
|
icon: 'none'
|
})
|
} else {
|
HBarCode = HBarCode.trim()
|
let [HBarCodeBillNo] = HBarCode.split("@") //第一个参数表示单据号
|
let HBillType = this.baseInfo.HBillType
|
uni.request({
|
url: this.serverUrl + '/Web/GetBillInfo',
|
data: {
|
HBillno: HBarCodeBillNo,
|
HBillType: HBillType,
|
HStockOrgID: uni.getStorageSync("OrganizationID")
|
},
|
success: (res) => {
|
console.log('扫码返回', res.data.data);
|
this.HBarCode = ''
|
if (res.data.count == 1) {
|
if(res.data.data.length < 1) {
|
CommonUtils.playSound(0)
|
return uni.showToast({
|
title: '该单据号对应的单据不存在!',
|
icon: 'none'
|
})
|
}
|
CommonUtils.playSound(1)
|
var data = res.data.data
|
this.baseInfo = {
|
HBillNo: data[0].单据号,
|
HSupName: data[0].供应商,
|
HDeptName: data[0].部门,
|
HInterID: data[0].hmainid,
|
HBillType: this.baseInfo.HBillType
|
}
|
this.listData = data
|
} else {
|
CommonUtils.playSound(0)
|
this.refreshBarCodeState()
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
CommonUtils.playSound(0)
|
this.refreshBarCodeState()
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
}
|
},
|
toSon(item) {
|
console.log(item)
|
uni.navigateTo({
|
url: './table_son?OperationType=1&closeType=1&linterid=' + item.hmainid + '&hsubid=' + item
|
.hsubid + '&HBillType=' + this.baseInfo.HBillType
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.form {
|
width: 640rpx;
|
margin: 20rpx auto;
|
}
|
|
.form-item {
|
display: flex;
|
align-items: center;
|
font-size: 28rpx;
|
padding: 6rpx 0;
|
|
.title {
|
width: 180rpx;
|
|
text {
|
color: red;
|
font-weight: bold;
|
}
|
}
|
|
.right {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
}
|
|
.righton {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #e4e4e4;
|
background-color: #e4e4e4;
|
}
|
|
input {
|
width: 100%;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
}
|
|
.buttons {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
margin-top: 20rpx;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
|
.btn-a {
|
background-color: #acacac;
|
color: #fff;
|
}
|
|
.btn-b {
|
background-color: #41a863;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #3a78ff;
|
color: #fff;
|
}
|
}
|
|
.list {
|
width: 100%;
|
|
.card-detail {
|
width: 100%;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
line-height: 120%;
|
|
.detail {
|
// width: 50%;
|
font-size: 26rpx;
|
margin-bottom: 12rpx;
|
color: #555;
|
margin-right: 20rpx;
|
|
text {
|
color: #999;
|
font-size: 26rpx;
|
}
|
}
|
}
|
|
.more {
|
color: #888;
|
font-size: 24rpx;
|
display: flex;
|
border-top: 1px solid #eee;
|
padding-top: 20rpx;
|
|
.part {
|
width: 50%;
|
text-align: center;
|
}
|
}
|
}
|
</style>
|