From 9ab6b38c098f857f2ce0772693142c930e4f9b6d Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期六, 30 三月 2024 10:44:03 +0800 Subject: [PATCH] # --- pages/project/pakin/pakin.vue | 267 ++++++++++++++++++++++++++-------------------------- 1 files changed, 134 insertions(+), 133 deletions(-) diff --git a/pages/project/pakin/pakin.vue b/pages/project/pakin/pakin.vue index e07fa62..7673354 100644 --- a/pages/project/pakin/pakin.vue +++ b/pages/project/pakin/pakin.vue @@ -1,33 +1,52 @@ <template> <view> <view class="head"> - <z-input v-for="it in page" - :desc="it.title" - :name="it.name" - :btn="it.btn" - :btn-name="it.btnName" - v-model="it.val" - :index="it.id" - :lenCheck="it.lenCheck" - :focus="it.focus" - @inputVal='input2' - ></z-input> + <z-input :desc="input1.title" + :name="input1.name" + :btn="input1.btn" + :btn-name="input1.btnName" + v-model="barcode" + :index="input1.id" + :lenCheck="input1.lenCheck" + :focus="barcodeFocus" + @inputVal='barcodeInput' + /> + <z-input :desc="input2.title" + :name="input2.name" + :btn="input2.btn" + :btn-name="input2.btnName" + v-model="matnr" + :index="input2.id" + :lenCheck="input2.lenCheck" + :focus="matnrFocus" + @inputVal='matnrInput' + /> </view> + <u-sticky > - <view class="sticky">鍟嗗搧鍒楄〃</view> + <view class="sticky"> + <view class="flex1">寮�鍚敭鐩�</view> + <view class="flex1">鍟嗗搧鍒楄〃</view> + <view class="flex1"></view> + </view> </u-sticky> <z-data-list class="data-list" v-for="(it,i) in zDataList" :key="i" - :list="it.detl" + :lable="lable" + :fields="it" :index="i+1" - @goDetail='goDetail(it.detl,i)' + @goDetail='goDetail(it,i)' ></z-data-list> - <!-- 鍨珮 --> - <view style="height: 100rpx;"></view> + <view style="height: 100rpx;" /> + + <view class="z-floor"> + <view class="z-default" @click="clean">閲嶇疆</view> + <view class="z-primary" @click="comb">缁勬墭</view> + </view> </view> </template> @@ -35,151 +54,133 @@ <script> import { mapState } from 'vuex' import addMat from '@/pages/api/addMat.js' + import util from '@/static/js/util.js' export default { data() { return { - zDataList: [ - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 1}, - ] - }, - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 2}, - ] - }, - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 3}, - ] - }, - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 4}, - ] - }, - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 5}, - ] - }, - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 1}, - ] - }, - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 2}, - ] - }, - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 3}, - ] - }, - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 4}, - ] - }, - { - detl: [ - {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, - {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�'}, - {key: '瑙勬牸',value: '700*699*80'}, - {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, - {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, - {key: '搴忓彿',value: 5}, - ] - } - ], - list: [ - {} - ] + zDataList: [], + barcode: '', + matnr: '', + inputCode: '鎵樼洏鐮�', + barcodeFocus: true, + matnrFocus: false } }, onShow() { - console.log(this.page); + // console.log(this.page); }, computed: mapState({ - page: state => state.project.menu[0].page.input + input1: state => state.project.menu[0].page.input[0], + input2: state => state.project.menu[0].page.input[1], + xInput: state => state.project.menu[0].page.input1, + lable: state => state.project.menu[0].page.lable }), methods: { - input2(arr) { - if(arr[1] == 'matnr') { - this.getMat(arr[0]) + barcodeInput(arr) { + this.barcodeFocus = false + setTimeout(()=>{ + this.matnrFocus = true + },10) + }, + matnrInput(arr) { + if(arr.title == 'matnr') { + this.getMat(arr.value) } }, + goDetail(param,index) { + let _this = this + uni.navigateTo({ + url: '/pages/common/data-list/dataDetail', + // 浼� + success: function(data) { + data.eventChannel.emit('param', { + param: param, + index: index + }) + }, + // 鎺� + events: { + dataList: function(data) { + console.log(data); + }, + del: function(data) { + _this.zDataList.splice(data.data,1) + } + }, + }) + }, + // 鑾峰彇鐗╂枡 async getMat(matnr) { - let mat = await addMat.addMat() - if (!addMat.isEmpty(mat)) { - this.zDataList.push(mat) + let res = await addMat.addMat(matnr) + if (res.code === 200 && res.data) { + this.matPick(res.data) + // res.data['count'] = 1 + // this.zDataList = util.matCheck(res.data,this.zDataList) + this.matnr = '' + } else if (res.code === 200 && !res.data) { + let msg = `${this.matnr} 鐗╂枡寮傚父锛岃閲嶈瘯` + uni.showToast({ title: msg, icon: "none", position: 'top' }) + } else if (res.code == 403) { + uni.showToast({ title: res.msg, icon: "none", position: 'top' }) + setTimeout(() => { + uni.reLaunch({ + url: '../../LoginDemo/LoginDemo' + }); + }, 1000); + } else { + uni.showToast({ title: res.msg, icon: "none", position: 'top' }) } }, + // 璺宠浆鐗╂枡鎻愬彇椤甸潰 + matPick(mat) { + let _this = this + uni.navigateTo({ + url: '/pages/common/mat/matPick', + // 浼� + success: function(data) { + data.eventChannel.emit('mat', { + mat: mat, + }) + }, + // 鎺� + events: { + matList: function(data) { + data.data['count'] = 1 + let newList = util.matCheck(data.data,_this.zDataList) + _this.zDataList = '' + _this.zDataList = newList + }, + }, + }) + }, + // 缁勬墭 + comb() { + console.log(this.barcode); + console.log(this.zDataList); + }, + clean() { + + } + } } </script> <style> .head { - background-color: #f8f8f8; - margin-top: -8px; + /* margin-top: -8px; */ } .sticky { height: 70rpx; - margin-top: -8px; + box-shadow: 0px 4px 4px #e2e2e2; text-align: center; - background-color: #f8f8f8; + background-color: #fff; display: flex; align-items: center; justify-content: center; } + .flex1 { + flex: 1 + } </style> -- Gitblit v1.9.1