|
@@ -11,19 +11,23 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <text>发货单号:</text>
|
|
|
- <text style="color: crimson;">{{baseData[0].sendBillNo}}</text>
|
|
|
+ <view>
|
|
|
+ <text>发货单号:</text>
|
|
|
+ <text style="color: crimson;">{{baseData[0].sendBillNo}}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <text>条码:</text>
|
|
|
<view>
|
|
|
- <input
|
|
|
- @blur="addQty(true)"
|
|
|
- style="width: 100%;text-align: left;"
|
|
|
- class="uni-input"
|
|
|
- placeholder="扫描或输入条码"
|
|
|
- border="surround"
|
|
|
- v-model="code">
|
|
|
+ <text>条码:</text>
|
|
|
+ <view>
|
|
|
+ <input
|
|
|
+ @blur="addQty(true)"
|
|
|
+ style="width: 100%;text-align: left;"
|
|
|
+ class="uni-input"
|
|
|
+ placeholder="扫描或输入条码"
|
|
|
+ border="surround"
|
|
|
+ v-model="code">
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view style="justify-content: flex-start;flex-wrap: wrap;" v-for="(item,bindex) in baseData" :key="item.id">
|
|
@@ -39,16 +43,27 @@
|
|
|
<!-- 表头行 -->
|
|
|
<uni-tr>
|
|
|
<uni-td align="center">产品编码</uni-td>
|
|
|
- <uni-td align="center">产品分类</uni-td>
|
|
|
+ <uni-td align="center">仓库仓位</uni-td>
|
|
|
<uni-td align="center">入库/发货数量</uni-td>
|
|
|
<uni-td align="center">入库金额</uni-td>
|
|
|
</uni-tr>
|
|
|
<!-- 表格数据行 -->
|
|
|
- <uni-tr v-for="item in detailList" :key="item.id" :checkedRow="curProduct&&curProduct.dealerProductEntity.qrCode == item.dealerProductEntity.qrCode">
|
|
|
- <uni-td width="30%" align="center">{{item.dealerProductEntity.code}}</uni-td>
|
|
|
- <uni-td width="30%" align="center">{{item.dealerProductEntity.productTypeName3}}</uni-td>
|
|
|
- <uni-td width="25%" align="center"><text style="color: red;">{{item.realPutQty}}</text>/{{item.putQty}}</uni-td>
|
|
|
- <uni-td width="15%" align="center">
|
|
|
+ <uni-tr
|
|
|
+ v-for="item in detailList"
|
|
|
+ :key="item.id"
|
|
|
+ :checkedRow="curProduct&&curProduct.dealerProductEntity.qrCode == item.dealerProductEntity.qrCode"
|
|
|
+ >
|
|
|
+ <uni-td width="30%" align="center">
|
|
|
+ <view @click="copyText(item.dealerProductEntity.code)">{{item.dealerProductEntity.code}}</view>
|
|
|
+ </uni-td>
|
|
|
+ <uni-td width="30%" align="center">
|
|
|
+ <view @click="editRow(item)">
|
|
|
+ <view>{{item.warehouseEntity&&item.warehouseEntity.name||defWarehouseName[0]}}/</view>
|
|
|
+ <view>{{item.warehouseLocationEntity&&item.warehouseLocationEntity.name||defWarehouseName[1]}}</view>
|
|
|
+ </view>
|
|
|
+ </uni-td>
|
|
|
+ <uni-td width="20%" align="center"><text style="color: red;">{{item.realPutQty}}</text>/{{item.putQty}}</uni-td>
|
|
|
+ <uni-td width="20%" align="center">
|
|
|
{{item.realPutAmount}}
|
|
|
</uni-td>
|
|
|
</uni-tr>
|
|
@@ -59,28 +74,52 @@
|
|
|
<button size="mini" type="primary" @click="addQty(true)"> <text class="iconfont icon-add-btn"> 加 </text></button>
|
|
|
</view>
|
|
|
<scanCode @onKeyDown="keyDown"></scanCode>
|
|
|
- <u-picker
|
|
|
- :show="showPick"
|
|
|
- :closeOnClickOverlay="true"
|
|
|
- ref="uPicker"
|
|
|
- title="选择仓库仓位"
|
|
|
- :columns="pickItem"
|
|
|
- keyName="name"
|
|
|
- @close="showPick=false"
|
|
|
- @cancel="showPick=false"
|
|
|
- @change="changePick"></u-picker>
|
|
|
+ <!-- 选择仓库 -->
|
|
|
+ <chooseWarehouse ref="chooseWarehouse" :openPick="showPick" :value="defWarehouse" @close="showPick=false" @change="confirmWarehouse"></chooseWarehouse>
|
|
|
+ <!-- 左键扫描,修改包装数 -->
|
|
|
+ <uni-popup ref="popup" :mask-click="false" type="dialog">
|
|
|
+ <view style="background-color: #fff;padding: 30rpx 50rpx;border-radius: 30rpx;width: 75%;margin: 0 auto;">
|
|
|
+ <view v-if="curProduct">
|
|
|
+ <view style="padding: 30rpx 0;">
|
|
|
+ 产品编码:{{curProduct.dealerProductEntity.code}}
|
|
|
+ </view>
|
|
|
+ <view style="display: flex;align-items: center;">
|
|
|
+ 数量:
|
|
|
+ <u--input
|
|
|
+ placeholder="请输入数量"
|
|
|
+ border="surround"
|
|
|
+ v-model="curProduct.packQty"
|
|
|
+ :min="0"
|
|
|
+ type="digit"
|
|
|
+ ></u--input>
|
|
|
+ {{curProduct.dealerProductEntity.unit}}
|
|
|
+ {{curProduct.dealerProductEntity.packQtyUnit?("/"+curProduct.dealerProductEntity.packQtyUnit):''}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="display: flex;padding: 60rpx 15rpx 10rpx;justify-content: space-between;">
|
|
|
+ <button size="mini" @click="closePop">取消</button>
|
|
|
+ <button size="mini" type="primary" @click="okPop">确定</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
+
|
|
|
+ <u-modal :show="showModal" :title="msg.title" :confirmText="msg.confirmText" showCancelButton :content='msg.content' @cancel="showModal=false" @confirm="confirmModal"></u-modal>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import scanCode from '@/libs/scan-code.vue';
|
|
|
- import { purchaseWriteStockIn, receivingQuery, receivingDetail, purchaseUpdateWarehouse, updateRealPutQty } from '@/config/api.js'
|
|
|
+ import { purchaseWriteStockIn, receivingQuery, receivingDetail, purchaseUpdateWarehouse, updateRealPutQty, receivingStockInVerify } from '@/config/api.js'
|
|
|
import { playAudio, toThousands } from '@/libs/tools.js'
|
|
|
+ import clipboard from "@/js_sdk/dc-clipboard/clipboard.js"
|
|
|
+ import chooseWarehouse from './chooseWarehouse.vue'
|
|
|
export default {
|
|
|
- components: { scanCode },
|
|
|
+ components: { scanCode, chooseWarehouse },
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
+ showModal: false,
|
|
|
+ msg:{title:'提示',content:''},
|
|
|
showPick: false,
|
|
|
baseData: null,
|
|
|
detailList:[],
|
|
@@ -89,36 +128,40 @@
|
|
|
salesId: null,
|
|
|
curProduct: null,
|
|
|
toThousands,
|
|
|
- warehouseList: [],
|
|
|
- pickItem: [],
|
|
|
+ defWarehouse: [],
|
|
|
+ defWarehouseName:[],
|
|
|
keyName: ''
|
|
|
};
|
|
|
},
|
|
|
onLoad(opts) {
|
|
|
var _this = this
|
|
|
- this.warehouseList = this.$store.state.vuex_warehouseList
|
|
|
this.receivingBillSn = opts.receivingBillSn
|
|
|
this.salesId = opts.id
|
|
|
+ // 默认仓库仓位
|
|
|
+ this.defWarehouse = this.$store.state.vuex_tempData
|
|
|
|
|
|
- // 仓库列表
|
|
|
- this.getWarehousePick()
|
|
|
-
|
|
|
+ // 调用数据
|
|
|
this.getDetail()
|
|
|
this.getDetailList()
|
|
|
|
|
|
uni.$on('scancodedate', function(content) {
|
|
|
- console.log("扫描到的内容为:", content, this.keyName)
|
|
|
- if(this.keyName == 'rightKey'){
|
|
|
- _this.code = content||''
|
|
|
+ console.log("扫描到的内容为:", content, _this.keyName)
|
|
|
+ _this.code = content||''
|
|
|
+ if(_this.keyName == 'rightKey'){
|
|
|
_this.addQty(true)
|
|
|
}
|
|
|
- if(this.keyName == 'leftKey'){
|
|
|
-
|
|
|
+ if(_this.keyName == 'leftKey'){
|
|
|
+ _this.openPack()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
onShow() {
|
|
|
this.hideKeyborder()
|
|
|
+ const list = this.$store.state.vuex_warehouseList
|
|
|
+ const an =list.find(item => item.warehouseSn==this.defWarehouse[0])
|
|
|
+ const cn = an&&an.warehouseLocationList&&an.warehouseLocationList.find(item => item.warehouseLocationSn == this.defWarehouse[1])
|
|
|
+ this.defWarehouseName = [an&&an.name,cn&&cn.name]
|
|
|
+ console.log(this.defWarehouseName)
|
|
|
},
|
|
|
onUnload() {
|
|
|
uni.$off('scancodedate')
|
|
@@ -127,48 +170,48 @@
|
|
|
hideKeyborder(){
|
|
|
uni.hideKeyboard()
|
|
|
},
|
|
|
+ // 复制
|
|
|
+ copyText(text){
|
|
|
+ clipboard.setText(text);
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '编码已复制成功'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ closePop(){
|
|
|
+ this.$refs.popup.close()
|
|
|
+ },
|
|
|
+ okPop(){
|
|
|
+ if(this.curProduct.packQty){
|
|
|
+ this.changePutQty(this.curProduct,Number(this.curProduct.realPutQty) + Number(this.curProduct.packQty))
|
|
|
+ this.closePop()
|
|
|
+ }else{
|
|
|
+ uni.$u.toast("请输入数量!")
|
|
|
+ }
|
|
|
+ },
|
|
|
keyDown(e){
|
|
|
this.keyName = e
|
|
|
},
|
|
|
- getWarehousePick(){
|
|
|
- const col1 = []
|
|
|
- const col2 = []
|
|
|
- this.warehouseList.map((item,index) => {
|
|
|
- col1.push(item)
|
|
|
- if(index == 0 && item.warehouseLocationList){
|
|
|
- item.warehouseLocationList.map(k => {
|
|
|
- col2.push(k)
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- this.pickItem = [col1,col2]
|
|
|
- // this.showPick = true
|
|
|
+ // 确定选择仓库
|
|
|
+ confirmWarehouse(data){
|
|
|
+ console.log(data)
|
|
|
+ this.updateWarehouse({id:this.curProduct.id,warehouseSn:data[0],warehouseLocationSn:data[1]})
|
|
|
},
|
|
|
- // 选择仓库
|
|
|
- changePick(e){
|
|
|
- const {
|
|
|
- columnIndex,
|
|
|
- index,
|
|
|
- // 微信小程序无法将picker实例传出来,只能通过ref操作
|
|
|
- picker = this.$refs.uPicker
|
|
|
- } = e
|
|
|
- console.log(columnIndex,index)
|
|
|
- if (columnIndex === 0) {
|
|
|
- const currow = this.pickItem[0][index]
|
|
|
- const col2 = []
|
|
|
- currow&&currow.warehouseLocationList.map(item => {
|
|
|
- col2.push(item)
|
|
|
- })
|
|
|
- picker.setColumnValues(1, col2)
|
|
|
- }
|
|
|
+ // 修改仓库
|
|
|
+ editRow(item){
|
|
|
+ this.showPick = true
|
|
|
+ this.curProduct = item
|
|
|
},
|
|
|
+ // 获取当前操作行
|
|
|
getCurRow(){
|
|
|
const curProduct = this.detailList.find(item => item.dealerProductEntity.qrCode == this.code)
|
|
|
this.curProduct = curProduct || null
|
|
|
+ this.curProduct.packQty = this.curProduct.dealerProductEntity.packQty || 0
|
|
|
return curProduct
|
|
|
},
|
|
|
// 修改仓库
|
|
|
updateWarehouse (row) {
|
|
|
+ console.log(row)
|
|
|
this.loading = true
|
|
|
purchaseUpdateWarehouse({
|
|
|
id: row.id,
|
|
@@ -176,6 +219,7 @@
|
|
|
warehouseLocationSn: row.warehouseLocationSn
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
+ this.showPick = false
|
|
|
this.getDetailList()
|
|
|
}
|
|
|
this.loading = false
|
|
@@ -205,7 +249,11 @@
|
|
|
}
|
|
|
const row = this.getCurRow()
|
|
|
if(row){
|
|
|
- this.changePutQty(row,row.realPutQty + (flag?1:-1))
|
|
|
+ if(row.warehouseLocationSn){
|
|
|
+ this.changePutQty(row,row.realPutQty + (flag?1:-1))
|
|
|
+ }else{
|
|
|
+ uni.$u.toast("此商品没有仓库仓位")
|
|
|
+ }
|
|
|
}else{
|
|
|
uni.$u.toast("此商品不存在")
|
|
|
}
|
|
@@ -229,13 +277,40 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 打开包装数弹框
|
|
|
+ openPack(){
|
|
|
+ const curProduct = this.getCurRow()
|
|
|
+ if(curProduct){
|
|
|
+ this.$refs.popup.open()
|
|
|
+ }else{
|
|
|
+ uni.$u.toast("此商品不存在")
|
|
|
+ }
|
|
|
+ },
|
|
|
// 入库
|
|
|
async toOut(){
|
|
|
- const ret = await salesWriteStockOut({receivingBillSn: this.receivingBillSn})
|
|
|
+ const isOk = await receivingStockInVerify({receivingBillSn:this.receivingBillSn})
|
|
|
+ if(!isOk.data){
|
|
|
+ this.submitForm()
|
|
|
+ }else{
|
|
|
+ this.showModal = true
|
|
|
+ this.msg = {
|
|
|
+ title: '提示',
|
|
|
+ content: '有产品入库数量与发货数量不一致',
|
|
|
+ confirmText: '确定入库'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ confirmModal(e){
|
|
|
+ this.submitForm()
|
|
|
+ },
|
|
|
+ async submitForm(){
|
|
|
+ const a = this.defWarehouse
|
|
|
+ const ret = await purchaseWriteStockIn({id: this.baseData[0].id,warehouseSn:a[0], warehouseLocationSn:a[1]})
|
|
|
if(ret.status == 200){
|
|
|
this.$store.state.vuex_isRefash = true
|
|
|
uni.navigateBack()
|
|
|
}
|
|
|
+ this.showModal = false
|
|
|
}
|
|
|
},
|
|
|
}
|