123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <template>
- <view class="replenishment-confirm-wrap">
- <scroll-view scroll-y class="replenishment-confirm-cont">
- <view class="replenishment-confirm-main" v-for="(item,index) in listdata" :key="item.id">
- <u-image class="item-pic" :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="64px" height="64px"></u-image>
- <view class="item-con">
- <view class="item-name">{{item.product&&item.product.name?item.product.name:'--'}}</view>
- <view class="item-code">{{item.product&&item.product.code?item.product.code:'--'}}</view>
- <view class="item-num">
- <view class="num-t">x {{item.qty||item.qty==0?item.qty:'--'}} {{item.product&&item.product.unit?item.product.unit:'--'}}</view>
- <view class="num-v">
- <u-number-box color="#000" bg-color="#fff" v-model="item.confirmQty" @change="handlerChange" :min="0" :max="item.qty"></u-number-box>
- </view>
- </view>
- </view>
- </view>
- <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" img-width="120" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
- </scroll-view>
- <view class="replenishment-confirm-footer" v-if="listdata.length>0">
- <u-button @click="confirmModal=true" type="success" :custom-style="customStyle" hover-class="none" shape="circle">确定补货({{confirmQty}}/{{totalQty}})</u-button>
- </view>
- <!-- 确认弹框 -->
- <common-modal :openModal="confirmModal" content="确认对该数字货架进行补货吗?" confirmText="确认补货" @confirm="modalConfirm" @close="confirmModal=false" />
- <!-- 库存不足 弹框 -->
- <stock-modal :openModal="stockModal" :list="stockList" :params="paramsData" @confirm="modalStock" @close="stockModal=false" />
- </view>
- </template>
- <script>
- import commonModal from '@/pages/common/commonModal.vue'
- import stockModal from './stockModal.vue'
- import { shelfReplenishDetailList, shelfReplenishDetailStock, shelfReplenishConfirm } from '@/api/shelfReplenish'
- export default {
- components: { commonModal, stockModal },
- data() {
- return {
- listdata: [],
- status: 'loadmore',
- noDataText: '暂无数据',
- theme: '',
- customStyle: {
- borderRadius:'100rpx',
- fontSize:'30rpx',
- background: this.$config('primaryColor')
- },
- confirmQty: 0, // 实发数量之和
- totalQty: 0, // 应发数量之和
- replenishBillSn: '',
- confirmModal: false,
- stockModal: false,
- stockList: [],
- paramsData: null
- }
- },
- onReady() {
- uni.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: this.$config('primaryColor')
- })
- },
- onLoad(options){
- this.theme = getApp().globalData.theme
- this.replenishBillSn = options.sn
- this.getRow()
- },
- methods:{
- // 查询列表
- getRow () {
- const _this = this
- shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
- if (res.status == 200) {
- _this.totalQty = 0
- _this.confirmQty = 0
- res.data.map(item =>{
- item.confirmQty = item.qty || 0
- if(item.qty && Number(item.qty)){
- _this.totalQty += Number(item.qty)
- }
- if(item.confirmQty && Number(item.confirmQty)){
- _this.confirmQty += Number(item.confirmQty)
- }
- })
- this.listdata = res.data || []
- } else {
- this.listdata = []
- }
- })
- },
- handlerChange(value, index){
- const _this = this
- this.confirmQty = 0
- this.listdata.map(item => {
- if(item.confirmQty && Number(item.confirmQty)){
- _this.confirmQty += Number(item.confirmQty)
- }
- })
- },
- // 确认补货 confirm
- modalConfirm(){
- const arr = []
- this.listdata.map((item, index) => {
- if (item.confirmQty || item.confirmQty == 0) {
- arr.push({
- productSn: item.productSn,
- confirmQty: item.confirmQty,
- replenishBillDetailSn: item.replenishBillDetailSn
- })
- }
- })
- const params = {
- shelfSn: this.listdata[0].shelfSn,
- replenishBillSn: this.replenishBillSn,
- replenishBillNo: this.listdata[0].replenishBillNo,
- detailList: arr
- }
- // 校验产品库存是否足够
- shelfReplenishDetailStock(params).then(res => {
- if (res.status == 200) {
- if (res.data && res.data.length > 0) {
- this.stockList = res.data || []
- this.paramsData = params
- this.confirmModal = false
- this.stockModal = true
- } else {
- this.confirmFun(params)
- }
- }
- })
- },
- // 提交确认
- confirmFun (params) {
- shelfReplenishConfirm(params).then(res => {
- if (res.status == 200) {
- if(res.status == 200){
- uni.$emit('refreshBL')
- uni.navigateBack()
- }
- this.toashMsg(res.message)
- }
- })
- },
- // 库存不足 confirm
- modalStock(params){
- this.stockModal = false
- this.confirmFun(params)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page {
- height: 100%;
- }
- .replenishment-confirm-wrap{
- background-color: #fff;
- position: relative;
- width: 100%;
- height: 100%;
- overflow: hidden;
- padding-bottom: 136upx;
- .replenishment-confirm-cont{
- width: 100%;
- height: 100%;
- overflow: auto;
- .replenishment-confirm-main{
- display: flex;
- justify-content: space-between;
- margin: 0 32upx;
- padding: 30upx 0;
- border-bottom: 1px solid #E5E5E5;
- .item-pic{
- flex-shrink: 0;
- margin-right: 20upx;
- }
- .item-con{
- flex-grow: 1;
- .item-name{
- color: #191919;
- font-size: 30upx;
- font-weight: bold;
- }
- .item-code{
- color: #999999;
- font-size: 26upx;
- }
- .item-num{
- display: flex;
- justify-content: space-between;
- align-items: center;
- .num-t{
- color: #707070;
- font-size: 26upx;
- }
- .num-v{
- 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;
- }
- }
- }
- }
- }
- .replenishment-confirm-footer{
- padding: 26upx 32upx 30upx;
- background-color: #fff;
- position: fixed;
- left: 0;
- bottom: 0;
- width: 100%;
- box-shadow: 3px 1px 7px #eee;
- }
- }
- </style>
|