From b734a58af483fcf3e0234905bdaeafe81360cbe3 Mon Sep 17 00:00:00 2001
From: whycq <whycq>
Date: 星期二, 22 三月 2022 15:29:09 +0800
Subject: [PATCH] # wms - saas
---
pages/basics/comb.vue | 138 +++++++++++++++++++++++++++++++++------------
1 files changed, 100 insertions(+), 38 deletions(-)
diff --git a/pages/basics/comb.vue b/pages/basics/comb.vue
index 3c32ef4..319f7d1 100644
--- a/pages/basics/comb.vue
+++ b/pages/basics/comb.vue
@@ -3,7 +3,7 @@
<form>
<view class="cu-form-group margin-top">
<view class="title">鎵樼洏鐮�</view>
- <input v-model="code" placeholder="鎵爜 / 杈撳叆" name="input" @input="findCode" focus>
+ <input v-model="code" placeholder="鎵爜 / 杈撳叆" name="input" @input="findCode()" focus>
<button v-model="matBtn" class="cu-btn bg-yellow" @click="toggle('right')"><text>+鎻愬彇</text></button>
</view>
@@ -11,22 +11,28 @@
<view class="margin-top">
<uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁">
<uni-tr>
- <uni-th>鏁伴噺</uni-th>
- <uni-th>浜у搧浠e彿</uni-th>
- <uni-th>浜у搧鍚嶇О</uni-th>
+ <uni-th width="50">鏁伴噺</uni-th>
+ <uni-th width="100">浜у搧ID</uni-th>
+ <uni-th width="100">浜у搧鍚嶇О</uni-th>
</uni-tr>
- <uni-tr>
- <uni-td>1121</uni-td>
- <uni-td>1121</uni-td>
- <uni-td>1121</uni-td>
+ <uni-tr v-for="(item, index) in matData" :key="index" @input="tabRender()">
+ <uni-td>{{item.count}}</uni-td>
+ <uni-td>{{item.matNo}}</uni-td>
+ <uni-td>{{item.matName}}</uni-td>
</uni-tr>
</uni-table>
</view>
- <view>
- <button class="cu-btn bg-yellow pda-btn">缁勬墭</button>
- <button class="cu-btn bg-grey pda-btn" @click="reset">閲嶇疆</button>
+ <view style="height: 200rpx;">
+ <!-- 绌虹櫧灞� -->
</view>
+ <view class="cu-bar foot">
+ <view class="flex solid-bottom padding justify-start">
+ <button class="cu-btn bg-yellow lg margin-xs" style="width: 250rpx;" @click="comb()">缁� 鎵�</button>
+ <button class="cu-btn bg-grey lg margin-xs" @click="reset">閲� 缃�</button>
+ </view>
+ </view>
+
<view>
<!-- 鏅�氬脊绐� -->
<uni-popup ref="popup" background-color="#fff" style="width: 500rpx;">
@@ -36,7 +42,7 @@
</view>
<view class="cu-form-group margin-top">
<text class="title">浜у搧ID</text>
- <input type="text" v-model="matNo" placeholder="鎵爜 / 杈撳叆" name="input" autocomplete="off" focus @input="find">
+ <input type="text" v-model="matNo" placeholder="鎵爜 / 杈撳叆" name="input" autocomplete="off" focus @input="find()">
</view>
<view class="cu-form-group margin-top">
<text class="title">浜у搧鍚嶇О</text>
@@ -55,13 +61,14 @@
<uni-number-box @change="countDom" v-model="count" />
</view>
<button class="cu-btn bg-yellow pda-btn2" @click="confirm">鎻愬彇</button>
- <view>
- <!-- 鎻愮ず淇℃伅寮圭獥 -->
- <uni-popup ref="message" type="message">
- <uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
- </uni-popup>
- </view>
+
</view>
+ </uni-popup>
+ </view>
+ <view>
+ <!-- 鎻愮ず淇℃伅寮圭獥 -->
+ <uni-popup ref="message" type="message">
+ <uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
</view>
@@ -89,12 +96,11 @@
}
},
methods: {
- reset:function() {
+ reset() {
let that =this;
that.code = '';
- },
- idid(){
- alert(1)
+ that.matData=[];
+
},
toggle(type) {
this.type = type
@@ -104,7 +110,7 @@
countDom(value) {
},
- findCode(){ // 鎵樼洏鐮� 瓒呰繃8浣�
+ findCode(){ // 鏌ヨ鎵樼洏鐮� 瓒呰繃8浣�
let that = this;
if(that.code.length === 8){
that.toggle('right')
@@ -113,25 +119,24 @@
// 鏍规嵁浜у搧浠e彿鏌ヨ浜у搧璇︽儏
find(){
let that = this
- // if(isEmpty(that.matNo)){
- // return;
- // } isEmpty 鏈畾涔�
let thatId = that.matNo
if(that.matNo.length===0){
return;
}
uni.request({
- url:that.baseUrl+"/matCode/auth",
+ url: that.baseHttp + that.baseIP + that.baseUrl + "/matCode/auth",
+
header:{
'content-type':'application/x-www-form-urlencoded',
- 'token':localStorage.getItem('token'),
- },
+ 'token':uni.getStorageSync('token')
+ },
data:{
id:thatId
},
method:'POST',
success:function(res){
let data = res.data.data
+
if(res.data.code === 200){
if(data != null){
that.matName = data.matName
@@ -155,20 +160,18 @@
matName:that.matName,
count:that.count
}
-
- that.addTbaleData(data)
+ that.addTableData(data)
},
- addTbaleData(data){
+ // 娣诲姞琛ㄦ牸鏁版嵁
+ addTableData(data){
if(data.matName===''){
this.messageToggle('error')
return
}
this.$refs.popup.close()
- for(var i=0;i<this.matData.length;i++){
- console.log(data)
- console.log(this.data)
+ for(var i=0;i<this.matData.length;i++){
if(data.matNo === this.matData[i].matNo){
this.matData[i].count = Number(this.matData[i].count) + Number(data.count);
this.toPush = false;
@@ -178,15 +181,74 @@
this.matData.push(data)
}
this.messageToggle('success')
-
+ this.messageText = '鎻愬彇鎴愬姛'
+ this.matName=''
+ this.matNo=''
+ this.specs=''
+ this.count='0'
+ this.tabRender()
},
messageToggle(type) {
this.msgType = type
- this.messageText = `鎻愬彇澶辫触`
+ this.messageText = '鎻愬彇澶辫触'
this.$refs.message.open()
},
-
+ // 琛ㄦ牸娓叉煋
+ tabRender(){
+
+ },
+ // 缁勬墭
+ comb(){
+ let that = this
+ let barcode = that.code
+ if(barcode.length === 0){
+ that.messageToggle('error')
+ that.messageText = '鎵樼洏鏉$爜涓虹┖'
+ return;
+ }
+ if(barcode.length !== 8){
+ that.messageToggle('error')
+ that.messageText = '鏉$爜蹇呴』涓�8浣�'
+ return;
+ }
+ if (that.matData.length === 0) {
+ that.messageToggle('error')
+ that.messageText = '璇锋彁鍙栦骇鍝�'
+ return;
+ }
+ uni.request({
+
+ url: that.baseHttp + that.baseIP + that.baseUrl + "/mobile/comb/auth",
+ header:{
+ // #ifdef H5
+ 'token':uni.getStorageSync('token')
+ // #endif
+
+ // #ifdef APP-PLUS
+ 'token': uni.getStorageSync('token')
+ // Authorization:uni.getStorageSync('token')
+ // #endif
+ },
+ data:{
+ barcode:barcode,
+ combMats:that.matData
+ },
+ method:'POST',
+ success:function(res){
+ if(res.data.code===200){
+ that.reset()
+ that.messageToggle('success')
+ that.messageText = '缁勬墭鎴愬姛'
+ }else if(res.data.data===403){
+
+ }else {
+
+ }
+ }
+ })
+
+ }
}
}
</script>
--
Gitblit v1.9.1