#
whycq
2023-11-03 e9db6c25fbf11b214abf5561f592eeb86a2e61be
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
<template>
    <view>
        <view class="head">
            <z-input v-for="it in input"
            :desc="it.title"
            :name="it.name" 
            :btn="it.btn" 
            :btn-name="it.btnName" 
            v-model="it.val" 
            :index="it.id" 
            :lenCheck="it.lenCheck" 
            :focus="it.focus" 
            @inputVal='input2'
            ></z-input>
        </view>
        
        <u-sticky  >
            <view class="sticky">商品列表</view>
        </u-sticky>
        
        <z-data-list class="data-list"
            v-for="(it,i) in zDataList" 
            :key="i"  
            :lable="lable" 
            :fields="it"
            :index="i+1"
            @goDetail='goDetail(it.detl,i)' 
        ></z-data-list>
        
        
        
        
        
        
        <!-- 垫高 -->
        <view style="height: 100rpx;"></view>
        
        <view class="z-floor">
            <view class="z-default">重置</view>
            <view class="z-primary">组托</view>
        </view>
        
    </view>
</template>
 
<script>
    import { mapState } from 'vuex'
    import addMat from '@/pages/api/addMat.js'
    export default {
        data() {
            return {
                zDataList: [
                    {matnr: 'A1001',maktx: '1号物料',count: 99},
                    {matnr: 'A1002',maktx: '2号物料',count: 77},
                    {matnr: 'A1002',maktx: '2号物料',count: 77}
                ],
            }
        },
        onShow() {
            // console.log(this.page);
        },
        computed: mapState({
            input: state => state.project.menu[0].page.input,
            lable: state => state.project.menu[0].page.lable
        }),
        methods: {
            input2(arr) {
                if(arr[1] == 'matnr') {
                    this.getMat(arr[0])
                }
            },
            async getMat(matnr) {
                let mat = await addMat.addMat(matnr)
                this.zDataList.push(mat)
            },
            goDetail(param,index) {
                let _this = this
                uni.navigateTo({
                    url: '/pages/common/data-list/dataDetail',
                    // 传
                    success: function(data) {
                        data.eventChannel.emit('param', {
                            param: param,
                            index: index
                        })
                    },
                    // 接
                    events: {
                        dataList: function(data) {
                            console.log(data);
                        },
                        del: function(data) {
                            _this.zDataList.splice(data.data,1)
                        }
                    },
                })
            }
        }
    }
</script>
 
<style>
    .head {
        /* margin-top: -8px; */
    }
    .sticky {
        height: 70rpx;
        box-shadow:  0px 4px 4px #e2e2e2;
        text-align: center;
        background-color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
    }
</style>