|
@@ -14,30 +14,41 @@
|
|
|
<u-checkbox size="40" @change="allCheckeChange" v-model="allChecked" shape="circle">{{allChecked?'取消全选':'全选'}}</u-checkbox>
|
|
|
</view>
|
|
|
<view class="btns flex align_item justify_end">
|
|
|
- <kk-printer ref="kkprinter" @hasProduct="hasProduct" printBtnStyle="default-mid" defaultText="打印贴签" @startPrint="startPrint"></kk-printer>
|
|
|
+ <kk-printer ref="kkprinter" printBtnStyle="default-mid" defaultText="打印贴签" @startPrint="startPrint"></kk-printer>
|
|
|
<view style="padding: 0 10rpx;"></view>
|
|
|
<view>
|
|
|
- <u-button class="handle-btn" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="replenish()">快速补货</u-button>
|
|
|
+ <u-button class="handle-btn" :loading="loading" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="replenish">快速补货</u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <!-- 选择配送方式弹框 -->
|
|
|
+ <choose-type-modal v-if="chooseModal" :openModal="chooseModal" @confirm="modalChooseType" @close="chooseModal = false" />
|
|
|
+ <!-- 库存不足 弹框 -->
|
|
|
+ <stock-modal v-if="stockModal" :openModal="stockModal" :list="stockList" :params="temParams" @confirm="modalStock" @close="stockModal=false" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import quickProductList from './quickProductList.vue'
|
|
|
import kkPrinter from '@/components/kk-printer/index.vue';
|
|
|
+ import chooseTypeModal from './chooseTypeModal.vue'
|
|
|
+ import stockModal from '@/pages/replenishmentManage/stockModal.vue'
|
|
|
import {printTempl} from '@/libs/printTools.js'
|
|
|
+ import {saveReplenishBill} from '@/api/shelfReplenish.js'
|
|
|
export default {
|
|
|
- components: { quickProductList, kkPrinter },
|
|
|
+ components: { quickProductList, kkPrinter, chooseTypeModal, stockModal },
|
|
|
data() {
|
|
|
return {
|
|
|
- show: false,
|
|
|
+ loading: false,
|
|
|
+ chooseModal: false,
|
|
|
basicInfoData:null,
|
|
|
partList: [],
|
|
|
allChecked: false,
|
|
|
printIndex: 0,
|
|
|
isParinting: false,
|
|
|
+ stockModal: false,
|
|
|
+ stockList: [],
|
|
|
+ temParams:null,
|
|
|
customBtnStyle: { // 自定义按钮样式
|
|
|
borderColor: this.$config('primaryColor'),
|
|
|
backgroundColor: this.$config('primaryColor'),
|
|
@@ -51,6 +62,8 @@
|
|
|
backgroundColor: this.$config('primaryColor')
|
|
|
})
|
|
|
this.$refs.productList.setData(this.partList)
|
|
|
+ this.allCheckeChange({value:true})
|
|
|
+ this.allChecked = true
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
this.basicInfoData = JSON.parse(decodeURIComponent(option.data));
|
|
@@ -88,20 +101,64 @@
|
|
|
allCheckedCallback(val){
|
|
|
this.allChecked = val
|
|
|
},
|
|
|
- hasProduct(){
|
|
|
- const result =this.$refs.productList.getAllChecked()
|
|
|
- if(!result.length){
|
|
|
- this.toashMsg("请选择产品!")
|
|
|
- }
|
|
|
- },
|
|
|
// 补货
|
|
|
replenish(){
|
|
|
const result =this.$refs.productList.getAllChecked()
|
|
|
+ console.log(result,result.length)
|
|
|
if(result.length){
|
|
|
+ this.chooseModal = true
|
|
|
}else{
|
|
|
this.toashMsg("请选择产品!")
|
|
|
}
|
|
|
},
|
|
|
+ modalChooseType(data,confirm){
|
|
|
+ const result =this.$refs.productList.getAllChecked()
|
|
|
+ const arr = []
|
|
|
+ result.map((item, index) => {
|
|
|
+ arr.push({
|
|
|
+ productSn: item.productSn,
|
|
|
+ productCode: item.productCode,
|
|
|
+ qty: item.printQty,
|
|
|
+ shelfSn: this.basicInfoData.shelfSn,
|
|
|
+ shelfPlaceCode: item.shelfPlaceCode,
|
|
|
+ shelfPlaceSn: item.shelfPlaceSn
|
|
|
+ })
|
|
|
+ })
|
|
|
+ const params = {
|
|
|
+ detailList: arr,
|
|
|
+ dispatchType: data.dispatchType,
|
|
|
+ remarks: data.remarks,
|
|
|
+ shelfSn:this.basicInfoData.shelfSn,
|
|
|
+ confirm: confirm
|
|
|
+ }
|
|
|
+ console.log(params)
|
|
|
+ uni.showLoading({
|
|
|
+ title: "正在提交..."
|
|
|
+ })
|
|
|
+ this.loading = true
|
|
|
+ saveReplenishBill(params).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if(res.status == 200){
|
|
|
+ // 库存不足
|
|
|
+ if(res.data&&res.data.length){
|
|
|
+ this.temParams = params
|
|
|
+ this.stockList = res.data
|
|
|
+ this.stockModal = true
|
|
|
+ }else{
|
|
|
+ uni.navigateBack()
|
|
|
+ this.toashMsg(res.message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.loading = false
|
|
|
+ this.chooseModal = false
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 继续补货
|
|
|
+ modalStock(params){
|
|
|
+ this.modalChooseType(params,1)
|
|
|
+ this.stockModal = false
|
|
|
+ },
|
|
|
printOnce(opt,tsc,blesdk,data){
|
|
|
const _this = this
|
|
|
const dealer = this.$store.state.vuex_userData
|
|
@@ -132,24 +189,31 @@
|
|
|
_this.printIndex = 0
|
|
|
_this.$refs.kkprinter.onPrintSuccess()
|
|
|
_this.isParinting = false
|
|
|
- _this.show = false
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
// 批量打印
|
|
|
startPrint(opt,tsc,blesdk){
|
|
|
- const result =this.$refs.productList.getAllChecked()
|
|
|
+ const _this = this
|
|
|
+ const result =_this.$refs.productList.getAllChecked()
|
|
|
console.log(result,result.length)
|
|
|
if(result.length){
|
|
|
- if(this.isParinting){
|
|
|
+ if(_this.isParinting){
|
|
|
return
|
|
|
}
|
|
|
- this.isParinting = true
|
|
|
- this.show = true
|
|
|
- this.printOnce(opt,tsc,blesdk,result[this.printIndex])
|
|
|
+ clzConfirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '开始打印后,无法撤回,系统将默认按照每个产品的补货数量批量打印',
|
|
|
+ success (ret) {
|
|
|
+ if (ret.confirm || ret.index == 0) {
|
|
|
+ _this.isParinting = true
|
|
|
+ _this.printOnce(opt,tsc,blesdk,result[_this.printIndex])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}else{
|
|
|
- this.toashMsg("请选择产品!")
|
|
|
- this.$refs.kkprinter.onPrintFail()
|
|
|
+ _this.toashMsg("请选择产品!")
|
|
|
+ _this.$refs.kkprinter.onPrintFail()
|
|
|
}
|
|
|
},
|
|
|
}
|
|
@@ -162,10 +226,11 @@
|
|
|
height: 100vh;
|
|
|
background: #fff;
|
|
|
.head-info{
|
|
|
- padding: 10rpx;
|
|
|
+ padding: 20rpx 20rpx 0;
|
|
|
border-bottom: 2rpx solid #eee;
|
|
|
> view{
|
|
|
- padding: 5rpx 10rpx;
|
|
|
+ padding: 10rpx;
|
|
|
+ color: darkorange;
|
|
|
}
|
|
|
.p-title{
|
|
|
padding: 0 20rpx;
|
|
@@ -193,7 +258,7 @@
|
|
|
overflow: auto;
|
|
|
}
|
|
|
.part-footer{
|
|
|
- padding: 15rpx 30rpx;
|
|
|
+ padding: 20rpx 30rpx;
|
|
|
border-top: 2rpx solid #eee;
|
|
|
> view{
|
|
|
&:first-child{
|