<template>
|
<view>
|
<page-nav title="采购入库4"></page-nav>
|
|
<view v-if='purchorderArr.length!==0' class="mainContent" style="">
|
<view>
|
<u-gap height="10" bgColor="#eff0f1"></u-gap>
|
<view class="head">
|
<!-- max-height: 1340rpx;overflow: auto; -->
|
<view style="">
|
|
<view class="head" style="position: relative;">
|
|
<u-radio-group v-model="radioValue" class="flex_column">
|
<view class=" flex_column" style="width: 100%;" @click="radioValueClick(item.sbid)"
|
v-for="(item,index) in purchorderArr" :key="item.sbid">
|
|
<view class="head_block" style="position: absolute;margin: 38rpx 0 0 0;">
|
<view class="head_left">
|
<view class="head_bar"></view>
|
<view class="head_title" style="font-weight: bold;">
|
物料信息
|
</view>
|
</view>
|
</view>
|
|
|
<view class="orderNumber" :key="item.sbid">
|
{{(index+1).toString().padStart(2,0)}}
|
</view>
|
|
<view class="trash" v-show="purchorderArr.length>1" @click="trashClick(index)">
|
<u-icon name="trash" size='20'></u-icon>
|
</view>
|
|
<view v-show="purchorderArr.length===1" style="width: 48rpx;height: 48rpx;">
|
</view>
|
|
|
|
<view class="flex_between marginBottom20 marginLeft20 marginTop20">
|
<view style="display: flex;">
|
<view class="flex_column titleFont">
|
<view>物料编码:</view>
|
<view>物料名称:</view>
|
<view>物料规格:</view>
|
<view>采购订单:</view>
|
<view>到货进度:</view>
|
<!-- <view>物料标签:</view> -->
|
<view v-show="!item.arrowType">物料数量:</view>
|
<view v-show="!item.arrowType">供方信息:</view>
|
<view v-show="!item.arrowType">采购批次:</view>
|
<view v-show="!item.arrowType">质量状态:</view>
|
</view>
|
<view class="flex_column contentFont">
|
<view>{{item.partcode}}</view>
|
<view>{{item.partname}}</view>
|
<view class="ellipsis" style="width: 460rpx;">
|
{{item.partspec?item.partspec:'/'}}
|
</view>
|
<view>{{item.ordercode}}</view>
|
<view style="height: 50rpx;display: flex;align-items: center;">
|
<u-line-progress :percentage="(item.hqty/item.hplanqty)*100"
|
height="12" :showText='false'></u-line-progress>
|
<view style="margin-left: 6rpx; color:#2979FF">
|
{{item.hqty}}
|
</view>
|
<view>
|
/
|
</view>
|
<view>
|
{{item.hplanqty}} PCS
|
</view>
|
</view>
|
<!-- <view>还像还没返回</view> -->
|
<view v-show="!item.arrowType">{{item.hqty}}</view>
|
<view v-show="!item.arrowType">{{item.customername}}</view>
|
<view v-show="!item.arrowType">/</view>
|
<view v-show="!item.arrowType">
|
<view v-if="!item.qualitystatus">/</view>
|
<view v-else style="display: flex;align-items: center;">
|
|
<u-icon name="tags-fill" color="green" size="20"
|
v-if="item.qualitystatus==='CS'"></u-icon>
|
<view style="margin-left: 10rpx;"
|
v-if="item.qualitystatus==='CS'">免检</view>
|
|
<u-icon name="checkmark-circle-fill" color="#55ff00" size="20"
|
v-if="item.qualitystatus==='OK'"></u-icon>
|
<view style="margin-left: 10rpx;"
|
v-if="item.qualitystatus==='OK'">合格</view>
|
|
<u-icon name="close-circle-fill" color="#FF0000" size="20"
|
v-if="item.qualitystatus==='NG'"></u-icon>
|
<view style="margin-left: 10rpx;"
|
v-if="item.qualitystatus==='NG'">不合格</view>
|
|
<u-icon name="more-circle-fill" color="#55aaff" size="20"
|
v-if="item.qualitystatus==='TS'"></u-icon>
|
<view style="margin-left: 10rpx;"
|
v-if="item.qualitystatus==='TS'">待检</view>
|
|
</view>
|
</view>
|
|
</view>
|
</view>
|
<u-radio size='20' class="marginRight20" :key="item.sbid" :name="item.sbid"
|
activeColor="red"></u-radio>
|
</view>
|
|
|
<view class="head_block" v-show="!item.arrowType">
|
<view class="head_left">
|
<view class="head_bar"></view>
|
<view class="head_title" style="font-weight: bold;">
|
扫描库位
|
</view>
|
</view>
|
|
<view class="marginRight20">
|
<u-icon name="scan" @click="topScanClick" color="red" size="28"></u-icon>
|
</view>
|
</view>
|
|
<view class="flex_between marginBottom20 marginLeft20 marginTop20"
|
v-show="!item.arrowType">
|
<view style="display: flex;">
|
<view class="flex_column titleFont">
|
<view>库位信息:</view>
|
<view>所属仓库:</view>
|
</view>
|
|
<view class="flex_column contentFont" @click="sheetShow=true">
|
<view v-if="item.lcationcode">{{item.lcationcode}}</view>
|
<view v-else style="color: #ccc;">点击选择或扫库位码</view>
|
<view v-if="item.stockcode">{{item.stockcode}}</view>
|
<view v-else style="color: #ccc;">点击选择或扫库位码</view>
|
</view>
|
</view>
|
</view>
|
|
|
<view style="display: flex;justify-content: center;margin : 10rpx; 0">
|
<view class="arrowClass"
|
@click="item.arrowType?arrowDownClick(item):arrowUpClick(item)">
|
<u-icon :name="item.arrowType?'arrow-down':'arrow-up'" color="#c8c8c8"
|
size="25"></u-icon>
|
</view>
|
</view>
|
|
<u-gap height="10" v-if="index!==purchorderArr.length-1" bgColor="#eff0f1"></u-gap>
|
|
|
</view>
|
</u-radio-group>
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
|
<view class="footer">
|
<u-button size="large" :loading="isDisabledSubmitButton" :disabled="isDisabledSubmitButton"
|
loadingText="正在提交,请稍等..." type="primary" @click="submit" text="确认提交">
|
</u-button>
|
</view>
|
|
|
<u-picker :show="sheetShow" :columns="columns" :itemHeight='55' :closeOnClickOverlay='true'
|
@close='sheetShow=false' @change="changeHandler" @confirm='pickerConfirm'
|
@cancel='sheetShow=false'></u-picker>
|
|
|
</view>
|
</template>
|
|
|
<script>
|
import {
|
MesAppPurchInStorSelectCGOrderPart,
|
WarehouseLocationSearchStoreHouse,
|
MesAppPurchInStorSave,
|
WareHouseLocation
|
} from '../../config/api.js';
|
|
const App = getApp()
|
export default {
|
|
onLoad(option) {
|
this.getMesAppPurchInStorSelectCGOrderPart(option.ordercode)
|
},
|
|
onPullDownRefresh() {
|
setTimeout(() => {
|
this.init(() => {
|
uni.stopPullDownRefresh();
|
})
|
}, 1000);
|
},
|
|
data() {
|
return {
|
purchorderObj: {},
|
purchorderArr: [],
|
radioValue: '',
|
sheetShow: false, //上拉列表是否展开
|
sheetList: [],
|
columns: [],
|
columnsData: [],
|
wareHouseLocationArr: [], //仓库库位数组
|
isDisabledSubmitButton: false
|
}
|
},
|
created() {
|
|
},
|
mounted() {
|
this.init()
|
this.getWareHouseLocation()
|
|
|
// this.getMesAppPurchInStorSelectCGOrderPart('PO-2025-01-0002')
|
// this.getWarehouseLocationSearchStoreHouse('0011')
|
},
|
methods: {
|
async getWareHouseLocation() {
|
const {
|
data: res
|
} = await WareHouseLocation()
|
this.wareHouseLocationArr = res.filter(i => i.children.length > 0)
|
this.columns = [
|
this.wareHouseLocationArr.map(i => i.text),
|
this.wareHouseLocationArr[0].children.map(i => i.text)
|
]
|
this.wareHouseLocationArr.forEach(i => {
|
this.columnsData.push(i.children.map(j => j.text))
|
})
|
|
},
|
changeHandler(e) {
|
const {
|
columnIndex,
|
value,
|
values, // values为当前变化列的数组内容
|
index,
|
// 微信小程序无法将picker实例传出来,只能通过ref操作
|
picker = this.$refs.uPicker
|
} = e
|
// 当第一列值发生变化时,变化第二列(后一列)对应的选项
|
if (columnIndex === 0) {
|
// picker为选择器this实例,变化第二列对应的选项
|
picker.setColumnValues(1, this.columnsData[index])
|
}
|
},
|
init() {
|
uni.stopPullDownRefresh();
|
},
|
// 扫描
|
topScanClick() {
|
let that = this;
|
|
uni.scanCode({
|
onlyFromCamera: true,
|
// scanType: ['barCode', 'qrCode'],
|
scanType: ['qrCode'],
|
success: function(res) {
|
console.log('条码类型:' + res.scanType);
|
console.log('条码内容:' + res.result);
|
that.scanContent = res.result;
|
that.getWarehouseLocationSearchStoreHouse(that.scanContent)
|
},
|
complete: function(res) {
|
|
},
|
fail: function(res) {
|
console.log('条码类型:' + res.scanType);
|
console.log('条码内容:' + res.result);
|
}
|
|
});
|
},
|
|
async getWarehouseLocationSearchStoreHouse(locationcode) {
|
const data = {
|
locationcode
|
}
|
const res = await WarehouseLocationSearchStoreHouse(data)
|
if (res.code === '200') {
|
this.purchorderObj.lcationcode = res.data[0].locationname
|
this.purchorderObj.stockcode = res.data[0].warehousename
|
|
this.purchorderObj.lcationname2 = res.data[0].locationcode
|
this.purchorderObj.stockname2 = res.data[0].warehousecode
|
} else {
|
this.$u.toast(res.message)
|
}
|
},
|
// 获取标签信息
|
async getMesAppPurchInStorSelectCGOrderPart(ordercode) {
|
const data = {
|
ordercode
|
}
|
const res = await MesAppPurchInStorSelectCGOrderPart(this.global.formatData(data))
|
if (res.code === '200') {
|
res.data.forEach((i, ind) => {
|
i.arrowType = ind !== 0
|
i.lcationcode = '' //库位
|
i.stockcode = '' //仓库
|
})
|
this.purchorderArr = res.data
|
this.purchorderObj = this.purchorderArr[0]
|
this.radioValue = this.purchorderObj.sbid
|
}
|
},
|
// picker确认按钮
|
pickerConfirm(val) {
|
|
this.purchorderObj.lcationcode = val.value[1]
|
this.purchorderObj.stockcode = val.value[0]
|
|
this.purchorderObj.stockname2 = this.wareHouseLocationArr.find(i => i.text === this.purchorderObj
|
.stockcode).value
|
|
this.purchorderObj.lcationname2 = this.wareHouseLocationArr.find(i => i.value === this.purchorderObj
|
.stockname2).children.find(i => i.text === this.purchorderObj
|
.lcationcode).value
|
|
|
this.sheetShow = false
|
},
|
// 单选按钮点击事件
|
radioValueClick(val) {
|
this.radioValue = val
|
this.purchorderObj = this.purchorderArr.find(i => i.sbid === val)
|
},
|
// 删除事件点击
|
trashClick(val) {
|
this.purchorderArr.splice(val, 1)
|
this.purchorderObj = this.purchorderArr[0]
|
this.radioValue = this.purchorderObj.sbid
|
},
|
// 箭头由向下变为向上时触发
|
arrowDownClick(val) {
|
this.purchorderArr.forEach(i => {
|
i.arrowType = i.sbid !== val.sbid
|
})
|
this.$forceUpdate()
|
},
|
// 箭头由向上变为向下时触发
|
arrowUpClick(val) {
|
val.arrowType = true
|
this.$forceUpdate()
|
},
|
async submit() {
|
const data1 = {
|
username: uni.getStorageSync("username")
|
}
|
let data2 = []
|
|
let ind = this.purchorderArr.findIndex(i => i.lcationcode === '')
|
if (ind > -1) { //说明有未填写的库位信息
|
return this.$u.toast('第' + (ind + 1) + '个的库位信息未填写')
|
}
|
console.log(this.wareHouseLocationArr.flat())
|
|
this.purchorderArr.forEach(i => {
|
data2.push({
|
"hbarcode": "",
|
"hbillno": "",
|
"hqty": i.hqty,
|
"hcustomercode": i.customercode,
|
"hdeptcode": i.departmentcode,
|
"partcode": i.partcode,
|
"unitcode": i.unitcode,
|
"hsourceid": i.orderid,
|
"hsourcebillno": i.ordercode,
|
|
"stockcode": this.purchorderObj.stockname2,
|
"lcationcode": this.purchorderObj.lcationname2
|
})
|
})
|
|
// console.log(JSON.stringify(data2))
|
|
const res = await MesAppPurchInStorSave(this.global.formatData(
|
data1), data2)
|
|
if (res.code === '200') {
|
let prevPage = getCurrentPages()[getCurrentPages()
|
.length -
|
2]; // 上一页面实例
|
prevPage.$vm
|
.getMesAppPurchOrderSearch() // 调用上一页 定义的方法
|
uni.navigateBack({
|
delta: 1, //返回层数,2则上上页
|
})
|
} else {
|
this.$u.toast(res.message)
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import url('@/style/global.css');
|
|
::v-deep .uicon-arrow-left>span {
|
display: block;
|
}
|
|
|
|
.orderNumber {
|
width: 60rpx;
|
height: 40rpx;
|
// margin: -22rpx 0 0 -30rpx;
|
background-color: #d3daf9;
|
color: #2979FF;
|
font-size: 26rpx;
|
padding: 4rpx 0 0 10rpx;
|
border-radius: 0 0 90% 0;
|
}
|
|
.trash {
|
width: 48rpx;
|
height: 48rpx;
|
margin: -26rpx 0 0 646rpx;
|
background-color: #d3daf9;
|
font-size: 26rpx;
|
padding: 6rpx 0 0 10rpx;
|
border-radius: 100%;
|
}
|
|
.custominputClass {
|
width: 424rpx;
|
display: flex;
|
justify-content: space-between;
|
border: 3rpx #eff0f1 solid;
|
border-radius: 10rpx;
|
padding: 0 10rpx;
|
}
|
|
.arrowClass {
|
display: flex;
|
justify-content: center;
|
// background-color: #efefef;
|
width: 100rpx;
|
// border-radius: 10rpx;
|
height: 56rpx;
|
}
|
</style>
|