12
This commit is contained in:
@@ -1,6 +1,24 @@
|
||||
import request from '@/utils/request'
|
||||
var service_name = 'oil-mall'
|
||||
export default {
|
||||
brandGetByPage() {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductBrands/getByPage`,
|
||||
method: 'get',
|
||||
})
|
||||
},
|
||||
getAllAttributesType() {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductAttributesType/getAllAttributesType`,
|
||||
method: 'get',
|
||||
})
|
||||
},
|
||||
getClassificationTree() {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductClassification/getClassificationTree`,
|
||||
method: 'get',
|
||||
})
|
||||
},
|
||||
classifySave(page) {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductClassification/save`,
|
||||
@@ -70,6 +88,13 @@ delete(page) {
|
||||
data: page
|
||||
})
|
||||
},
|
||||
typeUpdate(page) {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductAttributes/update`,
|
||||
method: 'post',
|
||||
data: page
|
||||
})
|
||||
},
|
||||
update(page) {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductAttributesType/update`,
|
||||
|
||||
@@ -36,6 +36,12 @@ export const constantRoutes = [{
|
||||
name: 'productAdd',
|
||||
meta: { title: '添加商品', icon: 'iconkongzhitai', affix: true }
|
||||
},
|
||||
{
|
||||
path: '/brand',
|
||||
component: () => import('@/views/product/brand/index'),
|
||||
name: 'brand',
|
||||
meta: { title: '商品品牌', icon: 'iconkongzhitai', affix: true }
|
||||
},
|
||||
{
|
||||
path: '/productClassify',
|
||||
component: () => import('@/views/product/productClassify/index'),
|
||||
|
||||
134
src/views/product/brand/index.vue
Normal file
134
src/views/product/brand/index.vue
Normal file
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }">
|
||||
<div class="padding-add">
|
||||
<el-form ref="artFrom" :model="page" label-width="80px" label-position="right" class="tabform"
|
||||
@submit.native.prevent inline>
|
||||
<el-form-item label="输入搜索">
|
||||
<el-input clearable v-model="page.rule_name" placeholder="品牌名称/关键词"
|
||||
class="form_content_width"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="userSearchs">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||
<el-button type="primary" @click="addType">添加品牌</el-button>
|
||||
<el-table @current-change="tableCurrentChange" ref="table" :data="tableData" v-loading="loading"
|
||||
highlight-current-row :row-key="getRowKey" @selection-change="handleSelectRow" empty-text="暂无数据"
|
||||
class="mt14">
|
||||
<el-table-column type="selection" width="60" :reserve-selection="true"> </el-table-column>
|
||||
<el-table-column label="编号">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.brandNum }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌名称">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌首字母">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="showAttrList(scope.row)" type="text">
|
||||
{{ scope.row.attrCount }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="showAttrList(scope.row)" type="text">
|
||||
{{ scope.row.attrCount }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否显示">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="showAttrList(scope.row)" type="text">
|
||||
{{ scope.row.attrCount }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<a @click="edit(scope.row)">编辑</a>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
<a @click="del(scope.row)">删除</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="acea-row row-right page">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="page.currentPage"
|
||||
:page-sizes="[10, 15, 20, 30]"
|
||||
:page-size="page.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="page.totalCount" />
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
import { loadingFn } from "@/utils/validate"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
selection: [],
|
||||
selectAttrList: null,
|
||||
isShowAttrList: false,
|
||||
loading: false,
|
||||
page: {
|
||||
"currentPage": 1,
|
||||
"pageSize": 10,
|
||||
"params": {},
|
||||
totalCount: 0
|
||||
},
|
||||
tableData: [],
|
||||
total: 0,
|
||||
selectedIds: new Set(), //选中合并项的id
|
||||
ids: [],
|
||||
multipleSelection: [],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
created() { },
|
||||
methods: {
|
||||
tableCurrentChange(e) { },
|
||||
handleCurrentChange(val) { },
|
||||
handleSizeChange(val) { },
|
||||
clearSelection() { },
|
||||
onCancel() { },
|
||||
addType() { },
|
||||
showAttrList(e) { },
|
||||
getRowKey(row) { },
|
||||
//全选和取消全选时触发
|
||||
handleSelectAll(selection) { },
|
||||
// 选中某一行
|
||||
handleSelectRow(selection) { },
|
||||
setChecked() { },
|
||||
// 删除
|
||||
del(row) { },
|
||||
addAttr(model) {
|
||||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
},
|
||||
// 列表
|
||||
getList() {
|
||||
loadingFn.call(this, "loading", productApi.brandGetByPage(this.page).then(res => {
|
||||
if (res.code = 20000) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data);
|
||||
}));
|
||||
},
|
||||
// 表格搜索
|
||||
userSearchs() { },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
@@ -717,7 +717,7 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="formValidate.freight == 3">
|
||||
<!-- <el-col :span="24" v-if="formValidate.freight == 3">
|
||||
<el-form-item label="" prop="temp_id">
|
||||
<div class="acea-row">
|
||||
<el-select
|
||||
@@ -736,7 +736,7 @@
|
||||
<span class="addfont" @click="addTemp">新增运费模板</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
<!-- 营销设置-->
|
||||
<el-row :gutter="24" v-show="headTab.length === 6 ? currentTab === '5' : currentTab === '4'">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog :visible.sync="modal" @closed="onCancel" title="商品规格" width="1000px" v-loading="spinShow">
|
||||
<el-dialog :visible.sync="modal" @close="onCancel" title="商品规格" width="1000px" v-loading="spinShow">
|
||||
<el-form ref="formDynamic" :model="formDynamic" :rules="rules" class="attrFrom" label-width="110px"
|
||||
label-position="right" @submit.native.prevent>
|
||||
<el-row :gutter="24">
|
||||
@@ -47,7 +47,7 @@
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-button type="primary" @click="addBtn" v-if="!isBtn&model=='save'" class="add">添加新规格</el-button>
|
||||
<el-button type="primary" @click="addBtn" v-if="!isBtn & model == 'save'" class="add">添加新规格</el-button>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="onClose">取消</el-button>
|
||||
@@ -56,7 +56,7 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
export default {
|
||||
name: 'addAttr',
|
||||
props: {
|
||||
@@ -104,13 +104,14 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.formDynamic)
|
||||
},
|
||||
created() { },
|
||||
methods: {
|
||||
onCancel() {
|
||||
this.$parent.clearSelection();
|
||||
this.$parent.selection = [];
|
||||
onCancel() {
|
||||
this.$parent.clearSelection();
|
||||
this.formDynamic = {
|
||||
name: '',
|
||||
spec: [],
|
||||
}
|
||||
},
|
||||
onClose() {
|
||||
this.ids = 0;
|
||||
@@ -142,19 +143,23 @@ export default {
|
||||
if (this.formDynamic.spec.length === 0) {
|
||||
return this.$message.warning('请至少添加一条商品规格!');
|
||||
}
|
||||
this.modal_loading = true;
|
||||
Promise.all([...this.formDynamic.spec.map(item => {
|
||||
return productApi[this.model]({
|
||||
this.modal_loading = true;
|
||||
Promise.all([...this.formDynamic.spec.map(item => {
|
||||
return productApi[this.model](Object.assign({
|
||||
"attributeName": item.value,
|
||||
"attributeContent": item.detail.join(","),
|
||||
"typeId": this.formDynamic.id,
|
||||
"sort": 1,
|
||||
})
|
||||
}, this.model == "save" ? {
|
||||
"typeId": this.formDynamic.id,
|
||||
} : {
|
||||
"id": this.formDynamic.id || ""
|
||||
}))
|
||||
})]).then(res => {
|
||||
this.$message.success("添加成功")
|
||||
this.modal = false;
|
||||
}).finally(() => {
|
||||
this.modal_loading = false;
|
||||
this.model == "save" ? this.$parent.handleCurrentChange() : this.$parent.$refs.attrList.getByPage()
|
||||
})
|
||||
|
||||
} else {
|
||||
@@ -222,9 +227,10 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .el-tag{
|
||||
::v-deep .el-tag {
|
||||
margin-right: 20px !important;
|
||||
}
|
||||
|
||||
.rulesBox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -34,8 +34,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
export default {
|
||||
name: "attrList",
|
||||
props: {
|
||||
@@ -60,7 +59,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
isStrictPromise(value) {
|
||||
return !!value
|
||||
@@ -111,7 +110,7 @@ export default {
|
||||
}],
|
||||
})
|
||||
this.$parent.$parent.selection = [data];
|
||||
this.$parent.$parent.addAttr('update');
|
||||
this.$parent.$parent.addAttr('typeUpdate');
|
||||
},
|
||||
init() {
|
||||
if (this.selectAttrId && this.selectAttrId.indexOf("/") !== -1) {
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
</div>
|
||||
</el-card>
|
||||
<add-attr :selection="selection" ref="addattr" @getList="userSearchs"></add-attr>
|
||||
<el-dialog @closed="onCancel" title="属性列表" :visible.sync="isShowAttrList" width="30%">
|
||||
<attrList :selectAttrId="selectAttrId" v-if="isShowAttrList"></attrList>
|
||||
<el-dialog title="属性列表" :visible.sync="isShowAttrList" width="30%">
|
||||
<attrList ref="attrList" :selectAttrId="selectAttrId" v-if="isShowAttrList"></attrList>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
@@ -85,14 +85,18 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch:{
|
||||
// isShowAttrList(n,o){
|
||||
// this.clearSelection()
|
||||
// }
|
||||
},
|
||||
created() {
|
||||
this.getDataList();
|
||||
},
|
||||
methods: {
|
||||
tableCurrentChange(e) {
|
||||
|
||||
// this.$message.warning()
|
||||
console.log(e, '===')
|
||||
console.log(e,'===')
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.artFrom.currentPage = val
|
||||
@@ -103,11 +107,11 @@ export default {
|
||||
this.getDataList()
|
||||
},
|
||||
clearSelection(){
|
||||
this.$refs.table.clearSelection();
|
||||
},
|
||||
onCancel(){
|
||||
|
||||
this.selection = [];
|
||||
// this.handleSelectRow([]);
|
||||
this.$refs.table.clearSelection();
|
||||
},
|
||||
onCancel(){ },
|
||||
addType() {
|
||||
this.$prompt('请输入类型', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
@@ -153,9 +157,8 @@ export default {
|
||||
});
|
||||
},
|
||||
// 选中某一行
|
||||
handleSelectRow(selection) {
|
||||
console.log("selection",selection)
|
||||
this.selection = selection;
|
||||
handleSelectRow(selection) {
|
||||
this.selection = selection;
|
||||
},
|
||||
setChecked() {
|
||||
//将new Set()转化为数组
|
||||
@@ -207,8 +210,7 @@ export default {
|
||||
// 列表;
|
||||
getDataList() {
|
||||
this.loading = true;
|
||||
productApi.typeFindByPage(this.artFrom).then(res => {
|
||||
console.log(res.data);
|
||||
productApi.typeFindByPage(this.artFrom).then(res => {
|
||||
if (res.code = 20000) ({ list: this.tableList = [], totalCount: this.artFrom.totalCount = 0 } = res.data);
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
|
||||
Reference in New Issue
Block a user