更新分类

pull/1/head
dt_2916866708 1 year ago
parent b59bab8e90
commit 74c91e61bb
  1. 9
      src/api/product/productAttr.js
  2. 17
      src/utils/validate.js
  3. 13
      src/views/product/productAttr/index.vue
  4. 52
      src/views/product/productClassify/index.vue

@ -1,6 +1,13 @@
import request from '@/utils/request'
var service_name = 'oil-mall'
export default {
classifyGetByPage(page) { // 分页查询
return request({
url: `/${service_name}/mallProductClassification/getByPage`,
method: 'post',
data: page
})
},
typeFindByPage(page) { // 分页查询
return request({
url: `/${service_name}/mallProductAttributesType/getByPage`,
@ -49,7 +56,7 @@ delete(page) {
data: page
})
},
delete(page) {
typeDelete(page) {
return request({
url: `/${service_name}/mallProductAttributesType/delete`,
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)
}
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>
<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">
<el-form ref="artFrom" :model="artFrom" label-width="80px" label-position="right" class="tabform"
@submit.native.prevent inline>
@ -12,11 +12,11 @@
</el-form-item>
</el-form>
</div>
</el-card>
<el-card :bordered="false" shadow="never" class="ivu-mt mt16">
</el-card> -->
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
<el-button type="primary" @click="addType">添加类型</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"
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>
@ -61,8 +61,7 @@
<script>
import addAttr from './addAttr';
import productApi from '@/api/product/productAttr.js';
import attrList from './components/attrList.vue'
import object from 'element-resize-detector/src/detection-strategy/object';
import attrList from './components/attrList.vue'
export default {
name: 'productAttr',
components: { addAttr, attrList },
@ -168,7 +167,7 @@ export default {
confirmButtonText: '确定',
callback: action => {
if (action == "confirm") {
productApi.delete(row).then(res => {
productApi.typeDelete(row).then(res => {
if (res.code == 20000) {
this.$message.success("操作成功!")
this.handleCurrentChange()

@ -1,6 +1,6 @@
<template>
<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">
<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">
@ -26,11 +26,10 @@
</el-form-item>
</el-form>
</div>
</el-card>
<el-card :bordered="false" shadow="never" class="ivu-mt mt16">
</el-card> -->
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
<el-button type="primary" class="bnt" @click="addClass">添加分类</el-button>
<el-table class="mt14" highlight-hover-row :loading="loading" header-row-class-name="false"
:tree-config="{ children: 'children' }" :data="tableData">
<el-table class="mt14" :loading="loading" :data="tableData">
<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="pic" label="分类图标" min-width="100">
@ -66,11 +65,10 @@
</template>
<script>
import edit from '@/components/Category/edit'
import { mapState } from 'vuex';
// import { productListApi, productCreateApi, productEditApi, setShowApi, treeListApi } from '@/api/product';
import edit from '@/components/Category/edit'
import editFrom from '../../../components/from/from';
import productApi from '@/api/product/productAttr.js';
import {loadingFn} from "@/utils/validate"
export default {
name: 'product_productClassify',
components: {
@ -92,40 +90,31 @@ export default {
xs: 24,
},
loading: false,
artFrom: {
pid: 0,
is_show: '',
page: 1,
cate_name: '',
limit: 15,
page: {
"currentPage": 1,
"pageSize": 10,
"params": {},
totalCount: 0
},
total: 0,
tableData: [],
};
},
computed: {
...mapState('admin/userLevel', ['categoryId']),
},
},
mounted() {
this.goodsCategory();
this.getList();
// this.goodsCategory();
// this.getList();
},
methods: {
//
goodsCategory() {
// treeListApi(0)
// .then((res) => {
// this.treeSelect = res.data;
// })
// .catch((res) => {
// this.$message.error(res.msg);
// });
goodsCategory() {
},
//
getList() {
this.loading = true;
this.artFrom.is_show = this.artFrom.is_show || '';
this.artFrom.pid = this.artFrom.pid || '';
// console.log(,'loadingFn')
// loadingFn(this.loading,productApi.classifyGetByPage(this.page))
// this.artFrom.is_show = this.artFrom.is_show || '';
// this.artFrom.pid = this.artFrom.pid || '';
// productListApi(this.artFrom)
// .then(async (res) => {
// let data = res.data;
@ -137,6 +126,7 @@ export default {
// this.loading = false;
// this.$message.error(res.msg);
// });
// productApi.classifyGetByPage()
},
pageChange(index) {
this.artFrom.page = index;

Loading…
Cancel
Save