123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <template>
- <view class="inOut">
- <view class="">
- <view class="form-box" style="margin:0 30rpx">
- <uni-forms ref="baseForm" :modelValue="formData" label-position="top">
- <uni-forms-item label="出库时间">
- {{date}}
- </uni-forms-item>
-
- <uni-forms-item label="调出仓库" required>
- {{dtlData.stockHouseName || '根据扫描的第一个物料自动填充'}}
- </uni-forms-item>
-
- </uni-forms>
- </view>
-
- <view class="commons-title" style="margin: 0 30rpx;">
- 调仓明细
- </view>
- <view class="addQrcode-list" v-for="(i,index) in qrCodeList" :key="i,index">
- <view class="fl" @click="toRouter(index)">
- <view class="code">
- <view class="">
- 二维码编号:{{i.qrCode}}
- </view>
- <view class="" style="margin-top: 20rpx;">
- 绑定数量:{{i.quantity}}
- </view>
- </view>
- </view>
- <view class="fr">
- <uni-icons type="trash-filled" color="red" size="30" @click="delelte(index)"></uni-icons>
- </view>
- </view>
- <button size="mini" type="default" style="width: 500rpx;margin: 30rpx auto;display: block;"
- @click="scanCode(true)">
- + 扫码添加
- </button>
- </view>
- <view class="submit-box" v-if="dtlData">
- <view class="" style="line-height: 80rpx;text-align: center;">
- 合计:{{quantitytol}} | {{qrCodeList.length}}件
- </view>
- <picker @change="bindPickerChange" :range="stockHouseData" range-key="name">
- <button style="background: #0066CC;color:#fff;margin-bottom: 30rpx;">提交</button>
- </picker>
-
- </view>
- </view>
- </template>
- <script>
- import {
- getInfo
- } from "@/util/api.js";
- import Vue from 'vue'
- import {dateFormat,getTime} from '../../util/uitl.js'
- export default {
- data() {
- return {
- stockChangeData: [{
- text: '出库',
- value: 20
- },{
- text: '补出库',
- value: 23
- },{
- text: '绑定错误',
- value: 24
- },{
- text: '退货出库',
- value: 26
- },{
- text: '报废出库',
- value: 27
- }],
- listData: [],
- formData: {
- stockHouseId:null,
- stockHouseName:null,
- qrCodeList:[],
- },
- req: {
- qrCodeList: [],
- stockHouseId: null,
- },
- btnType: 1,
- isScanCode: false,
- userData: {},
- dtlData: null,
- qrCodeList: [],
- index: 0,
- stockHouseData:[],
- date:null,
- userList:[],
- quantitytol:0,
- }
- },
- onLoad(option) {
- const v = this
- v.userData = Vue.prototype.$userInfo
- v.$post('/wx/common/getStockHouse', {}).then(res => {
- v.stockHouseData = res.data
- })
- v.date = getTime().substr(0,11)
- v.$post('/wx/common/getUser',{}).then(res=>{
- v.userList = res.data
- })
- },
- methods: {
- addOutInfo(){
- const v = this
- if(v.qrCodeList.length == 0){
- uni.showToast({
- icon: "error",
- title: '请添加物料信息',
- duration: 2000
- });
- return
- }
- v.req.qrCodeList = []
- for (var i = 0; i < v.qrCodeList.length; i++) {
- v.formData.qrCodeList.push(v.qrCodeList[i].qrCode)
- }
- console.log(v.formData)
- v.$post('/wx/codeScanInOut/transfer',v.formData).then(res=>{
- if(res.code == 200){
- uni.showToast({
- title:'调仓成功,跳转中!'
- })
- setTimeout(()=>{
- wx.reLaunch({
- url: '/pages/home'
- })
- },2000)
- }
- })
- },
- delelte(index) {
- const v = this
- uni.showModal({
- title: "提示",
- content: "你确定删除此信息么?",
- success(res) {
- if (res.confirm) {
- v.quantitytol = v.quantitytol - v.qrCodeList[index].quantity
- v.qrCodeList.splice(index, 1)
- }
- }
- })
- },
- bindPickerChange(e) {
- const v = this
- v.formData.stockHouseId = v.stockHouseData[e.detail.value].id
- v.addOutInfo()
- },
- scanCode(_isReload) {
- const v = this
- uni.scanCode({
- onlyFromCamera: true,
- success: function(res) {
- uni.showToast({
- icon: "loading",
- title: '加载中',
- duration: 1500
- });
- v.$post('/wx/common/gerMaterialInfoByQrcode', {
- qrCode: res.result
- }).then(res => {
- if(!res.data.stockHouseId){
- uni.showToast({
- icon: "error",
- title: '此物料不在库存内!',
- duration: 2000
- });
- return
- }else{
- if (v.dtlData) {
-
- if (v.dtlData.stockHouseId != res.data.stockHouseId) {
- uni.showToast({
- icon: "error",
- title: '仓库不一致',
- duration: 2000
- });
- return
- }
- }else{
- v.dtlData = res.data
- for (var i = 0; i < v.stockHouseData.length; i++) {
- if(v.stockHouseData[i].id == v.dtlData.stockHouseId){
- console.log('找到')
- v.stockHouseData.splice(i,1)
- }
- }
- }
- v.qrCodeList.push(res.data)
- v.quantitytol = v.quantitytol + res.data.quantity
-
-
- }
- if (_isReload) {
- v.scanCode(_isReload)
- }
- })
- }
- });
- },
- },
- }
- </script>
- <style lang="less">
- .inOut{
- .submit-box {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- padding: 0 30rpx;
- }
-
- .dtl {
- padding: 30rpx;
- border-bottom: 1rpx solid #dcdcdc;
- font-size: 26rpx;
- line-height: 40rpx;
- }
-
- .addQrcode-list {
- height: 80rpx;
- display: flex;
- justify-content: space-between;
- padding: 15rpx;
- border-bottom: 1rpx solid #dcdcdc;
- font-size: 24rpx;
-
- .fl {
- display: flex;
-
- .code {
- margin-right: 20rpx;
- }
- }
-
- .fr {
- line-height: 80rpx;
- }
- }
- }
- .popup-input-warp {
- padding: 30rpx 40rpx;
- }
-
- </style>
|