3f535f30
杨鑫
'初始'
|
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
|
</template>
</el-table-column>
</el-table>
<div class="fenye">
<el-pagination
:current-page="currentPage"
:page-sizes="[5, 10, 20, 50, 100]"
:page-size="5"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</div>
<!-- 上架审核 -->
<el-dialog title="上架审核" :visible.sync="examineVisible" width="30%" style="margin-top:10%">
<el-form :model="ForcedForm">
<el-form-item label="审核状态" label-width="120px">
<el-radio-group v-model="ForcedForm.shelveState">
<el-radio :label="1">通过</el-radio>
<el-radio :label="3">驳回</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
v-if="ForcedForm.shelveState == 3"
label="驳回原因"
label-width="120px"
>
<el-input
v-model="ForcedForm.reject"
type="textarea"
autocomplete="off"
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
|
3f535f30
杨鑫
'初始'
|
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
|
</span>
</el-dialog>
<add-commodity ref="addCommodity" :examine-show="examineShow" @reset="reset" />
</div>
</template>
<script>
import {
getClassifyGetAll,
Forced,
setFictitious,
examine,
productExport
} from '@/api/commodity';
import AddCommodity from './addCommodity';
export default {
components: { AddCommodity },
data () {
// 这里存放数据
return {
loading: true,
btnList: '',
activeName: 'first',
formInline: {
shelveState: '', // 商品状态 0-已下架 1-已上架 2-待审核 3-审核失败
productName: '', // 商品名称
productId: '', // 商品ID
shopName: '', // 商户名称
page: 1, // 当前页
pageSize: 5,
},
batchAdd: false,
batchFileList: [],
total: 1,
tableData: [],
currentPage: 1,
FictitiousVisible: false,
ForcedForm: {
fictitiousNumber: 0,
productId: '',
reject: '',
shelveState: 1,
},
examineVisible: false,
isDetail: false
};
},
// 监听属性 类似于data概念
computed: {},
// 监控data中的数据变化
watch: {},
// 生命周期 - 创建完成(可以访问当前this实例)
created () {},
// 生命周期 - 挂载完成(可以访问DOM元素)
mounted () {
this.getAll(this.formInline);
},
// 方法集合
methods: {
// 查看详情
Godetails (row) {
this.$refs.addCommodity.show(row.productId)
},
// 设置虚拟销量
setFictitious (row) {
this.FictitiousVisible = true;
this.ForcedForm.productId = row.productId;
this.ForcedForm.fictitiousNumber = row.fictitiousNumber;
},
async FicSubmintUs () {
const res = await setFictitious(this.ForcedForm);
if (res.code === '') {
this.FictitiousVisible = false;
this.$message.success(
'虚拟销量已设置:' + this.ForcedForm.fictitiousNumber
);
this.search();
}
},
// 强制下架
OutForced (row) {
this.$alert('确定下架此商品吗?', '提示', {
confirmButtonText: '确定',
callback: (action) => {
console.log(action);
if (action === 'confirm') {
this.ForcedForm.productId = row.productId;
Forced(this.ForcedForm).then((res) => {
if (res.code === '') {
this.$message.success('下架成功');
this.search();
}
});
}
},
});
},
// 审核弹窗
examineShow (row) {
this.ForcedForm.productId = row.productId;
this.ForcedForm.reject = '';
this.examineVisible = true;
if (row.isDetail) {
this.isDetail = row.isDetail
}
console.log(row, 'test')
},
async submintUs () {
if (this.ForcedForm.shelveState === 3 && this.ForcedForm.reject === '') { return this.$message.warning('请输入驳回原因'); }
const res = await examine(this.ForcedForm);
if (res.code === '') {
this.examineVisible = false;
if (this.ForcedForm.shelveState === 1) {
this.$message.success('审核成功');
} else {
this.$message.success('已驳回');
}
this.search();
if (this.isDetail) {
this.$refs.addCommodity.details()
}
}
},
handleSizeChange (val) {
console.log(val);
this.formInline.pageSize = val;
this.getAll(this.formInline);
},
handleCurrentChange (val) {
console.log(val);
this.formInline.page = val;
this.getAll(this.formInline);
},
// 查询
search () {
this.total = 1;
this.formInline.page = 1;
this.getAll(this.formInline);
},
// 商品状态查询
changeState (e) {
console.log(e);
this.formInline.shelveState = e;
this.getAll(this.formInline);
},
// 重置
clear () {
this.formInline = {
shelveState: '', // 商品状态 0-已下架 1-已上架 2-待审核 3-审核失败
productName: '', // 商品名称
productId: '', // 商品ID
shopName: '', // 商户名称
page: 1, // 当前页
pageSize: 5,
};
this.getAll(this.formInline);
},
// 导出商品
async productDataExport () {
this.$message({
message: '数据导出中,请勿重复操作!',
type: 'success'
})
const res = await productExport(this.formInline)
if (!res) {
return
}
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
const fileName = '商品数据明细表.xls'
if ('download' in document.createElement('a')) {
// 非IE下载
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
} else {
// IE10+下载
navigator.msSaveBlob(blob, fileName)
}
},
// 初始化查询所有数据
async getAll (formInline) {
const res = await getClassifyGetAll(formInline);
this.loading = false;
this.total = res.data.total;
this.tableData = res.data.list;
},
reset () {
this.getAll(this.formInline)
}
},
};
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类
@import url("../../../styles/elDialog.scss");
.pending {
|