#
whycq
2022-08-15 9246e993b1ca7d41a721982221af3bcfc910b23c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<template>
    <view>
        <!-- 库位码输入框 -->
        <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 type="text" v-model="locno" placeholder="扫码 / 输入" :focus="locnoFocus">
                    <uni-icons type="closeempty" size="20" color="#dadada"></uni-icons>
                </view>
            </view>
        </view>
        <!-- 商品码输入框 -->
        <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 type="text" v-model="matnr" placeholder="扫码 / 输入" @input="findMat" :focus="matnrFocus">
                    <uni-icons type="closeempty" size="20" color="#dadada"></uni-icons>
                </view>
            </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="square-none">
            <view class="v-show" v-show="matList.length == 0">暂无更多数据...</view>
        </view>
        
        <!-- 商品列表 -->
        <checkbox-group >
            <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
                <view class="list-left">
                    <view class="lists-item">No:{{listNum}}</view>
                    <view class="lists-item">商品编码:{{item.matnr}}</view>
                    <view class="lists-item">商品批号:{{item.batch}}</view>
                    <view class="lists-item">上架数量:{{item.anfme}}</view>
                </view>
                <view class="list-right">
                    <uni-icons type="trash" size="20" color="#a5a5a5" @click="remove(item,index)"></uni-icons>
                </view>
            </view>
        </checkbox-group>
        
        <!-- 底部按钮 -->
        <view class="footer flex justify-around">
            <!-- <label class="label-btn" style="width: 170rpx;">
                <checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox>
            </label>
            <label class="label-btn" style="width: 100rpx;">
                <text  @click="reChecked()">反选</text>
            </label> -->
            
            <label class="label-btn" style="width: 150rpx;">
                <button class="cu-btn" @click="resst()">重置</button>
            </label>
            <label class="label-btn">
                <button class="cu-btn bg-blue " @click="comb()">上架</button>
            </label>
        </view>
    
    
    </view>
</template>
 
<script>
     export default {
        data() {
             return {
                locno:null, // 库位号
                matnr:'', // 商品码
                locnoFocus:true,
                matnrFocus:true,
                matList:[], // 商品列表
                listLen:0,
                listNum:1
                
            }
        },
        mounted(){
            const UIP = uni.getStorageSync('UIP');
            this.baseIP = UIP;
            const UPORT = uni.getStorageSync('UPORT');
            this.basePORT = UPORT
        },
        methods:{
            resst() {
                
            },
            findMat() {
                let that = this
                uni.request({
                    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth',
                    data: {
                        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
                            that.matnr = ''
                            uni.navigateTo({
                                url: "matQuery",
                                events: {
                                    // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                                    matList: function(data) {
                                        that.matList.push(data.data)
                                        console.log(that.matList)
                                    },
                                },
                                success: function(res) {
                                    // 通过eventChannel向被打开页面传送数据
                                    res.eventChannel.emit('matData', { data: that.matData })
                                },
                            });
                        }
                        
                    }
                });
                
            },
            // .
            // 上架
            comb() {
                let that = this
                var combList = {}
                var matList = []
                combList['locno'] = that.locno
                combList['combMats'] = that.matList
                matList['matnr'] = that.matList.
                console.log(combList)
                // console.log(JSON.stringify(combList))
                // return;
                uni.request({
                    url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth',
                    data: {
                        combParam:JSON.stringify(combList)
                    },
                    header: { 'token':uni.getStorageSync('token') },
                    success(result) {
                        console.log(result)
                    }
                })
            }
            
        }
     }
</script>
 
<style>
    @import url(@/static/css/putOnSale.css);
</style>