| | |
| | | </view> |
| | | </view> |
| | | <view class="mat-list-title"> |
| | | 商品列表 |
| | | <view style="width: 200rpx;"></view> |
| | | <view style="-webkit-flex: 1;flex: 1;">商品列表</view> |
| | | <view style="width: 200rpx; display: flex; justify-content: center; align-items: center;"><button size="mini" type="primary" @click="openAddDialog">添加</button></view> |
| | | </view> |
| | | <scroll-view> |
| | | <view class="list" v-for="(item,i) in dataList" :key="i"> |
| | |
| | | |
| | | </view> |
| | | <view class="list-left-item"> |
| | | <view class="desc">规格:</view> |
| | | <view class="left-item">{{item.specs}}</view> |
| | | <view class="desc">供应商:</view> |
| | | <view class="left-item">{{item.suppCode}}</view> |
| | | </view> |
| | | <view class="list-left-item"> |
| | | <view class="desc">批号:</view> |
| | |
| | | @confirm="resetConfirm" @close="resetClose"></uni-popup-dialog> |
| | | </uni-popup> |
| | | </view> |
| | | <!-- 添加商品弹窗 --> |
| | | <view> |
| | | <uni-popup ref="addDialog" type="dialog"> |
| | | <view class="popup"> |
| | | <view class="title">添加商品</view> |
| | | <view class="popup-item"> |
| | | <view class="popup-item-left">编码:</view> |
| | | <view class="popup-item-right"> |
| | | <input type="text" v-model="addMatnr" placeholder="请输入编码"> |
| | | </view> |
| | | </view> |
| | | <view class="btn"> |
| | | <view class="btn-left" @click="addClose">取消</view> |
| | | <view class="btn-right" @click="addConfirm">提交</view> |
| | | </view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | barcodeFocus: true, |
| | | matFocus: false, |
| | | matData: '', |
| | | pushDisabled:false |
| | | pushDisabled:false, |
| | | addMatnr: '' |
| | | |
| | | } |
| | | }, |
| | |
| | | }) |
| | | |
| | | }, |
| | | // 打开添加弹窗 |
| | | openAddDialog() { |
| | | this.addMatnr = '' |
| | | this.$refs.addDialog.open() |
| | | }, |
| | | // 取消添加 |
| | | addClose() { |
| | | this.$refs.addDialog.close() |
| | | }, |
| | | // 确认添加 |
| | | addConfirm() { |
| | | if (!this.addMatnr) { |
| | | this.messageText = "请输入编码" |
| | | this.messageToggle('error') |
| | | return |
| | | } |
| | | let that = this |
| | | uni.request({ |
| | | url: that.baseUrl + '/mat/auth?matnr=' + encodeURIComponent(that.addMatnr), |
| | | header: { |
| | | 'token': uni.getStorageSync('token') |
| | | }, |
| | | method: 'GET', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | if (!res.data) { |
| | | that.messageText = "未找到该商品" |
| | | that.messageToggle('error') |
| | | return |
| | | } |
| | | that.$refs.addDialog.close() |
| | | uni.navigateTo({ |
| | | url: './checkMatSelected', |
| | | success: function(result) { |
| | | result.eventChannel.emit('mat', {data: res.data}) |
| | | }, |
| | | events: { |
| | | checkMatList: function(data) { |
| | | that.dataList.push(data.data) |
| | | } |
| | | } |
| | | }) |
| | | } 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') |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | } |
| | | |
| | | .mat-list-title { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 80rpx; |
| | | line-height: 80rpx; |
| | | width: 100%; |