|
@@ -0,0 +1,377 @@
|
|
|
+<template>
|
|
|
+ <view class="content flex flex_column">
|
|
|
+ <view class="product-list flex">
|
|
|
+ <view class="leftTabs">
|
|
|
+ <view v-for="item in placeTab" :key="item" :class="curTab==item?'active':''" @click="curTab = item">{{item}}层</view>
|
|
|
+ </view>
|
|
|
+ <view class="rightCons">
|
|
|
+ <view class="partList-list-box" v-for="item in shelfPlaceList[curTab]" :key="item.shelfCartSn">
|
|
|
+ <view class="flex align_center flex_1">
|
|
|
+ <view class="pimgs">
|
|
|
+ <u-image :src="item.product&&item.product.images?item.product.images:`../../static/${$config('themePath')}/def_img@2x.png`" width="120" height="120" border-radius="10"></u-image>
|
|
|
+ </view>
|
|
|
+ <view class="pinfo">
|
|
|
+ <view class="pname">
|
|
|
+ <text>{{item.shelfPlaceCode}}</text>
|
|
|
+ {{item.product.productName}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="ptools flex align_center justify_between">
|
|
|
+ <view></view>
|
|
|
+ <view>{{item.productCode}}</view>
|
|
|
+ <view class="pcurnums flex align_center">
|
|
|
+ <view class="u-ninput">
|
|
|
+ <u-number-box :index="item.id" @blur="updateNums" @minus="updateNums" @plus="updateNums" color="#000" bg-color="#fff" v-model="item.qty" :min="0"></u-number-box>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="footer-bar flex align_center justify_between">
|
|
|
+ <view class="heji flex align_center" @click="showPop=!showPop">
|
|
|
+ 所有层合计款数:<text>{{totalKs}}</text>;数量:<text>{{totalNums}}</text>;
|
|
|
+ <u-icon name="arrow-up"></u-icon>
|
|
|
+ </view>
|
|
|
+ <view class="btns">
|
|
|
+ <u-button @click="showLayer=true" type='primary' shape="circle" size="medium">继续录入产品</u-button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- 合计弹框 -->
|
|
|
+ <u-popup mode="bottom" :mask="false" closeable v-model="showPop" :custom-style="{bottom:'100rpx'}">
|
|
|
+ <view class="heji-content">
|
|
|
+ <scroll-view scroll-y="true" style="height: 400rpx;">
|
|
|
+ <view class="heji-con-list">
|
|
|
+ <view class="flex align_center" v-for="item in countData" :key="item.shelfTierCode">
|
|
|
+ <view>{{item.shelfTierCode}}层</view>
|
|
|
+ <view class="flex align_center">
|
|
|
+ <text>款数:{{item.category}}</text>
|
|
|
+ <text>数量:{{item.qty}}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
+
|
|
|
+ <!-- 选中层 -->
|
|
|
+ <u-popup mode="center" width="80%" closeable v-model="showLayer" border-radius="15">
|
|
|
+ <view class="layer-content">
|
|
|
+ <view class="tits">请选择产品的货架层号</view>
|
|
|
+ <view class="tagbox flex">
|
|
|
+ <view>
|
|
|
+ <view class="tag" :class="curLayer==item?'active':''" v-for="item in layerList" :key="item" @click="curLayer=curLayer==item?'':item">
|
|
|
+ {{item}}层
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="newbtn flex justify_between" v-if="curLayer">
|
|
|
+ <u-button shape="circle" @click="searchProduct()" size="medium">按产品编码搜索</u-button>
|
|
|
+ <u-button @click="scanProduct()" type='primary' shape="circle" size="medium">扫描条形码匹配</u-button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import { clzConfirm, numberToFixed } from '@/libs/tools';
|
|
|
+ import {queryMapList, queryCountList, shelfCartSave, shelfCartDelete} from '@/api/shelfCart.js'
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ showPop: false,
|
|
|
+ shelfSn: '',
|
|
|
+ shelfPlaceList: [],
|
|
|
+ placeTab: [],
|
|
|
+ curTab: '',
|
|
|
+ totalKs: 0,
|
|
|
+ totalNums: 0,
|
|
|
+ countData: [],
|
|
|
+ layerList: [],
|
|
|
+ showLayer: false,
|
|
|
+ curLayer: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(opts) {
|
|
|
+ this.layerList = 'A、B、C、D、E、F、G、H、I、J、K、L、M、N、O、P、Q、R、S、T、U、V、W、X、Y、Z'.split('、');
|
|
|
+ this.shelfSn = opts.shelfSn || '438473399995965440'
|
|
|
+ this.pageInit()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ pageInit(){
|
|
|
+ this.placeTab = []
|
|
|
+ this.shelfPlaceList = []
|
|
|
+ this.countData = []
|
|
|
+ this.getList()
|
|
|
+ this.getCount()
|
|
|
+ },
|
|
|
+ scanProduct(){
|
|
|
+ uni.redirectTo({
|
|
|
+ url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName
|
|
|
+ })
|
|
|
+ },
|
|
|
+ searchProduct(){
|
|
|
+ uni.redirectTo({
|
|
|
+ url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取产品列表
|
|
|
+ getList(flag){
|
|
|
+ queryMapList({ shelfSn: this.shelfSn }).then(res => {
|
|
|
+ console.log(res.data)
|
|
|
+ if (res.status == 200 && res.data) {
|
|
|
+ this.shelfPlaceList = res.data
|
|
|
+ for(let a in res.data){
|
|
|
+ this.placeTab.push(a)
|
|
|
+ }
|
|
|
+ if(!flag || this.placeTab.length==1){
|
|
|
+ this.curTab = this.placeTab[0]
|
|
|
+ }
|
|
|
+ if(this.placeTab.length == 0){
|
|
|
+ this.shelfPlaceList = null
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.shelfPlaceList = null
|
|
|
+ this.placeTab = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取统计数据
|
|
|
+ getCount(){
|
|
|
+ this.totalKs = 0
|
|
|
+ this.totalNums = 0
|
|
|
+ queryCountList({shelfSn: this.shelfSn}).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.countData = res.data
|
|
|
+ // 计算合计
|
|
|
+ this.countData.map(item => {
|
|
|
+ this.totalKs += item.category||0
|
|
|
+ this.totalNums += item.qty||0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ shelfCartDelete(row){
|
|
|
+ const _this = this
|
|
|
+ clzConfirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认删除此货位和产品吗?',
|
|
|
+ success (ret) {
|
|
|
+ if (ret.confirm || ret.index == 0) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '正在删除...'
|
|
|
+ })
|
|
|
+ shelfCartDelete({ shelfCartSn: row.shelfCartSn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.toashMsg(res.message)
|
|
|
+ _this.pageInit()
|
|
|
+ }
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ row.qty = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 修改数量
|
|
|
+ updateNums(e){
|
|
|
+ console.log(e)
|
|
|
+ const row = this.shelfPlaceList[this.curTab].find(item => item.id == e.index)
|
|
|
+ const nums = e.value
|
|
|
+
|
|
|
+ // 如果小于1,提示是否删除
|
|
|
+ if(nums<1){
|
|
|
+ this.shelfCartDelete(row)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 继续修改数量
|
|
|
+ uni.showLoading({
|
|
|
+ title: '正在保存...'
|
|
|
+ })
|
|
|
+ const params = {
|
|
|
+ shelfSn: row.shelfSn,
|
|
|
+ shelfName: this.shelfName,
|
|
|
+ shelfTierCode: row.shelfTierCode,
|
|
|
+ shelfPlaceSn: row.shelfPlaceSn,
|
|
|
+ shelfPlaceCode: row.shelfPlaceCode,
|
|
|
+ productSn: row.productSn,
|
|
|
+ productCode: row.productCode,
|
|
|
+ qty: nums,
|
|
|
+ price: row.price,
|
|
|
+ cost: row.cost,
|
|
|
+ shelfCartSn: row.shelfCartSn
|
|
|
+ }
|
|
|
+ console.log(params)
|
|
|
+ shelfCartSave(params).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.toashMsg(res.message)
|
|
|
+ this.getCount()
|
|
|
+ }
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+ .content{
|
|
|
+ width: 100%;
|
|
|
+ height: 100vh;
|
|
|
+ .product-list{
|
|
|
+ flex-grow: 1;
|
|
|
+ .leftTabs{
|
|
|
+ width: 20%;
|
|
|
+ overflow: auto;
|
|
|
+ > view{
|
|
|
+ padding: 0.8rem 0.5rem;
|
|
|
+ border-left: 0.2rem solid #f8f8f8;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .active{
|
|
|
+ border-color: rgb(47, 126, 209);
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .rightCons{
|
|
|
+ width: 80%;
|
|
|
+ background-color: #fff;
|
|
|
+ position: relative;
|
|
|
+ overflow: auto;
|
|
|
+ padding: 0 20upx;
|
|
|
+ .partList-list-box{
|
|
|
+ padding: 10px 0;
|
|
|
+ border-bottom: 2rpx solid #f5f5f5;
|
|
|
+ .pinfo{
|
|
|
+ flex-grow: 1;
|
|
|
+ padding-left: 20rpx;
|
|
|
+ .pname{
|
|
|
+ color: #191919;
|
|
|
+ font-size: 24rpx;
|
|
|
+ text{
|
|
|
+ font-weight: normal;
|
|
|
+ margin-right: 10rpx;
|
|
|
+ padding: 0 10rpx;
|
|
|
+ background: rgba(3, 54, 146, 0.15);
|
|
|
+ border-radius: 30rpx;
|
|
|
+ color: #033692;
|
|
|
+ font-size: 24rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ptools{
|
|
|
+ color: #666;
|
|
|
+ font-size: 24rpx;
|
|
|
+ .u-ninput{
|
|
|
+ border: 2rpx solid #eee;
|
|
|
+ border-radius: 50rpx;
|
|
|
+ padding: 0 6rpx;
|
|
|
+ }
|
|
|
+ /deep/ .u-icon-disabled{
|
|
|
+ background: #fff!important;
|
|
|
+ }
|
|
|
+ /deep/ .u-number-input{
|
|
|
+ margin: 0 0;
|
|
|
+ border: 2rpx solid #eee;
|
|
|
+ border-top: 0;
|
|
|
+ border-bottom: 0;
|
|
|
+ }
|
|
|
+ /deep/ .u-icon-plus, /deep/ .u-icon-minus{
|
|
|
+ border-radius: 50rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .footer-bar{
|
|
|
+ padding: 20rpx;
|
|
|
+ .heji{
|
|
|
+ flex-grow: 1;
|
|
|
+ color: #999;
|
|
|
+ text{
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+ font-size: 24rpx;
|
|
|
+ padding-right: 30upx;
|
|
|
+ }
|
|
|
+ .btns{
|
|
|
+ button{
|
|
|
+ width: 200rpx;
|
|
|
+ background-color: rgb(51, 95, 182);
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .heji-content{
|
|
|
+ padding: 60upx 30upx 30upx;
|
|
|
+ }
|
|
|
+ .heji-con-list{
|
|
|
+ > view{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ border-bottom: 2rpx solid #eee;
|
|
|
+ padding: 18rpx 0;
|
|
|
+ > view{
|
|
|
+ &:first-child{
|
|
|
+ font-weight: normal;
|
|
|
+ padding: 4rpx 15rpx;
|
|
|
+ background: rgba(3, 54, 146, 0.15);
|
|
|
+ border-radius: 10rpx;
|
|
|
+ color: #033692;
|
|
|
+ font-size: 24rpx;
|
|
|
+ margin-right: 30upx;
|
|
|
+ }
|
|
|
+ &:last-child{
|
|
|
+ flex-grow: 1;
|
|
|
+ text{
|
|
|
+ margin-right: 20upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .layer-content{
|
|
|
+ padding: 30upx;
|
|
|
+ .tits{
|
|
|
+ padding: 10upx 0 20upx;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .tagbox{
|
|
|
+ flex-grow: 1;
|
|
|
+ > view{
|
|
|
+ margin: 0 auto;
|
|
|
+ overflow: hidden;
|
|
|
+ width: 100%;
|
|
|
+ .tag{
|
|
|
+ width: 16%;
|
|
|
+ background-color: #fff;
|
|
|
+ border:1rpx solid #aeaeae;
|
|
|
+ box-shadow: 2rpx 4rpx 6rpx #eee;
|
|
|
+ border-radius: 15rpx;
|
|
|
+ text-align: center;
|
|
|
+ padding: 10rpx 0;
|
|
|
+ float: left;
|
|
|
+ margin: 10rpx 2%;
|
|
|
+ }
|
|
|
+ .active{
|
|
|
+ background-color: #55aaff;
|
|
|
+ border-color: #55aaff;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .newbtn{
|
|
|
+ padding: 40upx 0 10upx;
|
|
|
+ button{
|
|
|
+ width: 45%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|