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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<template>
<div class=''>
<el-dialog :visible.sync="goodsDialogParams.show" width="90%" append-to-body>
<div class="secTitle" >选择商品</div>
<div class="tableBox" >
<div class="item" >
<p>筛选列表</p>
<el-tabs v-model="goodSearchFrom.status" type="card" style="background: white;padding-top: 10px" @tab-click="getGoods()">
<el-tab-pane label="上架" name="1"></el-tab-pane>
<!-- <el-tab-pane label="编辑中" name="0"></el-tab-pane> -->
<el-tab-pane label="下架" name="2"></el-tab-pane>
<el-tab-pane label="全部" name="-1"></el-tab-pane>
</el-tabs>
<el-table
size="small"
:data="goodList"
@select="goodsSelectionChange"
@select-all="goodsSelectionAll"
style="width: 100%" fixed>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
prop="name"
label="名称">
<template slot-scope="scope">
<router-link :to="{name:'periods', query: { goods_id: scope.row.id}}" >
{{scope.row.name}}
</router-link>
</template>
</el-table-column>
<el-table-column
label="商品类型">
<template slot-scope="scope">
{{scope.row.goods_type | goodsType}}
</template>
</el-table-column>
<el-table-column
prop="course_title"
label="课程名称">
</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.status | goodsStatus}}
</template>
</el-table-column>
</el-table>
</div>
<div class="item" >
<p>选中列表</p>
<el-table
size="small"
:data="secGoods"
style="width: 100%" fixed>
<el-table-column
prop="name"
label="名称">
<template slot-scope="scope">
<router-link :to="{name:'periods', query: { goods_id: scope.row.id}}" >
{{scope.row.name}}
</router-link>
</template>
</el-table-column>
<el-table-column
label="操作"
width="148" v-if="!$store.state.readonly" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="danger" plain @click="goodsdel(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- <page :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/> -->
<span slot="footer" class="dialog-footer">
<el-button @click="goodsDialogParams.show = false">取 消</el-button>
<el-button type="primary" @click="onGoodsConfirm">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import tinymce from 'tinymce/tinymce'
import page from "../framework/page";
import {ISORNOT,GOODSTYPE,LESSONTYPE,GOODSSTATUS} from "../../util/wordbook";
import {
getGoodsListApi,
} from "../../service/api";
export default {
name: 'tinymce1',
props:[
'lookData1'
],
data () {
return {
goodList:[],
goodSearchFrom:{
status:"1"
},
secGoods:[],
goodsDialogParams:{
show:false,
},
}
},
created:function(){
},
filters: {
filterGoods(val){
return '['+val.id+'][' + GOODSTYPE[val.goods_type] + ']' + '【' +val.current_price / 100 + '元】' + val.name
},
isOrNot(value){
return ISORNOT[value]
},
goodsType(value){
return GOODSTYPE[value]
},
lessonType(value){
return LESSONTYPE[value]
},
goodsStatus(value){
return GOODSSTATUS[value]
},
},
components: {page},
methods:{
getGoods(){
let json = {
limit: "100",
page: this.nowPage
};
if (this.goodSearchFrom.status && this.goodSearchFrom.status !== '-1') {
json.status = this.goodSearchFrom.status
}
console.log(613)
getGoodsListApi(json).then(res=>{
res.list.forEach(i=>{
if(i.conflict_goods_ids === ''){
i.conflict_goods_ids=[]
}else{
i.conflict_goods_ids=i.conflict_goods_ids.split(',')
}
});
this.goodList = res.list;
// this.total = res.total
})
},
goodsSelectionChange(val,el) {
this.multipleSelection = val;
for(let i=0;i<this.secGoods.length;i++){
if(el.id==this.secGoods[i].id){
return
}
}
this.secGoods.push(el)
console.log(el)
},
goodsSelectionAll(val){
if(this.secGoods.length==0){
this.secGoods = [...val]
}else{
let length = this.secGoods.length
for(let j=0;j<val.length;j++){
for(let i=0;i<=length;i++){
if(val[j].id==this.secGoods[i].id){
break
}else{
if(i==length-1){
this.secGoods.push(val[j])
break
}
}
}
}
}
},
goodsdel(el){
for(let i=0;i<this.secGoods.length;i++){
if(el.id==this.secGoods[i].id){
this.secGoods.splice(i,1)
}
}
},
onSelectGood() {
this.goodsDialogParams.show = true;
this.getGoods();
},
onGoodsConfirm() {
this.$emit('goodConfirm',this.secGoods)
console.log(this.secGoods)
},
}
}
</script>
<style scoped lang="less">
.tableBox{display: flex;}
.tableBox .item{flex: 1;}
</style>