|
|
@@ -17,29 +17,14 @@
|
|
|
:value="item.id"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="selSubmitFn"
|
|
|
- size="mini"
|
|
|
- class="app-margin-left-10"
|
|
|
- >查询</el-button
|
|
|
- >
|
|
|
+ <el-button type="primary" @click="selSubmitFn" size="mini" class="app-margin-left-10">查询</el-button>
|
|
|
</div>
|
|
|
<div class="operate-right flex-center">
|
|
|
- <el-button
|
|
|
- class="view-category"
|
|
|
- size="mini"
|
|
|
- @click="$router.push('/goods/category')"
|
|
|
- >查看分类</el-button
|
|
|
- >
|
|
|
+ <el-button class="view-category" size="mini" @click="$router.push('/goods/category')">查看分类</el-button>
|
|
|
<!-- upload-img -->
|
|
|
- <cl-upload
|
|
|
- v-model="addForm.picIdList"
|
|
|
- hostUrl="picAdd"
|
|
|
- :props="{ 'on-success': addImgFn }"
|
|
|
- >
|
|
|
+ <cl-upload v-model="addForm.picIdList" hostUrl="picAdd" :props="{ 'on-success': addImgFn }">
|
|
|
<template slot="content">
|
|
|
- <el-button type="primary" size="mini">新增</el-button>
|
|
|
+ <el-button type="primary" size="mini">添加</el-button>
|
|
|
</template>
|
|
|
</cl-upload>
|
|
|
</div>
|
|
|
@@ -69,7 +54,7 @@
|
|
|
>
|
|
|
<div class="add-image-modal-content">
|
|
|
<el-form :model="addForm" :rules="rules" ref="addForm" label-width="120px">
|
|
|
- <el-form-item label="选择分类(可多选)">
|
|
|
+ <el-form-item label="分类">
|
|
|
<el-checkbox-group v-model="addForm.categoryIdList" size="small">
|
|
|
<el-checkbox
|
|
|
border
|
|
|
@@ -78,26 +63,22 @@
|
|
|
:key="index"
|
|
|
size="small"
|
|
|
@change="selChangeDialogFn($event, item)"
|
|
|
- >{{ item.categoryName }}</el-checkbox
|
|
|
- >
|
|
|
+ >{{ item.categoryName }}</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="售价">
|
|
|
- <el-input
|
|
|
- v-model="addForm.price"
|
|
|
- placeholder="填价格,图片可当商品卖(选填)"
|
|
|
- >
|
|
|
+ <el-input v-model="addForm.price" placeholder="请填写价格">
|
|
|
<i slot="suffix" class="iconfont iconqian"></i>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="名称">
|
|
|
- <el-input v-model="addForm.name" placeholder="选填"></el-input>
|
|
|
+ <el-input v-model="addForm.name" placeholder="请填写图片名称"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button size="small" @click="resetForm">取 消</el-button>
|
|
|
- <el-button type="primary" size="small" @click="addOrModifyFn">确 定</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="setImgCategoryFn">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
@@ -106,6 +87,7 @@
|
|
|
<script>
|
|
|
import { mapGetters } from 'vuex';
|
|
|
import operateModule from '@/components/module/operate';
|
|
|
+import ImgStore from '@/service/img-store/index';
|
|
|
import { list } from '@/mixins';
|
|
|
export default {
|
|
|
name: 'img-store',
|
|
|
@@ -118,7 +100,6 @@ export default {
|
|
|
form: {
|
|
|
categoryId: ''
|
|
|
},
|
|
|
- // operate
|
|
|
operateData: {},
|
|
|
btnData: [
|
|
|
{
|
|
|
@@ -129,21 +110,21 @@ export default {
|
|
|
this.addImageModal = true;
|
|
|
}
|
|
|
},
|
|
|
- {
|
|
|
- text: '分享',
|
|
|
- icon: 'iconfenxiang1',
|
|
|
- click: () => {
|
|
|
- this.$service.imgStore.top({ id: this.operateData.id }).then(res => {
|
|
|
- this.resetList();
|
|
|
- this._list();
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
+ {
|
|
|
+ text: '分享',
|
|
|
+ icon: 'iconfenxiang1',
|
|
|
+ click: () => {
|
|
|
+ ImgStore.share({ id: this.operateData.id }).then(res => {
|
|
|
+ this.resetList();
|
|
|
+ this._list();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
text: '置顶',
|
|
|
icon: 'iconzhiding',
|
|
|
click: () => {
|
|
|
- this.$service.imgStore.top({ id: this.operateData.id }).then(res => {
|
|
|
+ ImgStore.top({ id: this.operateData.id }).then(res => {
|
|
|
this.resetList();
|
|
|
this._list();
|
|
|
});
|
|
|
@@ -159,28 +140,25 @@ export default {
|
|
|
type: 'warning'
|
|
|
})
|
|
|
.then(() => {
|
|
|
- this.$service.imgStore
|
|
|
- .delete({ id: this.operateData.id })
|
|
|
- .then(res => {
|
|
|
- this.resetList();
|
|
|
- this._list();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
+ ImgStore.delete({ id: this.operateData.id }).then(res => {
|
|
|
+ this.resetList();
|
|
|
+ this._list();
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
});
|
|
|
+ });
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
- // 图片上传成功
|
|
|
+ // 图片上传成功提示框
|
|
|
addImageModal: false,
|
|
|
addForm: {
|
|
|
picIdList: '',
|
|
|
- price: 0,
|
|
|
+ price: '',
|
|
|
name: '',
|
|
|
- // shopImg: [],
|
|
|
categoryIdList: []
|
|
|
},
|
|
|
rules: {}
|
|
|
@@ -202,14 +180,12 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
_list() {
|
|
|
- return this.$service.imgStore
|
|
|
- .list({
|
|
|
- page: this.list.page,
|
|
|
- ...this.form
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- this.completes(res);
|
|
|
- });
|
|
|
+ return ImgStore.list({
|
|
|
+ page: this.list.page,
|
|
|
+ ...this.form
|
|
|
+ }).then(res => {
|
|
|
+ this.completes(res);
|
|
|
+ });
|
|
|
},
|
|
|
selChangeFn(e) {
|
|
|
this.form.categoryId = e;
|
|
|
@@ -220,18 +196,20 @@ export default {
|
|
|
},
|
|
|
// 新增图片
|
|
|
addImgFn(res) {
|
|
|
- this.addForm.picIdList = res.id + '';
|
|
|
- // this.addForm.shopImg.push(res.shortUrl);
|
|
|
- this.addImageModal = true;
|
|
|
+ this.addForm.picIdList = res.id + ''
|
|
|
+ this.addForm.name = ''
|
|
|
+ this.addForm.price = ''
|
|
|
+ this.addForm.categoryIdList = []
|
|
|
+ this.addImageModal = true
|
|
|
},
|
|
|
selChangeDialogFn(status, item) {
|
|
|
console.log(status, item);
|
|
|
},
|
|
|
- // type == 1 新增,type == 2 修改
|
|
|
- addOrModifyFn(type) {
|
|
|
+ //设置图片分类
|
|
|
+ setImgCategoryFn(type) {
|
|
|
let form = JSON.parse(JSON.stringify(this.addForm));
|
|
|
form.picIdList = [form.picIdList];
|
|
|
- this.$service.imgStore.remark(form).then(res => {
|
|
|
+ ImgStore.remark(form).then(res => {
|
|
|
this.$message.success('操作成功!');
|
|
|
this.resetForm();
|
|
|
this.resetList();
|
|
|
@@ -243,7 +221,6 @@ export default {
|
|
|
this.$refs['addForm'].resetFields();
|
|
|
this.addImageModal = false;
|
|
|
},
|
|
|
- // operate
|
|
|
operateChangeFn(item) {
|
|
|
this.operateData = item;
|
|
|
}
|