#
whycq
2024-03-28 b5c0993eb8043882eae85ce9ab1d860ff8bebf17
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
<template>
    <view>
        <view class="box">
            <view class="item" v-for="item in data" v-show="!item.hide">
                <!-- key -->
                <view class="item-key">{{item.title}}</view>
                <!-- value -->
                <view class="item-text" v-if="item.type == 'text'">{{mat[item.field]}}</view>
                <!-- <view class="item-text" v-if="item.type == 'text'">{{item.value}}</view> -->
                <view class="item-input" v-if="item.type == 'input'" :style="'text-align:'+ float">
                    <input type="text" @blur="blur" @focus="focus" v-model="inputData">
                </view>
                <view class="item-input" v-if="item.type == 'number-box'">
                    <uni-number-box v-model="numberData" :max="99999999" :step='1' color="#747474" @change="changeValue" />
                </view>
                <view class="item-input" v-if="item.type == 'select'">
                    <riko-combox @input="select" :candidates="candidates" :value="city" :inputFlag="true"></riko-combox>
                </view>
            </view>
        </view>
        
        <view class="z-floor">
            <view class="z-primary" @click="back">提取</view>
        </view>
        
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                candidates: [{name: 'box',id:1},{name: 'plan',id: 2}],
                city: null,
                data: [
                    {
                        title: '商品名称',
                        field: 'maktx',
                        hied: false,
                        value: '123456',
                        type: 'text'
                    },
                    {
                        title: '商品编号',
                        field: 'matnr',
                        hied: false,
                        value: '温度。空调',
                        type: 'text'
                    },
                    {
                        title: '规格',
                        field: 'specs',
                        hied: false,
                        value: 'φ160*45φ160*45φ160*45φ160*45φ160*45φ160*45φ160*45φ160*45φ160*45φ160*45',
                        type: 'text'
                    },
                    {
                        title: '批号',
                        field: 'batch',
                        hied: false,
                        value: '物料名称物',
                        type: 'input'
                    },
                    {
                        title: '数量',
                        field: 'count',
                        hied: false,
                        value: '物料名称物',
                        type: 'number-box'
                    },
                    // {
                    //     title: '货主',
                    //     field: 'maktx',
                    //     hied: false,
                    //     value: '物料名称物',
                    //     type: 'select'
                    // },
                ],
                mat: '',
                float: 'left',
                inputData: '',
                numberData: ''
            }
        },
        onLoad(option) {
            let _this = this
            const eventChannel = this.getOpenerEventChannel();
            // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
            eventChannel.on('mat', function(data) {
                _this.mat = data.mat
            })
        },
        methods: {
            blur() {
                this.float = 'right'
            },
            focus() {
                let newData = this.inputData
                this.inputData = ''
                this.float = 'left'
                this.inputData = newData
            },
            changeValue() {
            },
            select(e){
                console.log(e);
            },
            back() {
                if (this.mat.anfme === 0) {
                    uni.showToast({title: '请输入数量', icon: "none", position: 'top'});
                    return;
                }
                this.getOpenerEventChannel().emit('matList', {data: this.mat});
                uni.navigateBack({
                    
                })
            }
        }
    }
</script>
 
<style scoped>
    .box {
        min-height: 60rpx;
        /* background-color: #202124; */
        /* color: #FFF; */
        background-color: #FFF;
        margin: 16rpx;
        padding: 64rpx 32rpx 1rpx 32rpx;
    }
    .item {
        display: flex;
        min-height: 60rpx;
        margin: 20rpx 0;
        border-bottom: 1px solid #efeef2;
        vertical-align: bottom;
        padding: 0 10rpx;
        line-height: 1.3;
    }
    .item:last-child {
        border-bottom: none;
        margin: 10rpx 0;
    }
    .item-key{
        min-width: 6em;
        max-width: 6em;
        align-self: center;
        vertical-align: bottom;
        font-weight: bold;
    }
    .item-text {
        flex: 1;
        align-self: center;
        text-align: right;
        word-break: break-all
    }
    .item-input {
        padding: 4rpx;
        flex: 1;
        align-self: center;
    }
</style>