123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520 |
- <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>
- <scroll-view scroll-y class="rightCons" v-if="shelfPlaceList">
- <view
- class="partList-list-box"
- v-for="item in shelfPlaceList[curTab]"
- :key="item.shelfCartSn"
- @click="editRow(item)"
- >
- <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="ptxt">
- <text>{{item.shelfPlaceCode}}</text>
- {{item.productCode}}
- </view>
- <view class="pname">
- {{item.product.productName}}
- </view>
- </view>
- </view>
- <view class="ptools flex align_center justify_between">
- <view></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>
- </scroll-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" :z-index="100">
- <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%" :mask-close-able="false" closeable @close="curLayer=''" 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>
- <!-- 上架确认 -->
- <choose-type-modal v-if="chooseModal" :totalKs="totalKs" :totalNums="totalNums" :openModal="chooseModal" @confirm="confirmPut" @close="chooseModal = false" />
- <printStickerModal v-if="showPrintModal" :layer="curTab" :openModal="showPrintModal" @confirm="confirmPrint" @close="showPrintModal = false"></printStickerModal>
- </view>
- </template>
- <script>
- import { clzConfirm, numberToFixed } from '@/libs/tools';
- import {queryMapList, queryCountList, shelfCartSave, shelfCartDelete, queryEmptyCostList, shelfCartConfirm} from '@/api/shelfCart.js'
- import chooseTypeModal from './chooseTypeModal'
- import printStickerModal from './printStickerModal'
- export default {
- components: {
- chooseTypeModal,
- printStickerModal
- },
- data() {
- return {
- showPop: false,
- chooseModal: false,
- showPrintModal: false,
- shelfSn: '',
- shelfName: '',
- shelfPlaceList: null,
- placeTab: [],
- curTab: '',
- totalKs: 0,
- totalNums: 0,
- countData: [],
- layerList: [],
- showLayer: false,
- curLayer: ''
- }
- },
- onShow() {
- this.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
- this.shelfName = opts.shelfName
- this.customerSn = opts.customerSn
- this.pageInit()
-
- uni.$on("updateTempHw",()=>{
- this.pageInit(true)
- })
-
- uni.$on("setCostOk",()=>{
- this.chooseModal = true
- })
- },
- onUnload() {
- uni.$off("updateTempHw")
- },
- onNavigationBarButtonTap(e) {
- console.log(e)
- // 上架入库
- if(e.index == 0){
- this.toPutaway()
- }
- // 打印贴签
- if(e.index == 1){
- this.showPrintModal = true
- }
- },
- methods: {
- pageInit(flag){
- this.placeTab = []
- this.shelfPlaceList = null
- this.countData = []
- this.getList(flag)
- this.getCount()
- },
- scanProduct(){
- this.showLayer = false
- uni.navigateTo({
- url: "/pages/batchShelves/scanProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
- })
- },
- searchProduct(){
- this.showLayer = false
- uni.navigateTo({
- url: "/pages/batchShelves/searchProduct?shelfSn="+this.shelfSn+'&layer='+this.curLayer+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
- })
- },
- // 上架入库
- toPutaway(){
- uni.showLoading({
- title: '正在查询...',
- mask: true
- })
- queryEmptyCostList({shelfSn: this.shelfSn}).then(res => {
- console.log(res)
- uni.hideLoading()
- if(res.data&&res.data.length){
- this.$store.state.vuex_tempData = res.data
- // 去设置价格
- uni.navigateTo({
- url: "/pages/batchShelves/setProductCost?shelfSn="+this.shelfSn+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
- })
- }else{
- this.chooseModal = true
- }
- })
- },
- //确认上架
- confirmPut(data){
- uni.showLoading({
- mask: true,
- title: '正在上架...'
- })
- shelfCartConfirm({
- shelfSn: this.shelfSn,
- ...data
- }).then(res => {
- uni.hideLoading()
- if(res.status == 200){
- uni.$emit("updateHw")
- uni.navigateBack()
- }
- })
- },
- // 打印
- confirmPrint(type){
- this.showPrintModal = false
- const shelfInfo = {
- shelfSn: this.shelfSn,
- shelfName: this.shelfName,
- layer: this.curTab
- }
- // 打印当前层
- if(type == 'manual'){
- const list = this.shelfPlaceList[this.curTab]
- this.$store.state.vuex_tempPrintList = list
- if(shelfInfo&&list.length){
- uni.navigateTo({
- url: "/pages/batchShelves/batchPrint/batchPrint?type=manual&data="+encodeURIComponent(JSON.stringify(shelfInfo))
- })
- }else{
- uni.showToast({
- icon: 'none',
- title: '没有可打印的产品',
- duration: 5000
- })
- }
- }else{
- // 搜索打印
- this.$store.state.vuex_tempPrintList = this.shelfPlaceList
- uni.navigateTo({
- url: "/pages/batchShelves/batchPrint/batchPrint?type=search&data="+encodeURIComponent(JSON.stringify(shelfInfo))
- })
- }
- },
- // 编辑
- editRow(item){
- this.$store.state.vuex_tempData = item
- uni.navigateTo({
- url: "/pages/batchShelves/editShelfHw?shelfSn="+this.shelfSn+'&shelfName='+this.shelfName+'&customerSn='+this.customerSn
- })
- },
- // 获取产品列表
- getList(flag){
- uni.showLoading({
- mask: true,
- title: '正在加载...'
- })
- queryMapList({ shelfSn: this.shelfSn }).then(res => {
- console.log(res.data)
- if (res.status == 200 && res.data) {
- this.shelfPlaceList = JSON.stringify(res.data) == '{}' ? null : res.data
- for(let a in res.data){
- this.placeTab.push(a)
- }
- if(!flag || this.placeTab.length==1){
- this.curTab = this.placeTab[0]
- }else{
- if(!this.shelfPlaceList[this.curTab]){
- this.curTab = this.placeTab[0]
- }
- }
- if(this.placeTab.length == 0){
- this.shelfPlaceList = null
- }
- } else {
- this.shelfPlaceList = null
- this.placeTab = []
- }
- uni.hideLoading()
- })
- },
- // 获取统计数据
- 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({
- mask: true,
- title: '正在删除...'
- })
- shelfCartDelete({ shelfCartSn: row.shelfCartSn }).then(res => {
- if (res.status == 200) {
- _this.toashMsg(res.message)
- _this.pageInit(true)
- }
- uni.hideLoading()
- })
- }else{
- _this.pageInit(true)
- }
- }
- })
- },
- // 修改数量
- 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({
- mask: true,
- title: '正在保存...'
- })
- const params = {
- shelfSn: row.shelfSn,
- shelfName: this.shelfName,
- shelfTierCode: row.shelfTierCode,
- shelfPlaceSn: row.shelfPlaceSn||undefined,
- 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;
- padding: 0 20upx;
- height: calc(100vh - 110rpx);
- .partList-list-box{
- padding: 10px 0;
- border-bottom: 2rpx solid #f5f5f5;
- .pinfo{
- flex-grow: 1;
- padding-left: 20rpx;
- .ptxt{
- color: #666;
- font-size: 26rpx;
- 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;
- }
- margin-bottom: 15upx;
- }
- .pname{
- color: #666;
- font-size: 30rpx;
- font-weight: bold;
- }
- }
- .ptools{
- color: #666;
- font-size: 26rpx;
- .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;
- position: relative;
- z-index: 200;
- background-color: #fff;
- .heji{
- flex-grow: 1;
- color: #999;
- text{
- color: #333;
- }
- font-size: 26rpx;
- 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>
|