|
@@ -29,6 +29,7 @@
|
|
|
<view class="product" @click="toEdit(item)">
|
|
|
<view class="flex align_center flex_1">
|
|
|
<view class="pimgs">
|
|
|
+ <text v-if="hasChecked(item)">已选</text>
|
|
|
<u-image :src="item.productEntity&&item.productEntity.images?item.productEntity.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
|
|
|
</view>
|
|
|
<view class="pinfo">
|
|
@@ -66,16 +67,18 @@
|
|
|
</view>
|
|
|
<!-- 底部栏 -->
|
|
|
<view class="footer-bar flex align_center">
|
|
|
- <view class="f-left" :style="{background:orderTotal?$config('primaryColor'):''}">
|
|
|
+ <view class="f-left" :style="{background:orderTotal?$config('primaryColor'):''}" @click="openCart">
|
|
|
<u-icon name="order" size="45"></u-icon>
|
|
|
<u-badge type="error" size="mini" :offset="[-10,-10]" :count="orderTotal"></u-badge>
|
|
|
</view>
|
|
|
<view class="f-mid">
|
|
|
- 盘盈总数:<text>3</text>
|
|
|
- 盘亏总数:<text>3</text>
|
|
|
+ <view v-if="detail">
|
|
|
+ 盘盈总数:<text>{{detail.totalProfitQty}}</text>
|
|
|
+ 盘亏总数:<text>{{detail.totalLossQty}}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="f-btns">
|
|
|
- <u-button size="medium" :custom-style="customBtnStyle" shape="circle" type="primary" hover-class="none" >提交盘点单</u-button>
|
|
|
+ <u-button size="medium" @click="submitOrder" :custom-style="customBtnStyle" shape="circle" type="primary" hover-class="none" >提交盘点单</u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 已选配件 购物车 -->
|
|
@@ -87,58 +90,76 @@
|
|
|
<div class="cpb_cart-tit">
|
|
|
<view>已选配件</view>
|
|
|
<view class="cpb_heji flex align_center justify_between">
|
|
|
- <text>清空列表</text>
|
|
|
- <view>
|
|
|
+ <text @click="clearDetail">清空列表</text>
|
|
|
+ <view v-if="detail">
|
|
|
盈亏总数量:
|
|
|
<text>
|
|
|
- -2334
|
|
|
+ {{detail.totalProfitLossQty}}
|
|
|
</text>
|
|
|
盈亏总金额:
|
|
|
<text>
|
|
|
- ¥-254
|
|
|
+ ¥{{detail.totalProfitLossCost}}
|
|
|
</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</div>
|
|
|
<div class="cpb_cart-list">
|
|
|
- <view class="nav-right-item flex" v-for="(item, index) in chooseList" :key="item.id">
|
|
|
+ <u-swipe-action
|
|
|
+ :show="item.show"
|
|
|
+ :btn-width="120"
|
|
|
+ :index="index"
|
|
|
+ @click="delDetail"
|
|
|
+ v-for="(item, index) in chooseList"
|
|
|
+ :key="item.id"
|
|
|
+ :options="options"
|
|
|
+ >
|
|
|
+ <view class="nav-right-item flex">
|
|
|
<view class="uni-col-2">
|
|
|
- <u-image :src="item.productEntity&&item.productEntity.images?item.productEntity.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="100" height="100" border-radius="30"></u-image>
|
|
|
+ <u-image :src="item.product&&item.product.images?item.product.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="100" height="100" border-radius="30"></u-image>
|
|
|
</view>
|
|
|
<view class="item-info uni-col-10">
|
|
|
<view class="item-name">
|
|
|
- <text>{{item.productEntity&&item.productEntity.code}}</text>
|
|
|
- {{item.productEntity&&item.productEntity.productName}}
|
|
|
+ <text>{{item.productCode}}</text>
|
|
|
+ {{item.product.productName}}
|
|
|
</view>
|
|
|
<view class="item-detail">
|
|
|
<view class="item-detail-info">
|
|
|
<view class="flex justify_end">
|
|
|
<text class="item-detail-text">
|
|
|
- 可用:{{item.qty?item.qty:0}} {{item.productEntity&&item.productEntity.unit}}
|
|
|
+ 可用:{{item.stockQty?item.stockQty:0}} {{item.product&&item.product.unit}}
|
|
|
</text>
|
|
|
<text class="item-detail-text">
|
|
|
- 冻结:{{item.freezeQty?item.freezeQty:0}} {{item.productEntity&&item.productEntity.unit}}
|
|
|
+ 冻结:{{item.freezeQty?item.freezeQty:0}} {{item.product&&item.product.unit}}
|
|
|
</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item-detail">
|
|
|
<view class="item-detail-info">
|
|
|
- <view class="flex justify_end">
|
|
|
+ <view class="flex justify_between">
|
|
|
+ <view></view>
|
|
|
<view class="item-detail-text">
|
|
|
实际可用:
|
|
|
- <u-number-box v-model="item.qty" :index="'cart_'+item.id" :min="0" :max="item.qty||999999"></u-number-box>
|
|
|
+ <u-number-box
|
|
|
+ v-model="item.checkQty"
|
|
|
+ @minus="cartChangeNums"
|
|
|
+ @plus="cartChangeNums"
|
|
|
+ @blur="cartChangeNums"
|
|
|
+ :index="'cart_'+item.id"
|
|
|
+ :min="0"
|
|
|
+ :max="item.stockQty||999999"></u-number-box>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ </u-swipe-action>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 编辑弹框 -->
|
|
|
- <editModal :openModal="editModal" :infoData="tempData" @close="editModal=false"></editModal>
|
|
|
+ <editModal v-if="editModal" :openModal="editModal" :infoData="tempData" @close="editModal=false" @addProduct="addProduct"></editModal>
|
|
|
<!-- 筛选项 -->
|
|
|
<u-popup v-model="showTab" mode="right" width="70%">
|
|
|
<view class="tabBox flex flex_column">
|
|
@@ -162,8 +183,16 @@
|
|
|
|
|
|
<script>
|
|
|
import { getShelfProductList,getProductPlace } from '@/api/shelf'
|
|
|
- import { stockCheckDetailQueryList, stockCheckDetailDelete, stockCheckSave, stockCheckBySn } from '@/api/stockCheck'
|
|
|
+ import {
|
|
|
+ stockCheckDetailQueryList,
|
|
|
+ stockCheckDetailDelete,
|
|
|
+ stockCheckSave,
|
|
|
+ stockCheckBySn,
|
|
|
+ stockCheckDetailSave,
|
|
|
+ deleteByStockCheckSn
|
|
|
+ } from '@/api/stockCheck'
|
|
|
import editModal from './editModal'
|
|
|
+ import { clzConfirm } from '@/libs/tools'
|
|
|
export default {
|
|
|
components: {
|
|
|
editModal
|
|
@@ -172,6 +201,7 @@
|
|
|
return {
|
|
|
queryWord: '',
|
|
|
nowData:null,
|
|
|
+ stockCheckSn: null,
|
|
|
detail:null,
|
|
|
pageNo:1,
|
|
|
pageSize: 10,
|
|
@@ -192,62 +222,132 @@
|
|
|
showCart: false,
|
|
|
chooseList: [],
|
|
|
editModal: false,
|
|
|
- tempData: null
|
|
|
+ tempData: null,
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ text: '删除',
|
|
|
+ style: {
|
|
|
+ backgroundColor: '#dd524d'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onNavigationBarButtonTap(e) {
|
|
|
+ if(e.index == 1){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/stockCheck/checkRecord'
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
onLoad(opts) {
|
|
|
this.nowData = JSON.parse(decodeURIComponent(opts.data));
|
|
|
+ this.stockCheckSn = this.nowData.stockCheckSn
|
|
|
this.getpartList()
|
|
|
this.getShelfPlace()
|
|
|
|
|
|
- if(this.nowData.stockCheckSn){
|
|
|
+ if(this.stockCheckSn){
|
|
|
// 获取盘点单明细
|
|
|
this.getDetail()
|
|
|
// 获取盘点明细列表
|
|
|
this.getChooseList()
|
|
|
}
|
|
|
+
|
|
|
+ // 重置盘点单
|
|
|
+ uni.$on("resetStockCheck",()=>{
|
|
|
+ this.resetStockCheck()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onUnload() {
|
|
|
+ uni.$off("resetStockCheck")
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 重置盘点单
|
|
|
+ resetStockCheck(){
|
|
|
+ this.chooseList = []
|
|
|
+ this.orderTotal = 0
|
|
|
+ this.stockCheckSn = null
|
|
|
+ this.detail = null
|
|
|
+ this.tempData = null
|
|
|
+ this.queryWord = ''
|
|
|
+ this.showCart = false
|
|
|
+ this.handleClear()
|
|
|
+ },
|
|
|
// 获取盘点明细列表
|
|
|
getChooseList(){
|
|
|
stockCheckDetailQueryList({
|
|
|
- stockCheckSn: this.nowData.stockCheckSn
|
|
|
+ stockCheckSn: this.stockCheckSn
|
|
|
}).then(res => {
|
|
|
this.chooseList = res.data || []
|
|
|
+ this.orderTotal = this.chooseList.length
|
|
|
})
|
|
|
},
|
|
|
// 详细
|
|
|
getDetail(){
|
|
|
- stockCheckBySn({stockCheckSn: this.nowData.stockCheckSn}).then(res => {
|
|
|
+ stockCheckBySn({stockCheckSn: this.stockCheckSn}).then(res => {
|
|
|
this.detail = res.data || null
|
|
|
})
|
|
|
},
|
|
|
//添加产品
|
|
|
toEdit(item){
|
|
|
- item.checkQty = item.qty
|
|
|
- this.tempData = item
|
|
|
+ const data = this.hasChecked(item)
|
|
|
+ console.log(data)
|
|
|
+ // 修改
|
|
|
+ if(data){
|
|
|
+ data.productEntity = data.product
|
|
|
+ data.qty = data.stockQty
|
|
|
+ this.tempData = data
|
|
|
+ }else{
|
|
|
+ // 添加
|
|
|
+ item.checkQty = item.qty
|
|
|
+ this.tempData = item
|
|
|
+ }
|
|
|
this.editModal = true
|
|
|
},
|
|
|
// 添加产品明细
|
|
|
addProduct(data){
|
|
|
+ const _this = this
|
|
|
+ this.editModal = false
|
|
|
// 是否第一次添加产品
|
|
|
- if(this.chooseList.length==0){
|
|
|
- // 先创建盘点单
|
|
|
- stockCheckSave({
|
|
|
- shelfSn: this.nowData.shelfSn,
|
|
|
- totalCategory: this.nowData.totalCategory,
|
|
|
- totalStockQty: this.nowData.totalStockQty,
|
|
|
- totalFreezeQty: this.nowData.totalFreezeQty
|
|
|
- }).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- this.detail = res.data || null
|
|
|
- this.saveProduct(data)
|
|
|
- }
|
|
|
+ if(this.orderTotal==0){
|
|
|
+ clzConfirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '开始盘点后,不能再使用与出入库有关的功能,确认开始盘点吗?',
|
|
|
+ success (ret) {
|
|
|
+ if (ret.confirm || ret.index == 0) {
|
|
|
+ // 先创建盘点单
|
|
|
+ _this.creatOrder(data)
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
}else{
|
|
|
+ uni.showLoading({
|
|
|
+ title:"正在保存.."
|
|
|
+ })
|
|
|
this.saveProduct(data)
|
|
|
}
|
|
|
},
|
|
|
+ // 创建盘点单
|
|
|
+ creatOrder(data){
|
|
|
+ uni.showLoading({
|
|
|
+ title:"正在保存.."
|
|
|
+ })
|
|
|
+ stockCheckSave({
|
|
|
+ shelfSn: this.nowData.shelfSn,
|
|
|
+ totalCategory: this.nowData.totalCategory,
|
|
|
+ totalStockQty: this.nowData.totalStockQty,
|
|
|
+ totalFreezeQty: this.nowData.totalFreezeQty
|
|
|
+ }).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.detail = res.data || null
|
|
|
+ this.stockCheckSn = res.data.stockCheckSn
|
|
|
+ this.saveProduct(data)
|
|
|
+ }else{
|
|
|
+ uni.hideLoading()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 添加产品
|
|
|
saveProduct(data){
|
|
|
stockCheckDetailSave({
|
|
|
stockCheckSn: this.detail.stockCheckSn,
|
|
@@ -255,9 +355,76 @@
|
|
|
...data
|
|
|
}).then(res => {
|
|
|
if(res.status == 200){
|
|
|
+ this.getDetail()
|
|
|
+ this.getChooseList()
|
|
|
}
|
|
|
+ uni.hideLoading()
|
|
|
})
|
|
|
},
|
|
|
+ // 打开购物车
|
|
|
+ openCart(){
|
|
|
+ if(this.orderTotal){
|
|
|
+ this.showCart = !this.showCart
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请先添加产品'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 清空购物车
|
|
|
+ clearDetail(){
|
|
|
+ const _this = this
|
|
|
+ clzConfirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认将所有产品移出盘点单吗?',
|
|
|
+ success (ret) {
|
|
|
+ if (ret.confirm || ret.index == 0) {
|
|
|
+ uni.showLoading({
|
|
|
+ title:"正在删除.."
|
|
|
+ })
|
|
|
+ deleteByStockCheckSn({ stockCheckSn: _this.stockCheckSn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.showCart = false
|
|
|
+ _this.getDetail()
|
|
|
+ _this.getChooseList()
|
|
|
+ }
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 修改数量
|
|
|
+ cartChangeNums(v){
|
|
|
+ console.log(v,this.showCart)
|
|
|
+ const data = this.chooseList.find(item => item.id == v.index.split('_')[1])
|
|
|
+ uni.showLoading({
|
|
|
+ title:"正在保存.."
|
|
|
+ })
|
|
|
+ this.saveProduct(data)
|
|
|
+ },
|
|
|
+ // 删除盘点详细
|
|
|
+ delDetail(a,b){
|
|
|
+ if(b==0){
|
|
|
+ const data = this.chooseList[a]
|
|
|
+ stockCheckDetailDelete({stockCheckDetailSn: data.stockCheckDetailSn}).then(res=>{
|
|
|
+ if(res.status == 200){
|
|
|
+ this.chooseList.splice(a,1)
|
|
|
+ // 删除最后一个后刷新列表
|
|
|
+ if(this.chooseList.length == 0){
|
|
|
+ this.showCart = false
|
|
|
+ this.getDetail()
|
|
|
+ this.getChooseList()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 是否已选
|
|
|
+ hasChecked(data){
|
|
|
+ return this.chooseList.find(item => item.shelfPlaceCode == data.shelfPlaceCode && item.productSn == data.productSn)
|
|
|
+ },
|
|
|
// 获取货位号
|
|
|
getShelfPlace(flag){
|
|
|
getProductPlace({ shelfSn: this.nowData.shelfSn }).then(res => {
|
|
@@ -344,6 +511,19 @@
|
|
|
this.status = "nomore"
|
|
|
}
|
|
|
},
|
|
|
+ // 提交盘点单
|
|
|
+ submitOrder(){
|
|
|
+ if(this.chooseList.length){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/stockCheck/submitStockCheck?stockCheckSn='+this.stockCheckSn+'&type=submit'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请先添加产品'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
// 扫描
|
|
|
toScan(){
|
|
|
this.mpaasScanModule = uni.requireNativePlugin("wss-scan")
|
|
@@ -359,7 +539,6 @@
|
|
|
}
|
|
|
},
|
|
|
(result) => {
|
|
|
- console.log(result)
|
|
|
if(result.scanStatus == 1){
|
|
|
this.scanResult(result)
|
|
|
}
|
|
@@ -379,7 +558,6 @@
|
|
|
}else{
|
|
|
params.qrCode = data.scanValue
|
|
|
}
|
|
|
-
|
|
|
getShelfProductList(params).then(res => {
|
|
|
console.log(res)
|
|
|
if(res.status == 200){
|
|
@@ -467,6 +645,23 @@
|
|
|
opacity: 0.6;
|
|
|
background-color: #f8f8f8;
|
|
|
}
|
|
|
+ .pimgs{
|
|
|
+ position: relative;
|
|
|
+ border:2rpx solid #eee;
|
|
|
+ border-radius: 15rpx;
|
|
|
+ padding: 5rpx;
|
|
|
+ > text{
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ bottom:0;
|
|
|
+ z-index: 500;
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ background: rgba(255, 0, 0, 0.3);
|
|
|
+ color: #fff;
|
|
|
+ font-size: 20upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
.item-detail{
|
|
|
margin-top: 10rpx;
|
|
|
display: flex;
|
|
@@ -587,7 +782,7 @@
|
|
|
position: fixed;
|
|
|
width: 100%;
|
|
|
background: rgba(0,0,0,0.5);
|
|
|
- z-index: 10000;
|
|
|
+ z-index: 900;
|
|
|
bottom: 100rpx;
|
|
|
top: 0;
|
|
|
}
|
|
@@ -633,12 +828,15 @@
|
|
|
}
|
|
|
}
|
|
|
.cpb_cart-list{
|
|
|
- padding: 20rpx 30rpx;
|
|
|
+ padding: 20rpx 0;
|
|
|
overflow: auto;
|
|
|
flex-grow: 1;
|
|
|
> view{
|
|
|
margin-bottom: 20rpx;
|
|
|
}
|
|
|
+ .nav-right-item{
|
|
|
+ padding: 0 30upx;
|
|
|
+ }
|
|
|
.item-name{
|
|
|
font-size: 30rpx;
|
|
|
text{
|
|
@@ -664,6 +862,7 @@
|
|
|
align-items: center;
|
|
|
.item-detail-text{
|
|
|
color: #999;
|
|
|
+ margin-left: 20upx;
|
|
|
}
|
|
|
}
|
|
|
}
|