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
<template>
<div>
<el-dialog
:title="dialogObj.title"
:visible.sync="dialogObj.show"
>
<el-table
:data="goodList"
style="width: 100%"
row-key="id"
highlight-current-row
@current-change="handleCurrentChange">
<el-table-column
prop="id"
label="商品ID">
</el-table-column>
<el-table-column
prop="name"
label="名称">
</el-table-column>
<el-table-column
label="商品类型">
<template slot-scope="scope">
{{scope.row.goods_type | goodsType}}
</template>
</el-table-column>
<el-table-column
label="现价">
<template slot-scope="scope">
{{scope.row.current_price/100}}元
</template>
</el-table-column>
<el-table-column
label="课程类别">
<template slot-scope="scope">
{{scope.row.course_type | lessonType}}
</template>
</el-table-column>
<el-table-column
label="是否有实物">
<template slot-scope="scope">
{{scope.row.is_real | isOrNot}}
</template>
</el-table-column>
<el-table-column
label="状态">
<template slot-scope="scope">
{{scope.row.status | goodsStatus}}
</template>
</el-table-column>
</el-table>
<page :nowPage="nowPage" :total="total"/>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogObj.show = false">取 消</el-button>
<el-button type="primary" @click="onConfirm">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {getGoodsListApi} from "../../service/api";
import {ISORNOT,GOODSTYPE,LESSONTYPE,GOODSSTATUS} from "../../util/wordbook";
import page from '../framework/page'
export default {
props:[
'dialogObj'
],
data(){
return{
nowPage : 1,
total: 0,
goodList:[],
currentRow: null
}
},
components:{
page
},
filters: {
isOrNot(value){
return ISORNOT[value]
},
goodsType(value){
return GOODSTYPE[value]
},
lessonType(value){
return LESSONTYPE[value]
},
goodsStatus(value){
return GOODSSTATUS[value]
}
},
methods:{
initPage(){
getGoodsListApi().then(res=>{
this.goodList = res.list;
this.total = res.total
});
},
handleCurrentChange(val){
this.currentRow = val;
},
onConfirm(){
this.$emit("reflash",this.currentRow);
}
},
mounted(){
this.initPage()
}
// watch:{
// 'dialogObj'(value){
// console.log('dialogObj value', value)
// this.initPage()
// }
// }
}
</script>
<style scoped>
</style>