123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <template>
- <view class="sendOutGoods-wrap">
- <view class="sendOutGoods-con">
-
- <view class="info-body">
- <view class="info partList">
-
- <partList :list="partList" title="补货产品" model="view" fromPage="sendOutGoods" ref="partList" noDataText="暂无产品"></partList>
- </view>
- </view>
- </view>
- <view class="sendOutGoods-footer">
- <u-button v-if="!isAll" @click="scanCode" type="success" :custom-style="customStyle" hover-class="none" shape="circle">
- <u-icon name="scan" size="34"></u-icon>
- 点击扫码
- </u-button>
- <u-button v-else @click="handleOutGoods" :loading="loading" type="success" :custom-style="customStyle" hover-class="none" shape="circle">立即出库</u-button>
- </view>
-
- <common-modal v-if="confirmModal" :openModal="confirmModal" :title="contTitle?'扫码成功':'扫码失败'" :content="contModal" confirmText="继续扫码" @confirm="modalConfirm" @close="confirmModal=false" />
-
- <common-modal v-if="confirmOutModal" :openModal="confirmOutModal" title="出库" content="此补货单产品已经全部扫描完成,确认出库吗?" confirmText="确认出库" @confirm="modalOutConfirm" @close="confirmOutModal=false" />
-
- <choose-type-modal v-if="chooseModal" :openModal="chooseModal" @confirm="modalChooseType" @close="closeChooseType" />
- </view>
- </template>
- <script>
- import partList from '@/pages/common/partList.vue'
- import chooseTypeModal from './chooseTypeModal.vue'
- import commonModal from '@/pages/common/commonModal.vue'
- import { getQueryString } from '@/libs/tools'
- import { shelfReplenishDetailList, shelfReplenishDetailOutScan, shelfReplenishOutStock, shelfReplenishDetail } from '@/api/shelfReplenish'
- export default {
- components: { partList, commonModal, chooseTypeModal },
- data() {
- return {
- loading: false,
- barcode:null,
- replenishBillSn: null,
- shelfSn: null,
- partList: [],
- confirmModal: false,
- customStyle: {
- borderRadius:'100rpx',
- fontSize:'30rpx',
- background: this.$config('primaryColor')
- },
- isAll: false,
- contTitle: '',
- contModal: '',
- confirmOutModal: false,
- chooseModal: false,
- mpaasScanModule: null
- }
- },
- onReady() {
-
-
- },
- onLoad(options) {
- this.replenishBillSn = options.sn
- this.shelfSn = options.shelfSn
- this.getPartList()
- this.getDetail()
- },
- methods: {
-
- scanCode(){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.mpaasScanModule = uni.requireNativePlugin("wss-scan")
- this.mpaasScanModule.scan(
- {
- "scanType":["QRCODE","DATAMATRIX"],
- "scanMode":"Customized",
- "scanStyle":{
- "scanFrameSizePlus":{"width":200,"height":200},
- "scanFrameSize":200,
- "scanLight":"visible",
- "scanText":"对准物品二维码",
- "scanTitle":"扫码发货出库",
- }
- },
- (result) => {
- console.log(result)
- if(result.scanStatus == 1){
- this.scanResult(result.scanValue)
- }
- })
- },
-
- getDetail(){
- shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
- console.log(res)
- if(res.status == 200 && res.data){
- if(res.data.totalQty && res.data.totalScanQty && res.data.totalQty == res.data.totalScanQty){
- this.isAll = true
- }else{
- this.isAll = false
- }
- }else{
- this.isAll = false
- }
- })
- },
-
- handleOutGoods(){
- if(this.isAll){
- this.confirmOutModal = true
- }else{
- this.toashMsg("请全部扫描完成后,再进行出库操作")
- }
- },
-
- modalChooseType(data){
- const _this = this
- const arr = []
- _this.partList.map((item, index) => {
- arr.push({
- productSn: item.productSn,
- confirmQty: item.qty,
- replenishBillDetailSn: item.replenishBillDetailSn,
- id:item.id
- })
- })
- const params = {
- replenishBillSn: _this.replenishBillSn,
- detailList: arr,
- dispatchType: data.dispatchType,
- remarks: data.remarks,
- shelfSn: _this.shelfSn
- }
- console.log(params)
- this.loading = true
- shelfReplenishOutStock(params).then(res => {
- console.log(res)
- if (res.status == 200) {
- _this.toashMsg(res.message)
- _this.chooseModal = false
-
- uni.$emit('refreshBL')
- uni.$emit("refreshBhList",'WAIT_CHECK')
- uni.navigateBack({
- delta:2
- })
- }else{
- _this.toashMsg(res.message)
- }
- this.loading = false
- })
- },
-
- modalOutConfirm(){
- this.confirmOutModal = false
- this.chooseModal = true
- },
- closeChooseType(){
- this.confirmOutModal = false
- this.chooseModal = false
- },
-
- getPartList(){
- const _this = this
- shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
- if(res.status == 200 && res.data){
- res.data.map(item =>{
- item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
- })
- this.partList = res.data || []
- }else{
- this.partList = []
- }
- })
- },
-
- scanResult(qrCode){
- const _this = this
- const pa = qrCode.split("&")
- console.log(qrCode,pa)
- shelfReplenishDetailOutScan({
- replenishBillSn: _this.replenishBillSn,
- shelfSn: pa[0],
- shelfPlaceSn: pa[3],
- productSn: pa[2]
- }).then(res => {
- console.log(res)
- if(res.status == 200){
-
- _this.getPartList()
- if(res.data && res.data.totalQty && res.data.totalScanQty && res.data.totalQty == res.data.totalScanQty){
- _this.isAll = true
- _this.handleOutGoods()
- }else{
- this.contTitle = 1
- this.contModal = '是否继续扫码'
- this.confirmModal = true
- }
- }else{
- this.contTitle = 0
- this.contModal = res.message
- this.confirmModal = true
- }
- })
- },
- modalConfirm(){
- this.confirmModal = false
- this.scanCode()
- },
- init(){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- }
- }
- </script>
- <style lang="less">
- page{
- height: 100vh;
- }
- .sendOutGoods-wrap{
- position: relative;
- width: 100%;
- height: 100%;
- overflow: hidden;
- padding-bottom: 136upx;
- .sendOutGoods-con{
- width: 100%;
- height: 100%;
- overflow: auto;
- display: flex;
- flex-direction: column;
- .barCode{
- height: 33%;
- margin-bottom: 10%;
- }
- .info-body{
- flex-flow: 1;
- overflow: auto;
- height: 100%;
- }
- .info{
- background-color: #FFFFFF;
- padding: 10rpx 30upx;
- font-size: 32rpx;
- margin-top: 20rpx;
- }
- }
- .sendOutGoods-footer{
- padding: 26upx 32upx 30upx;
- background-color: #fff;
- position: fixed;
- left: 0;
- bottom: 0;
- width: 100%;
- box-shadow: 3px 1px 7px #eee;
- }
- }
- </style>
|