From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- pages/product/feed/index.vue | 756 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 756 insertions(+), 0 deletions(-) diff --git a/pages/product/feed/index.vue b/pages/product/feed/index.vue new file mode 100644 index 0000000..41da394 --- /dev/null +++ b/pages/product/feed/index.vue @@ -0,0 +1,756 @@ +<template> + <view class="page"> + <view class="productfeed-index-bg"/> + <u-navbar title="鐢熶骇鎶曟枡" :background="background" :border-bottom="false" :title-bold="true" title-color="#000" back-icon-color="#000"/> + <view class="productfeed-index-param"> + <view class="productfeed-index-param-title"> + <view> + <u-line style="border:5rpx solid #264DE9" length="33rpx" direction="col" color="#264DE9" :hair-line="false"></u-line> + </view> + <view class="title-label">鎶曟枡淇℃伅</view> + </view> + <view class="productfeed-index-param-view"> + <view class="productfeed-index-param-item param-extra"> + <view class="productfeed-index-param-item-left"> + <text class="item-one">宸ヤ綔绔�</text> + </view> + <view class="productfeed-index-param-item-right" @click="toWorkstation()"> + <text v-if="feedMainInfo.workstationName" class="item-one">{{feedMainInfo.workstationName}}</text> + <text v-if="!feedMainInfo.workstationName" class="item-one item-two">璇烽�夋嫨</text> + <u-icon name="arrow-right" color="#2979ff" size="28"></u-icon> + </view> + </view> + <view class="productfeed-index-param-item param-extra"> + <view class="productfeed-index-param-item-left"> + <text class="item-one">宸ュ崟鍙�</text> + </view> + <view class="productfeed-index-param-item-right" @click="toOptask()"> + <text v-if="feedMainInfo.optaskNo" class="item-one">{{feedMainInfo.optaskNo}}</text> + <text v-if="!feedMainInfo.optaskNo" class="item-one item-two">璇烽�夋嫨</text> + <u-icon name="arrow-right" color="#2979ff" size="28"></u-icon> + </view> + </view> + <view class="productfeed-index-param-item"> + <view class="productfeed-index-param-item-left"> + <text class="item-one">鎶曟枡璁板綍</text> + </view> + <view class="productfeed-index-param-item-right" @click="toFeedRecord()"> + <text class="item-three">鍘绘煡鐪�</text> + <u-icon name="arrow-right" color="#2979ff" size="28"></u-icon> + </view> + </view> + </view> + </view> + <view class="productfeed-index-body-title"> + <view> + <u-line style="border:5rpx solid #264DE9" length="33rpx" direction="col" color="#264DE9" :hair-line="false"></u-line> + </view> + <view class="title-label">鎵弿璁板綍</view> + </view> + <view class="wrap"> + <scroll-view class="productfeed-index-scroll-list" scroll-y="true" > + <u-cell-group class="productfeed-index-scroll-list-group" :border="false"> + <view class="content" v-for="(item, index) in list" :key="item.erpPartNo" :index="index"> + <view class="content-header"> + <view class="header-item"> + <view class="content-header-icon-one"></view> + <view class="content-header-title">{{ item.partBatchNo }}</view> + </view> + <view class="header-item"> + <view class="content-header-icon-two"></view> + <view class="content-header-title-ne">{{ item.partName }}</view> + </view> + <view class="header-item-toolbar" @click="deleteHandle(item)"> + <view class="header-item-toolbar-del-icon"> + + </view> + <view class="header-item-toolbar-del-text"> + 鍒犻櫎 + </view> + </view> + </view> + <view class="content-body"> + <view class="row-list"> + <view class="_label"> + 闆朵欢缂栧彿锛� + </view> + <view class="_content"> + {{ item.partNo }} + </view> + </view> + <view class="row-list"> + <view class="_label"> + 鍙敤鏁伴噺锛� + </view> + <view class="_content"> + <text class="_content-text">{{ item.reservedQuantity }}</text> + </view> + </view> + <view class="row-list"> + <view class="_label"> + 鎶曟枡鏁伴噺锛� + </view> + <view class="_content _input"> + <u-input placeholder="璇疯緭鍏ユ姇鏂欐暟閲�" v-model="item.suppliedQuantity" type="digit"></u-input> + <view class="edit_icon"></view> + </view> + </view> + </view> + </view> + </u-cell-group> + </scroll-view> + <scan></scan> + <view class="productfeed-footer"> + <u-button class="btn-left" text="娓呯┖" size="medium" @click="clearData()">娓呯┖</u-button> + <u-button class="btn-right" text="鎶曟枡" size="medium" @click="feedMaterialClick()">鎶曟枡</u-button> + </view> + </view> + </view> +</template> +<script> + import scan from "@/components/scan/scan.vue"; + import content_bg from '@/static/custom/product/productBg.png' + export default { + components: { + scan + }, + data() { + return { + background:{ + backgroundImage: `url(${content_bg})`, + backgroundAttachment: 'fixed', + backgroundSize: '100% auto', + backgroundRepeat: 'no-repeat', + }, + showCardHead: false, + feedMainInfo: { + workstationId: null, + workstationNo: null, + workstationName: null, + optaskId: null, + optaskNo: null, + feedLocId: null, + feedLocNo: null, + feedLocName: null, + partId: null, + partNo: null, + partName: null, + quality: null, + ifsBatchNo:null, + customerOrderNo:null + }, + query: { + current: 1, + size: 20 + }, + list:[], + options: [{ + text: '鍒犻櫎', + style: { + backgroundColor: '#dd524d' + } + }], + count: 0, + loadStatus: 'loadmore', + idIndex:1 + }; + }, + onLoad() { + + }, + onShow() { + + let that = this + + uni.$off('scan') // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒 + uni.$on('scan', function(data) { + console.log('onscan'); + //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲� + console.log('鎵爜缁撴灉锛�', data.code); + // console.log(data.code.replace(/\n/g,'').replace(/\s*/g,'')) + // console.log('鎵爜缁撴灉1锛�', JSON.parse(data.code.replace(/\n/g,"").replace(/\s*/g,''))); + // that.search(data.code); + + if (data.code != "" && + (that.feedMainInfo.workstationId == "" + || that.feedMainInfo.workstationId==null + || that.feedMainInfo.workstationId==undefined + || that.feedMainInfo.workstationId=="undefined" + )) { + uni.showToast({ + title: '璇峰厛閫夋嫨宸ヤ綔绔欙紝鍐嶆壂鐮�', + icon: 'none' + }) + return + } + + that.loadList(data.code); + }) + }, + onNavigationBarButtonTap(e) { + this.goScan() + }, + methods: { + goScan(){ + //let scanresult={"part_no":"88.118.1/A0044193","package_code":"TP092022101200001","unit_meas":"璺�","wdr":"*","lot_batch_no":"*","qty_arrived":12} + //this.scanHandle(JSON.stringify(scanresult)) + + uni.scanCode({ + scanType: ['qrCode'], + success: res => { + try { + console.log('鎵爜缁撴灉锛�', res); + this.scanHandle(res.result) + } catch (e) {} + } + }); + }, + scanHandle(workstationNo){ + if(workstationNo!=''){ + this.$u.api.pigxFeed.fetchWorkstationList({workstationNo:workstationNo}).then(resp => { + + if (!resp.data.records || resp.data.records.length == 0) { + this.$u.toast('銆�'+workstationNo+'銆�,鏈煡璇㈠埌鏈哄彴淇℃伅') + }else{ + let workstationList=resp.data.records + let scanWorkstationInfo=workstationList[0] + this.feedMainInfo.workstationId = scanWorkstationInfo.id + this.feedMainInfo.workstationNo = scanWorkstationInfo.workstationNo + this.feedMainInfo.workstationName = scanWorkstationInfo.name + + } + }) + }else{ + this.$u.toast('鏈壂鎻忓埌鏈哄彴鍙�') + } + }, + clearData(){ + this.list = [] + this.feedMainInfo={ + workstationId: null, + workstationNo: null, + workstationName: null, + optaskId: null, + optaskNo: null, + feedLocId: null, + feedLocNo: null, + feedLocName: null, + partId: null, + partNo: null, + partName: null, + quality: null, + customerOrderNo:null + } + }, + feedMaterialClick(){ + + let that = this; + + if(that.feedMainInfo.workstationNo==""||that.feedMainInfo.workstationNo==undefined||that.feedMainInfo.workstationNo=="undefined") + { + that.$u.toast('璇峰厛閫夋嫨宸ヤ綔绔�') + return + } + + if(that.list.length==0) + { + that.$u.toast('璇锋壂鐮佽幏鍙栨姇鏂欎俊鎭�') + return + } + + for(let i=0;i<that.list.length;i++) + { + if(that.list[i].suppliedQuantity>that.list[i].reservedQuantity) + { + + that.$u.toast('鍙敤搴撳瓨鏁伴噺鍙湁:'+that.list[i].reservedQuantity + '锛屾姇鏂欐暟閲忚秴杩囧簱瀛樻暟鎹紝璇烽噸鏂拌緭鍏ユ姇鏂欐暟閲�') + return + } + } + + let feedList=[] + that.list.map((item) => { + + let suppliedQuantity =0; + suppliedQuantity = item.suppliedQuantity!=""?parseFloat(item.suppliedQuantity):0 + + let data ={ + workstationId: that.feedMainInfo.workstationId, + //workstationNo : that.feedMainInfo.workstationNo, + stockId: item.stockId, + joinStockOrderId: item.id, + suppliedQuantity: suppliedQuantity, + partId: item.partId, + partNo: item.partNo, + partBatchNo: item.partBatchNo, + systemNo: item.systemNo, + partName: item.partName, + unit: item.partUnit ? item.partUnit : '', + //ifsBatchNo:item.ifsBatchNo ,//ifs鎵规鍙� + + } + feedList.push(data) + + }); + const feedIn = { + feeds: feedList, + customOrderNo: that.feedMainInfo.customOrderNo, + feedingFrom: 'joinStocker', + operationTaskId: that.feedMainInfo.optaskId, + source: undefined + } + that.$u.api.pigxFeed.addFeed(feedIn).then(res => { + + if (res.code == 0) { + uni.showModal({ + title: '鎻愮ず', + content: '鎻愪氦鎴愬姛', + showCancel: false, + success: function() { + that.list = [] + + } + }) + } else { + uni.showModal({ + title: '鎻愮ず', + content: '鎻愪氦澶辫触', + showCancel: false, + success: function() { + + } + }) + } + + }) + }, + toFeedRecord() { + + if(this.feedMainInfo.workstationNo==""||this.feedMainInfo.workstationNo==undefined||this.feedMainInfo.workstationNo=="undefined") + { + this.$u.toast('璇峰厛閫夋嫨宸ヤ綔绔�') + return + } + + uni.navigateTo({ + url: '/pages/product/feed/feedRecordList?workstationId='+this.feedMainInfo.workstationId + }) + }, + setLocation(location) { + this.feedMainInfo.feedLocId = location.id + this.feedMainInfo.feedLocNo = location.locNo + this.feedMainInfo.feedLocName = location.locName + }, + setWorkstation(workstation) { + this.feedMainInfo.workstationId = workstation.id + this.feedMainInfo.workstationNo = workstation.workstationNo + this.feedMainInfo.workstationName = workstation.name + }, + setOptask(task) { + this.feedMainInfo.optaskId = task.id + this.feedMainInfo.optaskNo = task.optaskNo + this.feedMainInfo.partId = task.partId + this.feedMainInfo.partNo = task.partNo + this.feedMainInfo.partName = task.partName + this.feedMainInfo.quality = task.plannedQuantity + this.feedMainInfo.customerOrderNo=task.customerOrderNo + }, + toLocation() { + + if(this.feedMainInfo.workstationNo==""||this.feedMainInfo.workstationNo==undefined||this.feedMainInfo.workstationNo=="undefined") + { + this.$u.toast('璇峰厛閫夋嫨宸ヤ綔绔�') + return + } + + uni.navigateTo({ + url: '/pages/product/feed/locationList?workstationNo='+this.feedMainInfo.workstationNo + }) + }, + toOptask() { + + + if(this.feedMainInfo.workstationNo==""||this.feedMainInfo.workstationNo==undefined||this.feedMainInfo.workstationNo=="undefined") + { + this.$u.toast('璇峰厛閫夋嫨宸ヤ綔绔�') + return + } + + + uni.navigateTo({ + url: '/pages/product/feed/optaskList?workstationNo='+this.feedMainInfo.workstationNo + }) + }, + toWorkstation() { + uni.navigateTo({ + url: '/pages/product/feed/workstationList' + }) + }, + loadList(sanCode) { + let that = this + if(sanCode!="") + { + //鏍规嵁鎵叆鐨勫瓧绗︿覆淇℃伅锛屽垽鏂壂鐨勬槸鏉″舰鐮侊紝杩樻槸浜岀淮鐮� + let batchNo='' + if (sanCode.indexOf('lot_batch_no') != -1) { + // 浜岀淮鐮� + const scanContentJson = JSON.parse( + sanCode.replace(/\n/g, '').replace(/\s*/g, '') + ) + const partNo= scanContentJson.part_no + const ifsBatchNo = scanContentJson.lot_batch_no + batchNo=scanContentJson.sn_no + if(!(batchNo && batchNo!=null && batchNo!='' && batchNo!='null')){ + batchNo='' + } + + } else { + // 鏉″舰鐮� + batchNo = sanCode + + } + + let params=Object.assign( + { current: 1, size: 50 }, + {operationTaskId:this.feedMainInfo.optaskId}, + {partBatchNo:batchNo} + ) + + //鑾峰彇閰嶇洏鐗╂枡 + this.$u.api.pigxFeed.fetchJoinStockOrderList(params).then(res => { + let reList = [] + reList = res.data.records; + if(reList.length==0) + { + uni.showToast({ + title: "鏈壂鍒伴厤鐩樼墿鏂欎俊鎭�", + icon: "none" + }); + return + } + let flag = true + for (let i = 0; i < reList.length; i++) { + const exist = that.list.find( + (el) => el.partBatchNo == reList[i].partBatchNo + ) + if (exist) { + flag = false + } + } + if(!flag){ + uni.showToast({ + title: "闆朵欢鎵规宸插瓨鍦�", + icon: "none" + }); + return + }else{ + reList.map((item) => { + item.suppliedQuantity = item.reservedQuantity + that.list.push(item) + }); + } + }); + + //鏍规嵁宸ヤ綔绔檌d鏌ヨ绾胯竟浠� + /*this.$u.api.pigxFeed.getStockByWorkstationId(params).then(res => { + let reList = [] + reList = res.data.records; + if(reList.length==0) + { + uni.showToast({ + title: "鏈壂鍒扮浉搴旀姇鏂欎俊鎭�", + icon: "none" + }); + return + } + + reList.map((item) => { + item.suppliedQuantity = item.reservedQuantity + that.list.push(item) + }); + });*/ + } + + this.$forceUpdate(); + + }, + deleteHandle(obj) { + let that = this + uni.showModal({ + title: '鎻愮ず', + content: '姝ゆ搷浣滃皢鍒犻櫎璇ユ壂鐮佷俊鎭�, 鏄惁缁х画?', + success: function(res) { + if (res.confirm) { + + that.list.map((item, index) => { + if (obj.id == item.id) { + that.list.splice(index, 1) + } + }); + } + } + }); + }, + search(value) { + this.list = []; + this.query.current = 1; + this.query.username = value; + this.loadList(); + } + } + }; +</script> +<style lang="scss" scoped> + .productfeed-index-bg{ + background-color: #F6F9FF; + background-image: url('~@/static/custom/product/productBg.png'); + // background: linear-gradient(180deg,rgba(206,227,254,1),rgba(206,227,254,1) 20%,rgba(206,227,254,0.5) 40%,rgba(206,227,254,0.25) 60%,rgba(206,227,254,0.08) 80%,rgba(206,227,254,0)); + padding: 0 20rpx; + background-attachment: fixed; + background-size: 100% auto; + background-repeat: no-repeat; + position: fixed; + top: 0; + bottom: 0; + width: 100%; + z-index: -1; + } + + .productfeed-index-param{ + padding: 40rpx 30rpx 20rpx 30rpx; + .productfeed-index-param-title{ + display: flex; + flex-direction: row; + align-items: center; + margin-bottom: 30rpx; + .title-label{ + margin-left: 14rpx; + font-size: 34rpx; + font-weight: bold; + color: #283E65; + } + } + .productfeed-index-param-view{ + height: 300rpx; + background-color: #fff; + border-radius: 10rpx; + padding:0rpx 23rpx; + margin-bottom: 30rpx; + .productfeed-index-param-item{ + height: 100rpx; + border: 1px solid #ADC8E4; + line-height: 100rpx; + display:flex; + justify-content: space-between; + border: none; + .productfeed-index-param-item-left{ + .item-one{ + font-size: 30rpx; + color: #4F4F4F; + } + } + .productfeed-index-param-item-right{ + .item-one{ + font-size: 30rpx; + color: #333333; + margin-right: 6rpx; + } + .item-two{ + font-size: 30rpx; + color: #A6B4CC; + margin-right: 6rpx; + } + .item-three{ + font-size: 30rpx; + color: #214DED; + margin-right: 6rpx; + } + } + } + .param-extra{ + border-bottom: 1px solid #EDEDED; + } + } + } + + .productfeed-index-body-title{ + padding: 0rpx 30rpx 0rpx 30rpx; + margin-bottom: 32rpx; + display: flex; + flex-direction: row; + align-items: center; + .title-label{ + margin-left: 14rpx; + font-size: 34rpx; + font-weight: bold; + color: #283E65; + } + } + + .wrap .productfeed-index-scroll-list{ + height:calc(100vh - var(--window-top) - var(--window-bottom) - 756rpx); + width:100%; + } + .productfeed-index-scroll-list-group{ + ::v-deep .u-cell-item-box { + background-color:rgba(250,252,255,0.36) !important; + padding:0rpx 30rpx ; + } + .content { + font-size: 12px; + background-color: #FFFFFF; + box-sizing: border-box; + border-radius: 10rpx; + margin: 0rpx 0rpx 24rpx; + height: 332rpx; + padding: 10rpx 20rpx; + box-shadow:0rpx 6rpx 12rpx 2rpx rgba(127, 127, 127, 0.1) !important; + position:relative; + .content-header{ + .header-item{ + height: 50rpx; + display: flex; + align-items:center; + .content-header-icon-one{ + background-image: url('~@/static/custom/product/label-icon-1.png'); + background-size: 100% auto; + background-repeat: no-repeat; + height:28rpx; + width:28rpx; + } + .content-header-icon-two{ + background-image: url('~@/static/custom/product/label-icon-2.png'); + background-size: 100% auto; + background-repeat: no-repeat; + height:28rpx; + width:28rpx; + } + .content-header-title{ + margin-left: 11rpx; + font-size: 26rpx; + font-weight: bold; + color: #333333; + } + .content-header-title-ne{ + margin-left: 11rpx; + font-size: 26rpx; + color: #333333; + } + } + .header-item-toolbar{ + position: absolute; + background-image: url('~@/static/custom/product/del-icon.png'); + background-size: 100% auto; + background-repeat: no-repeat; + height:60rpx; + width:140rpx; + right:0; + top:0; + display: flex; + justify-content: flex-end; + padding-top: 10rpx; + padding-right: 18rpx; + .header-item-toolbar-del-icon{ + background-image: url('~@/static/custom/product/icon_dele.png'); + background-size: 100% auto; + background-repeat: no-repeat; + height:25rpx; + width:22rpx; + margin-top: 5rpx; + } + .header-item-toolbar-del-text{ + margin-left:7rpx; + height: 23rpx; + font-size: 24rpx; + color: #FFFFFF; + } + } + } + + .content-body{ + height:200rpx; + background: #F5F9FF; + border-radius: 10rpx; + padding: 25rpx 23rpx; + .row-list { + height: 50rpx; + display: flex; + flex-direction: row; + padding: 0px; + align-items: center; + justify-content: space-between; + } + .row-list ._label { + display: flex; + color: #666666; + font-size:26rpx; + align-items: center; + width: 170rpx; + } + + .row-list ._content { + text-align: right; + color: #909399; + font-size: 24rpx; + ._content-text{ + color:#214ded; + } + } + .row-list ._input { + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid #4FA0FF; + height: 56rpx; + .edit_icon{ + background-image: url('~@/static/custom/finishProductIn/icon_edit.png'); + background-size: 100% auto; + background-repeat: no-repeat; + height:26rpx; + width:26rpx; + } + ::v-deep .uni-input-input{ + color:#D35651; + } + } + } + } + } + + .productfeed-footer{ + padding: 0rpx 30rpx 0rpx 30rpx; + margin-bottom: 20rpx; + display: flex; + justify-content: space-between; + .btn-left{ + width: 310rpx; + height: 90rpx; + background: #DBE5F3; + border: 1px solid #BFCFE4 !important; + box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(110,120,135,0.3); + border-radius: 16rpx; + font-size: 40rpx; + font-weight: bold; + color: #404761; + } + .btn-left:after{ + border:none !important; + } + .btn-right{ + width: 310rpx; + height: 90rpx; + background: #214DED; + box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(4,49,212,0.3); + border-radius: 16rpx; + font-size: 40rpx; + font-weight: bold; + color: #FEFEFE; + } + } + .scan{ + width: 60rpx; + height: 60rpx; + font-size: 60rpx; + color: #3281ff; + } +</style> -- Gitblit v1.9.3