From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目
---
pages/wareHouse/packing/registration.vue | 579 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 579 insertions(+), 0 deletions(-)
diff --git a/pages/wareHouse/packing/registration.vue b/pages/wareHouse/packing/registration.vue
new file mode 100644
index 0000000..5f1dfb5
--- /dev/null
+++ b/pages/wareHouse/packing/registration.vue
@@ -0,0 +1,579 @@
+<template>
+ <view class="page">
+ <view class="packing-registration-bg"/>
+ <u-navbar title="鍖呰鐧昏" :background="background" :border-bottom="false" :title-bold="true" title-color="#000" back-icon-color="#000"/>
+ <view class="packing-registration-param">
+ <view class="packing-registration-param-view">
+ <view class="packing-registration-param-item param-extra">
+ <view class="packing-registration-param-item-left">
+ <text class="item-one">鍖呰浜�</text>
+ </view>
+ <view>
+ <text class="item-one" @click="showPackerName = true">{{registerInfo.packerNames}}</text>
+ </view>
+ <view class="packing-registration-param-item-right" >
+ <text class="item-one item-two" @click="seachPersonnelNo()">璇烽�夋嫨</text>
+ <u-icon name="arrow-right" color="#687792" size="28" @click="seachPersonnelNo()"></u-icon>
+ </view>
+ </view>
+ <view class="packing-registration-param-item param-extra">
+ <view class="packing-registration-param-item-left">
+ <text class="item-one">宸ュ彿</text>
+ </view>
+ <view class="packing-registration-param-item-right" >
+ <text class="item-one item-two" @click="showPackerName = true">{{registerInfo.packerNos}}</text>
+ </view>
+ </view>
+ <view class="packing-registration-param-item param-extra">
+ <view class="packing-registration-param-item-left">
+ <text class="item-one">鐝</text>
+ </view>
+ <view class="packing-registration-param-item-right" >
+ <picker class="item-one item-two" @change="shiftNumBindChange($event,shiftList)" :value="shiftNumIndex" :range="shiftList"
+ range-key="value">
+ <view>
+ <text>{{shiftNumIndex==null ? "璇烽�夋嫨":shiftList[shiftNumIndex].value}}</text>
+ </view>
+ </picker>
+ <u-icon name="arrow-right" color="#687792" size="28"></u-icon>
+ </view>
+ </view>
+ <view class="packing-registration-param-item param-extra">
+ <view class="packing-registration-param-item-left">
+ <text class="item-one">鍖呰鏃ユ湡</text>
+ </view>
+ <view class="packing-registration-param-item-right"@click="openDatePicker()">
+ <text class="item-one item-two" >{{registerInfo.packageDate=='' ? "璇烽�夋嫨":registerInfo.packageDate}}</text>
+ <u-icon name="arrow-right" color="#687792" size="28"></u-icon>
+ <u-calendar v-model="showPackageDatePicker" mode="date" @change="choseDate" max-date="2030-12-31" :mask-close-able="true"></u-calendar>
+ </view>
+ </view>
+ <view class="packing-registration-param-item param-extra">
+ <view class="packing-registration-param-item-left">
+ <text class="item-one">鍖呰搴撲綅</text>
+ </view>
+ <view class="packing-registration-param-item-right" >
+ <picker class="item-one item-two" @change="locNoNumBindChange($event,locNoList)" :value="locNoNumIndex" :range="locNoList"
+ range-key="value">
+ <view>
+ <text>{{locNoNumIndex==null ? "璇烽�夋嫨":locNoList[locNoNumIndex].value}}</text>
+ </view>
+ </picker>
+ <u-icon name="arrow-right" color="#687792" size="28"></u-icon>
+ </view>
+ </view>
+ </view>
+ </view>
+ <view class="wrap">
+ <u-popup v-model="showPackerName" mode="center" :closeable="true" class="packer-popup">
+ <view>
+ <view style="height:800rpx; width: 600rpx; padding: 60rpx 40rpx 40rpx 40rpx;">
+ <view style="padding-top: 20rpx;">
+ <view v-for="(item,index) in staffNameList" :key="item.staffNo" class="packer-namelist">
+ <view class="popup-row">
+ <view style="display: flex;align-items: flex-start;">
+ <view style="font-size: 30rpx;">{{item.staffNo}}</view>
+ <view style="font-size: 30rpx;margin-left: 14rpx;">{{item.staffName}}</view>
+ </view>
+ <view style="color: red; font-size: 30rpx;" @click="del(index)">鍒犻櫎</view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ </u-popup>
+ <view style="padding:0rpx 30rpx;margin-bottom:30rpx;height: 26rpx;line-height: 26rpx;font-size:28rpx;color:#6D82A1;">
+ <view>鍖呰鍒楄〃</view>
+ </view>
+ <scroll-view class="packing-registration-scroll-list" scroll-y="true">
+ <u-cell-group class="packing-registration-scroll-list-group" :border="false">
+ <div class="tip" style="text-align: center;" v-if="hasScanSnList.length==0">-璇锋壂鐮�-</div>
+ <view class="content" v-for="(x, index) in hasScanSnList" :key="index" :index="index">
+ <view class="row-list">
+ <view class="row-list-left">
+ <view class="num-icon" style="color: #fff;">{{index+1}}</view>
+ <view style="margin-left: 30rpx;">{{x}}</view>
+ </view>
+ <view class="row-list-right" @click="goMinus(index,x)">
+ <view class="del-icon"></view>
+ <view style="margin-left: 14rpx;">鍒犻櫎</view>
+ </view>
+ </view>
+ </view>
+ </u-cell-group>
+ </scroll-view>
+ <view class="registration-form-footer">
+ <u-button class="btn" type="primary" @click="goSubmit">鎻愪氦</u-button>
+ </view>
+ <scan></scan>
+ <u-modal v-model="showConfirm" :content="delContent" @confirm="confirm" :show-cancel-button="true"/>
+
+ </view>
+ </view>
+</template>
+<script>
+ import scan from "@/components/scan/scan.vue";
+ import content_bg from '@/static/custom/packing/backBg.png'
+ export default {
+ components: { scan },
+ data() {
+ return {
+ background:{
+ backgroundImage: `url(${content_bg})`,
+ backgroundAttachment: 'fixed',
+ backgroundSize: '100% auto',
+ backgroundRepeat: 'no-repeat',
+ },
+ labelStyle:{
+ fontSize:'32rpx',
+ whiteSpace:'nowrap'
+ },
+ registerInfo:{
+ partBatchNo:'',
+ packageDate:'',
+ shiftId:'',
+ shiftName:'',
+ locNo:'',
+ packerName:'',
+ packerNo:'',
+ packerNos:'',
+ packerNames:''
+ },
+ hasScanSnList:[],
+ shiftList:[],
+ shiftNumIndex:null,
+ showPackageDatePicker:false,
+ params:{year: true,
+ month: true,
+ day: true,
+ },
+ locNoList:[],
+ locNoNumIndex:null,
+ delIndex:null,
+ delContent:null,
+ showConfirm:false,
+ staffList:[],
+ showPackerName:false,
+ PackerNameList:[],
+ staffNameList:[]
+ };
+ },
+ onLoad(option) {
+ //TODO
+ // this.getCurrDate()
+ },
+ onShow() {
+
+ let that = this
+
+ uni.$off('scan') // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒
+ uni.$on('scan', function(data) {
+ console.log('onscan');
+ //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲�
+ console.log('鎵爜缁撴灉锛�', data.code);
+ that.scanHandle(data.code)
+ that.$forceUpdate();
+
+ })
+ },
+ onNavigationBarButtonTap(){
+ this.goScan()
+ },
+ onReady() {
+ this.loadShiftList()
+ this.loadLocNoList()
+ this.loadUserInfo()
+ },
+ methods: {
+ //浜哄憳
+ seachPersonnelNo() {
+ uni.navigateTo({
+ url: '/pages/wareHouse/packing/personnelList'
+ })
+ },
+ setNo(ids) {
+ ids.forEach((item) => {
+ this.PackerNameList.push({
+ staffName:item.split(',')[1],
+ staffNo:item.split(',')[2],
+ id:Number(item.split(',')[0])
+ })
+ })
+
+ this.staffNameList = []
+ for (let i = 0; i < this.PackerNameList.length; i++) {
+ if (!this.staffNameList.some(e => e.id == this.PackerNameList[i].id)) this.staffNameList.push(this.PackerNameList[i]);
+ }
+ this.PackerNameList = this.staffNameList
+ this.registerInfo.packerNames = this.registerInfo.packerName + `绛�${this.staffNameList.length}浜篳
+ this.registerInfo.packerNos = this.registerInfo.packerNo + `绛�${this.staffNameList.length}浜篳
+ console.log(this.staffNameList);
+ },
+ del(index) {
+ this.staffNameList.splice(index,1)
+ this.registerInfo.packerNames = this.registerInfo.packerName + `绛�${this.staffNameList.length}浜篳
+ this.registerInfo.packerNos = this.registerInfo.packerNo + `绛�${this.staffNameList.length}浜篳
+ if (this.staffNameList.length < 1) {
+ this.registerInfo.packerNames = this.registerInfo.packerName
+ this.registerInfo.packerNos = this.registerInfo.packerNo
+ }
+ console.log(this.staffNameList);
+ },
+ goScan(){
+ uni.scanCode({
+ scanType: ['qrCode'],
+ success: res => {
+ try {
+ console.log('鎵爜缁撴灉锛�', res);
+ this.scanHandle(res.result)
+ } catch (e) {}
+ }
+ });
+ },
+ scanHandle(scanresult){
+ scanresult = scanresult.replace(/[\r\n]/g, "")
+ if (scanresult.indexOf('{')>-1) {
+ //浜岀淮鐮�
+ const result = JSON.parse(scanresult)
+ //澧炲姞SN鏍¢獙
+ if(result.sn_no && result.sn_no!=null && result.sn_no!=''){
+ if(this.hasScanSnList.length>0){
+ let hasScanSnIndex=this.hasScanSnList.indexOf(result.sn_no)
+ if(hasScanSnIndex<0){
+ this.hasScanSnList.push(result.sn_no)
+ }else{
+ this.$u.toast('璇峰嬁閲嶅鎵弿')
+ }
+ }else{
+ this.hasScanSnList.push(result.sn_no)
+ }
+ }
+
+ } else {
+ //澧炲姞SN鏍¢獙
+ if(this.hasScanSnList.length>0){
+ let hasScanSnIndex=this.hasScanSnList.indexOf(scanresult)
+ if(hasScanSnIndex<0){
+ this.hasScanSnList.push(scanresult)
+ }else{
+ this.$u.toast('璇峰嬁閲嶅鎵弿')
+ }
+ }else{
+ this.hasScanSnList.push(scanresult)
+ }
+ }
+ },
+ confirm(){
+ this.hasScanSnList.splice(this.delIndex, 1)
+ },
+ goMinus(i,item){
+ this.delContent='纭鍒犻櫎SN鍙凤細'+item
+ this.delIndex=i
+ this.showConfirm=true
+
+ },
+ goSubmit() {
+ if(this.registerInfo.shiftId==null || this.registerInfo.shiftId==''){
+ this.$u.toast('璇烽�夋嫨鐝')
+ return
+ }
+ if(this.registerInfo.packageDate==null || this.registerInfo.packageDate==''){
+ this.$u.toast('璇烽�夋嫨鏃ユ湡')
+ return
+ }
+ if(this.registerInfo.locNo==null || this.registerInfo.locNo==''){
+ this.$u.toast('璇烽�夋嫨鍖呰搴撲綅')
+ return
+ }
+ if(this.hasScanSnList.length==0){
+ this.$u.toast('鏃犲緟鎻愪氦鐨凷N鍙锋槑缁�')
+ return
+ }
+ let registrList=[]
+ this.staffList = []
+ this.staffNameList.forEach((item) => {
+ this.staffList.push(
+ {
+ staffId: item.id
+ }
+ )
+ })
+ this.hasScanSnList.forEach((item)=>{
+ registrList.push({
+ shiftId:this.registerInfo.shiftId,
+ packageDate:this.registerInfo.packageDate,
+ locNo:this.registerInfo.locNo,
+ partBatchNo:item,
+ staffList:this.staffList
+ })
+ })
+ /*uni.showLoading({
+ title: '姝e湪鎻愪氦...',
+ mask: true
+ }); */
+ this.$u.api.pigxPacking.addPackageRegister(registrList).then(res => {
+ let resData=res.data
+ this.hasScanSnList=[]
+ //uni.hideLoading();
+ this.$u.toast('鎻愪氦鎴愬姛')
+ }).catch((e) => {
+ //uni.hideLoading();
+ })
+
+ },
+ loadShiftList(){
+ this.shiftList=[]
+ this.$u.api.pigxPacking.getShiftList({current:1,size:10}).then(res => {
+ let shiftList=res.data.records
+ if (shiftList.length > 0) {
+ shiftList.map((item, index) => {
+ let shift = {
+ label: item.id,
+ value: item.name
+ }
+ this.shiftList.push(shift)
+ });
+ }
+ })
+ },
+ loadLocNoList(){
+ this.locNoList=[]
+ this.$u.api.dictData({dictType:'package_loc_no'}).then(res => {
+ let locNoList=res.data
+ if (locNoList.length > 0) {
+ locNoList.map((item, index) => {
+ let locNo = {
+ label: item.value,
+ value: item.label
+ }
+ this.locNoList.push(locNo)
+ });
+ }
+ })
+ },
+ locNoNumBindChange(e,storage){
+ if (storage.length <= 0) {
+ this.locNoNumIndex = null
+ return
+ }
+ this.locNoNumIndex = e.target.value
+ this.registerInfo.locNo = storage[this.locNoNumIndex].label
+ console.log('locNoNumIndex',this.registerInfo.locNo)
+ },
+ loadUserInfo(){
+ this.registerInfo.packerName=''
+ this.registerInfo.packerNames=''
+ this.registerInfo.packerNo=''
+ this.registerInfo.packerNos=''
+ /*this.$u.api.pigxPacking.getCurrUser().then(res => {
+ let resData=res.data
+ this.registerInfo.packerName=resData.staffName
+ this.registerInfo.packerNames=resData.staffName
+ this.registerInfo.packerNo=resData.staffNo
+ this.registerInfo.packerNos=resData.staffNo
+ console.log(res);
+ }).catch((e) => {
+
+ })*/
+ },
+ openDatePicker(){
+ this.showPackageDatePicker=true
+ this.staffList = []
+ this.staffNameList.forEach((item) => {
+ this.staffList.push(
+ {
+ staffId: item.id
+ }
+ )
+ })
+ console.log(this.staffList);
+ },
+ choseDate(date){
+ this.registerInfo.packageDate = date.result
+ },
+ shiftNumBindChange(e,storage){
+ if (storage.length <= 0) {
+ this.shiftNumIndex = null
+ return
+ }
+ this.shiftNumIndex = e.target.value
+ this.registerInfo.shiftId = storage[this.shiftNumIndex].label
+ this.registerInfo.value = storage[this.shiftNumIndex].value
+ },
+ // getCurrDate(){
+ // let date = new Date()
+ // let year = date.getFullYear()
+ // let month = date.getMonth() + 1
+ // let day = date.getDate();
+ // month = (month > 9)?month:("0" + month)
+ // day = (day < 10)?("0" + day):day
+ // this.registerInfo.packageDate = year + "-" + month + "-" + day
+ // }
+ }
+ };
+</script>
+<style lang="scss" scoped>
+.packing-registration-bg{
+ background-color: #F6F9FF;
+ background-image: url('~@/static/custom/packing/backBg.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;
+ }
+
+ .packing-registration-param{
+ padding: 40rpx 30rpx 10rpx 30rpx;
+ .packing-registration-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;
+ }
+ }
+ .packing-registration-param-view{
+ height: 450rpx;
+ background-color: #fff;
+ border-radius: 10rpx;
+ padding:0rpx 23rpx;
+ margin-bottom: 30rpx;
+ .packing-registration-param-item{
+ height: 90rpx;
+ border: 1px solid #ADC8E4;
+ line-height: 90rpx;
+ display:flex;
+ justify-content: space-between;
+ border: none;
+ .packing-registration-param-item-left{
+ .item-one{
+ font-size: 30rpx;
+ color: #666666;
+ }
+ }
+ .packing-registration-param-item-right{
+ display:flex;
+ justify-content: space-between;
+ .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;
+ }
+ }
+ }
+ .wrap .packing-registration-scroll-list{
+ height:calc(100vh - var(--window-top) - var(--window-bottom) - 824rpx);
+ width:100%;
+ }
+ .packing-registration-scroll-list-group{
+ ::v-deep .u-cell-item-box {
+ background-color:rgba(250,252,255,0.36) !important;
+ padding:0rpx 30rpx ;
+ }
+ .content {
+ background-image: url('~@/static/custom/packing/row_bg.png');
+ background-size: 100% auto;
+ background-repeat: no-repeat;
+ height:89rpx;
+ width:691rpx;
+ font-size: 12px;
+ background-color: #FFFFFF;
+ box-sizing: border-box;
+ border-radius: 10rpx;
+ margin: 0rpx 0rpx 20rpx;
+ padding: 0rpx 50rpx 0rpx 32rpx;
+ box-shadow: none;
+ .row-list{
+ height: 100%;
+ display: flex;
+ justify-content: space-between;
+ align-items:center;
+ padding-top: 0rpx !important;
+ .row-list-left{
+ display: flex;
+ color: #333333;
+ .num-icon{
+ background-image: url('~@/static/custom/packing/num-bg.png');
+ background-size: 100% auto;
+ background-repeat: no-repeat;
+ height:38rpx;
+ width:38rpx;
+ text-align: center;
+ line-height: 38rpx;
+ }
+ }
+ .row-list-right{
+ display: flex;
+ color: #428BF7;
+ .del-icon{
+ background-image: url('~@/static/custom/packing/icon_dele.png');
+ background-size: 100% auto;
+ background-repeat: no-repeat;
+ height:30rpx;
+ width:28rpx;
+ }
+ }
+ }
+ }
+ }
+ .registration-form-footer{
+ display: flex;
+ margin-top: 10rpx;
+ margin-bottom: 10rpx;
+ margin-left: 20rpx;
+ margin-right: 20rpx;
+ padding-bottom: 14rpx;
+ .btn {
+ flex: 1;
+ margin: 10rpx;
+ background: #214DED;
+ box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(4,49,212,0.3);
+ font-weight: bold;
+ color: #FEFEFE;
+ font-family: PingFang SC;
+ }
+ }
+
+ .packer-popup{
+ ::v-deep .u-mode-center-box{
+ border-radius: 30rpx;
+ }
+ .popup-row{
+ background-image: url('~@/static/custom/packing/row_bg.png');
+ background-size: 100% auto;
+ background-repeat: no-repeat;
+ height:89rpx;
+ width:520rpx;
+ display: flex;
+ justify-content: space-between;
+ padding-top:12rpx;
+ padding-left: 14rpx;
+ padding-right: 20rpx;
+ }
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.3