From f01d077604d4cb07a556c32881301ef87a79a7c6 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期一, 18 九月 2023 09:17:59 +0800
Subject: [PATCH] #
---
pages/stock/stockCheck.vue | 141 +++++++++++++++++++++++------------------------
1 files changed, 69 insertions(+), 72 deletions(-)
diff --git a/pages/stock/stockCheck.vue b/pages/stock/stockCheck.vue
index cd83df3..614db9d 100644
--- a/pages/stock/stockCheck.vue
+++ b/pages/stock/stockCheck.vue
@@ -4,7 +4,7 @@
<view class="item">
<view class="code-decs">鎵樼洏鐮�:</view>
<input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus"
- @confirm="barcodeInput()">
+ @input="search()">
</view>
<view class="item">
<view class="code-decs">鐗╂枡鐮�:</view>
@@ -53,14 +53,14 @@
</view>
<view class="list-right">
<uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons>
- <uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons>
+ <!-- <uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons> -->
</view>
</view>
</scroll-view>
<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
<view class="buttom">
<button size="mini" @click="reset('warn')">閲嶇疆</button>
- <button size="mini" type="primary" @click="combConfirm('warn')">缁勬墭</button>
+ <button size="mini" type="primary" @click="combConfirm('warn')">纭</button>
</view>
<!-- 寮圭獥 -->
<!-- 淇敼鏁伴噺 -->
@@ -77,7 +77,7 @@
</view>
</view>
<view class="popup-item">
- <view class="popup-item-left">鍚堝悓鍙�:</view>
+ <view class="popup-item-left">鎵瑰彿:</view>
<view class="popup-item-right"><input type="text" v-model="batch"></view>
</view>
<view class="popup-item">
@@ -111,7 +111,7 @@
<view>
<uni-popup ref="combConfirm" type="dialog">
<uni-popup-dialog :type="msgType" cancelText="鍙栨秷" confirmText="纭" :title="title" :content="content"
- @confirm="comb" @close="combClose"></uni-popup-dialog>
+ @confirm="adjust" @close="combClose"></uni-popup-dialog>
</uni-popup>
</view>
<!-- 纭閲嶇疆 -->
@@ -159,23 +159,38 @@
this.msgType1 = type
this.$refs.message.open()
},
- // barcode input 浜嬩欢
- barcodeInput() {
- // 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
- setTimeout(() => {
- var len = this.barcode.length
- if (len != 8) {
- uni.showToast({
- title: '鎵樼洏鐮佹湁璇閲嶈瘯',
- icon: "none",
- position: 'top'
- });
- this.barcodeFocuss()
- return;
+ // 鏍规嵁鎵樼洏鐮佹悳绱�
+ search() {
+ let that = this
+ uni.request({
+ url: that.baseUrl + '/mobile/checkDetl/auth2',
+ header: {
+ 'token':uni.getStorageSync('token')
+ },
+ data: {barcode: that.barcode},
+ method:'GET',
+ success(res) {
+ console.log(res);
+ res = res.data
+ if(res.code === 200){
+ for(var i = 0; i < res.data.length;i++){
+ that.dataList.push(res.data[i])
+ }
+ } else if (res.code == 403) {
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../login/login'
+ });
+ }, 1000);
+ } else {
+ uni.showToast({title: res.msg, icon: "none",position: 'top'})
+ }
}
- this.focuss()
- }, 200)
+
+ })
},
+
// 鎵樼洏鐮佹湁璇噸缃�
barcodeFocuss() {
let that = this;
@@ -350,62 +365,11 @@
combConfirm(type) {
this.msgType = type
this.title = '璀﹀憡'
- this.content = '鏄惁鐜板湪缁勬墭!'
+ this.content = '鏄惁纭鐩樼偣!'
this.$refs.combConfirm.open()
},
combClose() {
this.$refs.combConfirm.close()
- },
- comb() {
- uni.vibrateShort();
- let that = this;
- if (that.barcode === '') {
- this.messageText = "璇锋壂鎻忔墭鐩樻潯鐮�"
- this.messageToggle('error')
- return;
- }
- if (that.dataList.length === 0) {
- this.messageText = "璇锋坊鍔犲晢鍝佸垪琛�"
- this.messageToggle('error')
- return;
- }
- for (var i = 0; i < that.dataList.length; i++) {
- if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
- this.messageText = that.dataList[i].matnr + '缁勬墭鏁伴噺涓嶈兘涓�0'
- this.messageToggle('error')
- return;
- }
- }
- uni.request({
- url: that.baseUrl + '/mobile/comb/auth',
- data: JSON.stringify({
- barcode: that.barcode,
- combMats: that.dataList
- }),
- method: 'POST',
- header: {
- 'token': uni.getStorageSync('token')
- },
- success(result) {
- var res = result.data
- if (res.code === 200) {
- that.resst();
- that.messageText = "缁勬墭鎴愬姛"
- that.messageToggle('success')
- } else if (res.code == 403) {
- that.messageText = res.msg
- that.messageToggle('error')
- setTimeout(() => {
- uni.reLaunch({
- url: '../login/login'
- });
- }, 1000);
- } else {
- that.messageText = res.msg
- that.messageToggle('error')
- }
- }
- });
},
reset(type) {
this.msgType = type
@@ -416,6 +380,7 @@
// 纭閲嶇疆
resetConfirm() {
this.dataList = []
+ this.barcode = ''
this.messageText = "閲嶇疆瀹屾垚"
this.messageToggle('success')
},
@@ -429,6 +394,38 @@
this.barcode = ''
this.barcodeFocuss()
},
+ adjust() {
+ let that = this
+ var combMats = []
+ var combParam = {}
+ combParam['barcode'] = that.barcode
+ combParam['wrkDetls'] = that.dataList
+ uni.request({
+ url: that.baseUrl + '/mobile/adjustNew/auth',
+ method: 'POST',
+ data: JSON.stringify(combParam),
+ header: {
+ 'token':uni.getStorageSync('token')
+ },
+ success(result) {
+ var res = result.data
+ if (res.code === 200) {
+ that.dataList = []
+ that.barcode = ''
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ } else if (res.code == 403) {
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../login/login'
+ });
+ }, 1000);
+ } else {
+ uni.showToast({title: res.msg, icon: "none",position: 'top'})
+ }
+ },
+ });
+ },
}
}
</script>
--
Gitblit v1.9.1