From dcb4247056504024bdb9f685776e27e45d174b67 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期一, 09 五月 2022 23:17:04 +0800
Subject: [PATCH] ##
---
pages/basics/checkout.vue | 273 ++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 214 insertions(+), 59 deletions(-)
diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue
index fc747d0..7512b4c 100644
--- a/pages/basics/checkout.vue
+++ b/pages/basics/checkout.vue
@@ -1,19 +1,57 @@
<template>
<view >
<scroll-view scroll-y catch:touchmove="touchmove">
- <view class="pak-seach-box">
+ <view class="square-2">
+ <view class="square-title">
+ <view class="title-sign"><view class="sign"></view></view>
+ <view class="title-text"><text>鎵樼洏鏉$爜</text></view>
+ </view>
+ <view class="square-content">
+ <view class="content-input">
+ <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8"
+ @input="findBarcode()" :focus="barcodeFocus" >
+ <!-- @focus="focuss" -->
+ <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons>
+ </view>
+ </view>
+ </view>
+ <!-- <view class="pak-seach-box">
<view class="box-top">
<view class="color-block-blue"></view>
<text class="title">鎵樼洏鏉$爜</text>
</view>
<view class="box-buttom">
- <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆">
+ <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8" @input="findBarcode()">
<view class="search-icon">
<uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeBarcode()"></uni-icons>
</view>
</view>
+ </view> -->
+
+ <view class="square-3">
+ <view class="square-title">
+ <view class="title-sign"><view class="sign"></view></view>
+ <view class="title-text"><text>璐у搧鏉$爜</text></view>
+ </view>
+ <view class="square-content">
+ <text>绔欏彴锛�</text>
+ <view class="content-combox">
+ <uni-combox emptyTips="鏆傛棤鏁版嵁" :candidates="siteList" v-model="desc" placeholder="绔欏彴鍙�"
+ @input="choseStaNo"></uni-combox>
+ </view>
+ </view>
+ <view class="square-content">
+ <text>璐у搧鏉$爜锛�</text>
+ <view class="content-input-combox">
+ <input type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()"
+ :focus="focus" >
+ <!-- @focus="focuss" -->
+ <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons>
+ </view>
+ </view>
</view>
- <view class="pak-seach-box">
+
+ <!-- <view class="pak-seach-box">
<view class="box-top">
<view class="color-block-blue"></view>
<text class="title">璐у搧鏉$爜</text>
@@ -24,24 +62,26 @@
<uni-icons type="closeempty" size="20" color="#a5a5a5" @click="removeMatnr()"></uni-icons>
</view>
</view>
- <button class="cu-btn bg-blue" @click="selectMat()">+鎻愬彇</button>
- </view>
- <view class="pak-data-box">
- <view class="box-top">
- <view class="color-block-blue"></view>
- <text class="title">鍟嗗搧鍒楄〃</text>
+ <view class="combox">
+ <uni-combox emptyTips="鏆傛棤鏁版嵁" :candidates="staNoList" v-model="staNo" placeholder="绔欏彴鍙�"></uni-combox>
+ </view>
+ </view> -->
+ <view class="square-1">
+ <view class="square-title">
+ <view class="title-sign"><view class="sign"></view></view>
+ <view class="title-text"><text>鍟嗗搧鍒楄〃</text></view>
</view>
</view>
- <view class="pak-data-box" v-show="matList.length === 0">
- <view style="text-align: center;">鏆傛棤鏇村鏁版嵁</view>
+ <view class="square-none" v-show="matList.length === 0">
+ <view class="v-show">鏆傛棤鏇村鏁版嵁...</view>
</view>
+ <!-- <view class="pak-data-box" v-show="matList.length === 0">
+ <view style="text-align: center;">鏆傛棤鏇村鏁版嵁</view>
+ </view> -->
<checkbox-group @change="checkbox">
<view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
<view class="data-list-left">
- <view class="matnr"><text style="width: 400rpx;">缂栫爜锛歿{item.matnr}}</text></view>
- <view><text style="width: 400rpx;">鍝佸悕锛歿{item.maktx}}</text></view>
- <view><text style="width: 400rpx;">鎵瑰彿锛歿{item.batch}}</text></view>
- <view><text style="width: 400rpx;">鏁伴噺锛歿{item.anfme}}</text></view>
+ <view class="matnr">{{item.matnr}}-{{item.batch}}</view>
</view>
<view class="data-list-right">
<uni-icons type="trash" size="25" color="#a5a5a5" @click="remove(item,index)"></uni-icons>
@@ -54,7 +94,7 @@
<button class="cu-btn lg" @click="resst()">閲嶇疆</button>
</view>
<view>
- <button class="cu-btn lg pakin-btn bg-blue" @click="comb()">缁勬墭</button>
+ <button class="cu-btn lg pakin-btn bg-blue" @click="comb()">纭</button>
</view>
</view>
</view>
@@ -66,12 +106,18 @@
data() {
return {
barcode: '',
+ barcodeFocus:true,
+ focus:false,
type: 'center',
searchBox: 'hide',
pick:'hide',
matnr:'',
matList:[],
- result: ''
+ result: '',
+ siteList:[],
+ desc:'',
+ staNoList:[],
+ satNo:'',
}
},
mounted(){
@@ -79,21 +125,41 @@
this.baseIP = UIP;
const UPORT = uni.getStorageSync('UPORT');
this.basePORT = UPORT
+ this.getOutBound();
},
methods: {
+ choseStaNo() {
+ for (var i = 0;i < this.staNoList.length; i++) {
+ if (this.desc == this.staNoList[i].desc) {
+ this.staNo = this.staNoList[i].siteId
+ }
+ }
+ },
+ focuss() {
+ uni.hideKeyboard()
+ },
resst() {
this.matList = []
this.barcode = ''
this.matnr = ''
+ this.desc = ''
uni.vibrateShort();
},
removeBarcode() {
this.barcode = ''
- uni.vibrateShort();
+ uni.vibrateShort();
+ this.barcodeFocus = false;
+ this.$nextTick(function() {
+ this.barcodeFocus = true;
+ });
},
removeMatnr() {
this.matnr = ''
uni.vibrateShort();
+ this.focus = false;
+ this.$nextTick(function() {
+ this.focus = true;
+ });
},
remove(item,index) {
this.matList.splice(index,1)
@@ -102,21 +168,18 @@
comb() {
uni.vibrateShort();
let that = this;
- if (that.barcode === '') {
- uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'});
- return;
- }
- if (that.matList.length === 0) {
- uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'});
- return;
- }
+ // if (that.barcode === '') {
+ // uni.showToast({title: '璇锋壂鎻忔墭鐩樻潯鐮�', icon: "none", position: 'top'});
+ // return;
+ // }
+ // if (that.matList.length === 0) {
+ // uni.showToast({title: '璇锋坊鍔犲晢鍝佸垪琛�', icon: "none", position: 'top'});
+ // return;
+ // }
uni.showLoading();
uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth',
- data: JSON.stringify({
- barcode: that.barcode,
- combMats: that.matList
- }),
+ url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/auth',
+ data: that.matList,
method: 'POST',
header: {
'token':uni.getStorageSync('token')
@@ -130,6 +193,10 @@
position: 'bottom',
duration: 1000
});
+ that.matList = []
+ that.barcode = ''
+ that.matnr = ''
+ that.desc = ''
} else if (res.code == 403) {
uni.showToast({title: res.msg, icon: "none", position: 'top'})
setTimeout(() => {
@@ -166,39 +233,118 @@
findMat() {
let that = this
uni.request({
- url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth',
+ url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth',
data: {
+ staNo:that.staNo,
matnr:that.matnr
},
header: {
'token':uni.getStorageSync('token')
},
success(result) {
- uni.vibrateShort();
- let res = result.data
- if (res.code === 200 && res.data) {
- that.matData = res.data
- uni.navigateTo({
- url: "matQuery",
- events: {
- // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
- matList: function(data) {
- that.matList.push(data.data)
- },
- },
- success: function(res) {
- // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
- res.eventChannel.emit('matData', { data: that.matData })
- }
- });
+
+ var res = result.data;
+ if(res.data) {
+ for(let i = 0;i<that.matList.length;i++) {
+ for (let j = 0;j < res.data.length; j++) {
+ if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) {
+ res.data.splice(j,1)
+ }
+ }
+ }
+ that.matList = res.data.concat(that.matList)
+ // that.matList = that.matList.concat(res.data)
+ }
+ }
+ });
+ },
+ addMatList(mat) {
+ console.log(mat)
+ if (this.matList.length == 0){
+
+ // this.matList.push(mat[0])
+ // this.matList.prototype.push.apply(mat)
+ } else {
+
+ let toUnshift = true
+ for (var i = 0; i < this.matList.length; i++) {
+ let matnr = this.matList[i].matnr
+ if (matnr == this.matList[i].matnr) {
+ // this.messageToggle('warn')
+ // this.messageText = matnr + '宸茬粡鎵弿锛岃鍕块噸澶嶆壂鎻�'
+ toUnshift = false
+ }
+ }
+ if (toUnshift) {
+ this.matList.unshift(mat[0])
+ }
+
+ }
+ console.log(this.matList)
+ },
+ findBarcode() {
+ let that = this
+ uni.request({
+ url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth',
+ data: {
+ barcode:that.barcode
+ },
+ header: {
+ 'token':uni.getStorageSync('token'),
+
+ },
+ success(result) {
+ var res = result.data;
+ console.log(res)
+ if(res.data) {
+ for(let i = 0;i<that.matList.length;i++) {
+ for (let j = 0;j < res.data.length; j++) {
+ if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) {
+ res.data.splice(j,1)
+ }
+ }
+ }
+ that.matList = res.data.concat(that.matList)
+ // that.matList = that.matList.concat(res.data)
}
}
});
+
},
-
+ getOutBound() { // 鑾峰彇鍑哄簱鍙�
+ let that = this
+ uni.request({
+ url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/available/take/site',
+ method: 'POST',
+ header: {
+ 'token':uni.getStorageSync('token')
+ },
+ success(result) {
+ var res = result.data
+ if (res.code === 200) {
+ for (var i = 0; i < res.data.length; i++){
+ that.siteList.push(res.data[i].desc)
+ }
+ that.staNoList = res.data
+ } 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'})
+ }
+ },
+ });
+ }, // getOutBound
+ getCheckDetl() { // 鑾峰彇鍑哄簱鍙h揣鐗╀俊鎭�
+ let that = this
+
+ }, // getCheckDetl
change(e) {
- console.log('褰撳墠妯″紡锛�' + e.type + ',鐘舵�侊細' + e.show);
},
toggle(type) {
this.type = type
@@ -267,7 +413,7 @@
}
.box-buttom {
display: inline-block;
- background-color: #ededed;
+ background-color: #f0f0f0;
width: 65%;
height: 60rpx;
border-radius: 20rpx;
@@ -285,6 +431,7 @@
margin-top: 5rpx;
margin-right: 10rpx;
}
+
/* .pak-seach-box input {
background-color: #ededed;
border: 1rpx solid #d8d8d8;
@@ -330,7 +477,7 @@
}
.data-list {
border-bottom: 1px solid #d8d8d8;
- height: 180rpx;
+ height: 130rpx;
margin: 15rpx;
border-radius: 20rpx;
}
@@ -349,20 +496,28 @@
line-height: 180rpx;
} */
.data-list-left {
+ width: 550rpx;
+ /* background-color: #007AFF; */
display: inline-block;
float: left;
- margin-left: 6%;
- height: 180rpx;
+ margin-left: 4%;
+ height: 130rpx;
color: #676767;
}
.matnr {
- padding-top: 10rpx;
+ display: inline-block;
+ width: 100%;
+ font-size: 16px;
+ font-weight: 700;
+ height: 130rpx;
+ line-height: 130rpx;
}
.data-list-right {
+ /* background-color: #6739B6; */
display: inline-block;
float: right;
- height: 180rpx;
- line-height: 180rpx;
- margin-right: 10%;
+ width: 100rpx;
+ height: 130rpx;
+ line-height: 130rpx;
}
</style>
\ No newline at end of file
--
Gitblit v1.9.1