烟花爆竹实名登记前端
祖安之光
2026-03-09 6169660d7b5968d62c3d816f4e7332d7e3abe573
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
<template>
    <el-dialog :visible.sync="detailDialogVisible" :modal-append-to-body="false" :close-on-click-modal="false" title="库存详情"
               width="900px">
        <el-table v-loading="listLoading"
                  :key="tableKey"
                  :data="detailData"
                  border
                  fit
                  highlight-current-row
                  style="width: 100%;">
            <el-table-column label="序号" type="index" align="center" width="60">
            </el-table-column>
            <el-table-column label="产品名称" prop="mc" align="center">
            </el-table-column>
            <el-table-column label="库存总数(箱)" prop="sl" align="center">
            </el-table-column>
        </el-table>
        <br>
        <el-pagination
            v-show="recordTotal>0"
            :current-page="currentPage"
            :page-sizes="[10, 20]"
            :page-size="pageSize"
            :total="recordTotal"
            layout="total, sizes, prev, pager, next, jumper"
            background
            style="float:right;"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
        />
        <br>
    </el-dialog>
</template>
 
<script>
    import {getDlSaleStockReq, getDlWholesaleStockReq} from "../../../api/danling";
    import {mapGetters} from "vuex";
    import {computePageCount, parseTime} from "../../../utils";
    import {parseError} from "../../../utils/messageDialog";
 
    export default {
        name: "danlinDetail",
        data() {
            return {
                detailDialogVisible: false,
                detailData: [],
                listLoading: true,
                pageSize: 10,
                currentPage: 1,
                recordTotal: 0,
                pageTotal: 0,
                tableKey: 0
            }
        },
        computed: {
            ...mapGetters([
                'userType',
                'username'
            ])
        },
        methods: {
            open(val,type){
                if(type == 1){
                    this.getRetailList(val);
                }else{
                    this.getWholeSaleList(val);
                }
                this.detailDialogVisible = true;
 
            },
 
            getRetailList(val) {
                const _this = this;
                let params = {
                    pageIndex: _this.currentPage,
                    pageSize: _this.pageSize,
                    filter: {
                        dwdm: val
                    }
                }
                getDlSaleStockReq(params).then(response => {
                    const res = response.data;
                    if (res.code === "200") {
                        const result = res.result;
                        _this.recordTotal = result.total;
                        _this.pageSize = result.size;
                        _this.pageTotal = result.pages;
                        _this.currentPage = result.current;
                        _this.detailData = result.records
                    }else {
                        parseError({error: res.message, vm: _this})
                    }
                    _this.listLoading = false;
                }).catch(error => {
                    _this.listLoading = false;
                    parseError({error: error, vm: _this})
                })
            },
            getWholeSaleList(val) {
                const _this = this;
                let params = {
                    pageIndex: _this.currentPage,
                    pageSize: _this.pageSize,
                    filter: {
                        dwdm: val
                    }
                }
                getDlWholesaleStockReq(params).then(response => {
                    const res = response.data;
                    if (res.code === "200") {
                        const result = res.result;
                        _this.recordTotal = result.total;
                        _this.pageSize = result.size;
                        _this.pageTotal = computePageCount(result.totalCount, result.pageSize);
                        _this.currentPage = result.pages;
                        _this.detailData = result.records
                    }else {
                        parseError({error: res.message, vm: _this})
                    }
                    _this.listLoading = false;
                }).catch(error => {
                    _this.listLoading = false;
                    parseError({error: error, vm: _this})
                })
            },
            handleSizeChange: function (val) {
                this.pageSize = val;
                this.currentPage = 1;
                this.getDetailDataList();
            },
            handleCurrentChange: function (val) {
                this.currentPage = val;
                this.getDetailDataList();
            }
        }
    }
</script>
 
<style scoped>
 
</style>