warehousingList.vue
5.15 KB
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
<template>
<div>
<div class="flex">
<el-form :inline="true" :model="searchForm">
<el-form-item label="商品搜索:">
<el-input :size="size" v-model="searchForm.name" placeholder="请输入商品名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
<el-button :size="size" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="wareRef" :searchForm="searchForm" :tableParams="tableParams" :getListApi="getListApi" :pageConf="pageConf">
<span slot="coverImgUrl" slot-scope="scope">
<img class="img-60" :src="scope.scope.coverImgUrl" />
</span>
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
<el-button type="text" @click="handleEdit(scope.scope)">修改价格</el-button>
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
</span>
</GLTable>
<!-- 表格区域 end -->
<!-- 修改价格弹框 开始 -->
<!-- <glsx-dialog title="修改价格" width="620px" :isVisible="showPriceDialog" @closeDialog="closePriceDialog" @confirmDialog="closePriceDialog">
<el-form ref="priceForm" :rules="formRules" :model="form" label-width="120px">
<el-form-item label="商品价格:" prop="price">
<el-input v-model="form.price" maxlength="8" style="width:400px" />
</el-form-item>
</el-form>
<div slot="footer">
<el-button type="primary" @click="resetPrice()">提交</el-button>
<el-button @click="showPriceDialog = false">取消</el-button>
</div>
</glsx-dialog> -->
<!-- 修改价格弹框 end -->
</div>
</template>
<script>
import { getWarehousListApi, deleteGoodApi } from '@/api/modules/cmmodityLibrary'
// import glsxDialog from '@/components/glsx-dialog'
export default {
// components: {
// glsxDialog
// },
data() {
return {
size: 'small',
searchForm: {
name: '',
status: '2'
},
// 表格组件
getListApi: getWarehousListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '商品标题',
prop: 'name',
line: 2
},
{
label: '直播间图片',
prop: 'coverImgUrl',
addHtml: 'coverImgUrl'
},
{
label: '价格(元)',
prop: 'price',
line: 1,
formatter: cellValue => {
return cellValue.price2 && cellValue.price1 != cellValue.price2 ? (cellValue.price1 / 100).toFixed(2) + '-' + (cellValue.price2 / 100).toFixed(2) : (cellValue.price1 / 100).toFixed(2)
}
},
{
label: '来源门店',
prop: 'merchantName',
line: 2
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// tableData: [
// {
// id: 1,
// pic: 'https://t7.baidu.com/it/u=4162611394,4275913936&fm=193&f=GIF',
// title: '商品标题',
// price: 999,
// merchant: 'xxx'
// }
// ],
// pageTotal: 0,
// userInfo: {},
// currentPage: 1,
// pageSizes: [10, 20, 30, 40],
// pageSize: 10,
// tdWidth: 170,
// DATEFORMATE: (str, type) => {
// return this.$Util.dateFormate(str, type)
// }
// showPriceDialog: false,
// form: {},
// formRules: {
// price: [{ required: true, message: '请输入价格', trigger: 'blur' }]
// }
}
},
created() {},
mounted: function() {},
methods: {
handleReset() {
this.searchForm = {
name: '',
status: '2'
}
this.handleSearch()
},
handleSearch() {
this.$refs.wareRef.refreshTable()
},
handleDelete(row) {
this.$messageBox.confirm('是否删除该商品?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
callback: action => {
if (action == 'confirm') {
deleteGoodApi({ id: row.id }).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.handleSearch()
}
})
}
}
})
},
// 1-新增;2-编辑;3-查看;4-修改价格
handleEdit: function(row) {
// this.showPriceDialog = true
this.$router.push({
// name: 'editProductGroup',
// path: '/cmmodityLibrary/editProductGroup',
name: 'ServicesCmmodityLibraryEditProductGroup',
params: {
addOrEdit: 4,
id: row ? row.id : -1
}
})
},
// closePriceDialog: function() {
// this.showPriceDialog = false
// }
}
}
</script>
<style lang="scss">
.table_box {
margin: 20px 0;
}
</style>