更新分类
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
var service_name = 'oil-mall'
|
var service_name = 'oil-mall'
|
||||||
export default {
|
export default {
|
||||||
|
classifyGetByPage(page) { // 分页查询
|
||||||
|
return request({
|
||||||
|
url: `/${service_name}/mallProductClassification/getByPage`,
|
||||||
|
method: 'post',
|
||||||
|
data: page
|
||||||
|
})
|
||||||
|
},
|
||||||
typeFindByPage(page) { // 分页查询
|
typeFindByPage(page) { // 分页查询
|
||||||
return request({
|
return request({
|
||||||
url: `/${service_name}/mallProductAttributesType/getByPage`,
|
url: `/${service_name}/mallProductAttributesType/getByPage`,
|
||||||
@@ -49,7 +56,7 @@ delete(page) {
|
|||||||
data: page
|
data: page
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
delete(page) {
|
typeDelete(page) {
|
||||||
return request({
|
return request({
|
||||||
url: `/${service_name}/mallProductAttributesType/delete`,
|
url: `/${service_name}/mallProductAttributesType/delete`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Created by PanJiaChen on 16/11/18.
|
* Created by CAOLIANCUN on 2024/1/11.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,3 +150,18 @@ export function isArray(arg) {
|
|||||||
}
|
}
|
||||||
return Array.isArray(arg)
|
return Array.isArray(arg)
|
||||||
}
|
}
|
||||||
|
export function isStrictPromise(value) {
|
||||||
|
return !!value
|
||||||
|
&& typeof value === 'object'
|
||||||
|
&& typeof value.then === 'function'
|
||||||
|
&& typeof value.finally === 'function';
|
||||||
|
}
|
||||||
|
export function loadingFn(_loading,callback) {
|
||||||
|
console.log(isStrictPromise(callback),_loading,'isStrictPromise(callback)')
|
||||||
|
_loading = true;
|
||||||
|
if (isStrictPromise(callback)) {
|
||||||
|
callback.finally(() => {
|
||||||
|
// _loading = false;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }">
|
<!-- <el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }">
|
||||||
<div class="padding-add">
|
<div class="padding-add">
|
||||||
<el-form ref="artFrom" :model="artFrom" label-width="80px" label-position="right" class="tabform"
|
<el-form ref="artFrom" :model="artFrom" label-width="80px" label-position="right" class="tabform"
|
||||||
@submit.native.prevent inline>
|
@submit.native.prevent inline>
|
||||||
@@ -12,11 +12,11 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card> -->
|
||||||
<el-card :bordered="false" shadow="never" class="ivu-mt mt16">
|
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||||
<el-button type="primary" @click="addType">添加类型</el-button>
|
<el-button type="primary" @click="addType">添加类型</el-button>
|
||||||
<el-button type="primary" @click="addAttr('save')">添加商品规格</el-button>
|
<el-button type="primary" @click="addAttr('save')">添加商品规格</el-button>
|
||||||
<el-button @click="del(null, '批量删除规格')">批量删除</el-button>
|
<!-- <el-button @click="del(null, '批量删除规格')">批量删除</el-button> -->
|
||||||
<el-table @current-change="tableCurrentChange" ref="table" :data="tableList" v-loading="loading"
|
<el-table @current-change="tableCurrentChange" ref="table" :data="tableList" v-loading="loading"
|
||||||
highlight-current-row :row-key="getRowKey" @selection-change="handleSelectRow" empty-text="暂无数据" class="mt14">
|
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 type="selection" width="60" :reserve-selection="true"> </el-table-column>
|
||||||
@@ -62,7 +62,6 @@
|
|||||||
import addAttr from './addAttr';
|
import addAttr from './addAttr';
|
||||||
import productApi from '@/api/product/productAttr.js';
|
import productApi from '@/api/product/productAttr.js';
|
||||||
import attrList from './components/attrList.vue'
|
import attrList from './components/attrList.vue'
|
||||||
import object from 'element-resize-detector/src/detection-strategy/object';
|
|
||||||
export default {
|
export default {
|
||||||
name: 'productAttr',
|
name: 'productAttr',
|
||||||
components: { addAttr, attrList },
|
components: { addAttr, attrList },
|
||||||
@@ -168,7 +167,7 @@ export default {
|
|||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
callback: action => {
|
callback: action => {
|
||||||
if (action == "confirm") {
|
if (action == "confirm") {
|
||||||
productApi.delete(row).then(res => {
|
productApi.typeDelete(row).then(res => {
|
||||||
if (res.code == 20000) {
|
if (res.code == 20000) {
|
||||||
this.$message.success("操作成功!")
|
this.$message.success("操作成功!")
|
||||||
this.handleCurrentChange()
|
this.handleCurrentChange()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="article-manager">
|
<div class="article-manager">
|
||||||
<el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }">
|
<!-- <el-card :bordered="false" shadow="never" class="ivu-mt-16" :body-style="{ padding: 0 }">
|
||||||
<div class="padding-add">
|
<div class="padding-add">
|
||||||
<el-form ref="artFrom" :model="artFrom" inline label-width="80px" label-position="right" @submit.native.prevent>
|
<el-form ref="artFrom" :model="artFrom" inline label-width="80px" label-position="right" @submit.native.prevent>
|
||||||
<el-form-item label="商品分类:" prop="pid" label-for="pid">
|
<el-form-item label="商品分类:" prop="pid" label-for="pid">
|
||||||
@@ -26,11 +26,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card> -->
|
||||||
<el-card :bordered="false" shadow="never" class="ivu-mt mt16">
|
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||||
<el-button type="primary" class="bnt" @click="addClass">添加分类</el-button>
|
<el-button type="primary" class="bnt" @click="addClass">添加分类</el-button>
|
||||||
<el-table class="mt14" highlight-hover-row :loading="loading" header-row-class-name="false"
|
<el-table class="mt14" :loading="loading" :data="tableData">
|
||||||
:tree-config="{ children: 'children' }" :data="tableData">
|
|
||||||
<el-table-column field="id" label="ID" tooltip width="80"></el-table-column>
|
<el-table-column field="id" label="ID" tooltip width="80"></el-table-column>
|
||||||
<el-table-column field="cate_name" tree-node label="分类名称" min-width="250"></el-table-column>
|
<el-table-column field="cate_name" tree-node label="分类名称" min-width="250"></el-table-column>
|
||||||
<el-table-column field="pic" label="分类图标" min-width="100">
|
<el-table-column field="pic" label="分类图标" min-width="100">
|
||||||
@@ -67,10 +66,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import edit from '@/components/Category/edit'
|
import edit from '@/components/Category/edit'
|
||||||
|
|
||||||
import { mapState } from 'vuex';
|
|
||||||
// import { productListApi, productCreateApi, productEditApi, setShowApi, treeListApi } from '@/api/product';
|
|
||||||
import editFrom from '../../../components/from/from';
|
import editFrom from '../../../components/from/from';
|
||||||
|
import productApi from '@/api/product/productAttr.js';
|
||||||
|
import {loadingFn} from "@/utils/validate"
|
||||||
export default {
|
export default {
|
||||||
name: 'product_productClassify',
|
name: 'product_productClassify',
|
||||||
components: {
|
components: {
|
||||||
@@ -92,40 +90,31 @@ export default {
|
|||||||
xs: 24,
|
xs: 24,
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
artFrom: {
|
page: {
|
||||||
pid: 0,
|
"currentPage": 1,
|
||||||
is_show: '',
|
"pageSize": 10,
|
||||||
page: 1,
|
"params": {},
|
||||||
cate_name: '',
|
totalCount: 0
|
||||||
limit: 15,
|
|
||||||
},
|
},
|
||||||
total: 0,
|
total: 0,
|
||||||
tableData: [],
|
tableData: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
...mapState('admin/userLevel', ['categoryId']),
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.goodsCategory();
|
// this.goodsCategory();
|
||||||
this.getList();
|
// this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 商品分类;
|
// 商品分类;
|
||||||
goodsCategory() {
|
goodsCategory() {
|
||||||
// treeListApi(0)
|
|
||||||
// .then((res) => {
|
|
||||||
// this.treeSelect = res.data;
|
|
||||||
// })
|
|
||||||
// .catch((res) => {
|
|
||||||
// this.$message.error(res.msg);
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
// 列表
|
// 列表
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.artFrom.is_show = this.artFrom.is_show || '';
|
// console.log(,'loadingFn')
|
||||||
this.artFrom.pid = this.artFrom.pid || '';
|
// loadingFn(this.loading,productApi.classifyGetByPage(this.page))
|
||||||
|
// this.artFrom.is_show = this.artFrom.is_show || '';
|
||||||
|
// this.artFrom.pid = this.artFrom.pid || '';
|
||||||
// productListApi(this.artFrom)
|
// productListApi(this.artFrom)
|
||||||
// .then(async (res) => {
|
// .then(async (res) => {
|
||||||
// let data = res.data;
|
// let data = res.data;
|
||||||
@@ -137,6 +126,7 @@ export default {
|
|||||||
// this.loading = false;
|
// this.loading = false;
|
||||||
// this.$message.error(res.msg);
|
// this.$message.error(res.msg);
|
||||||
// });
|
// });
|
||||||
|
// productApi.classifyGetByPage()
|
||||||
},
|
},
|
||||||
pageChange(index) {
|
pageChange(index) {
|
||||||
this.artFrom.page = index;
|
this.artFrom.page = index;
|
||||||
|
|||||||
Reference in New Issue
Block a user