This commit is contained in:
GaoHao 2024-10-21 10:40:41 +08:00
commit ae82be372d
3 changed files with 30 additions and 6 deletions

View File

@ -64,6 +64,8 @@
// import Sortable from 'sortablejs'
import addClassify from './components/addClassify'
import { tbShopCategoryGet, tbShopCategoryDelete, tbShopCategoryPost, upCategorySort } from '@/api/shop'
import { hasPermission } from '@/utils/limits.js'
export default {
components: {
addClassify
@ -114,6 +116,9 @@ export default {
// },
//
async showChange(e, row) {
let res = await hasPermission('允许修改分类');
if ( !res) { row.isShow = (e == 0 ? 1 : 0);return; }
try {
await tbShopCategoryPost(row, 'put')
this.getTableData()
@ -141,6 +146,8 @@ export default {
},
//
async delHandle(ids) {
let res = await hasPermission('允许修改分类');
if ( !res) { return; }
try {
await tbShopCategoryDelete(ids)
this.$notify({

View File

@ -48,6 +48,7 @@
<script>
import Sortable from 'sortablejs'
import addGroup from '../components/addGroup'
import { hasPermission } from '@/utils/limits.js'
import { tbProductGroupGet, tbProductGroupDelete, tbProductGroupPut, upGroupSort } from '@/api/shop'
export default {
components: {
@ -92,12 +93,15 @@ export default {
return a + ' - ' + ciri + b
},
//
tableDrag() {
async tableDrag() {
const el = document.querySelector('#table_drag .el-table__body-wrapper tbody')
new Sortable(el, {
animation: 150,
onEnd: async e => {
// console.log('===', e);
let res = await hasPermission('允许修改分组');
if ( !res) { return; }
if (e.oldIndex == e.newIndex) return
let oid = this.tableData.list[e.oldIndex].id
let nid = this.tableData.list[e.newIndex].id
@ -117,6 +121,9 @@ export default {
},
//
async showChange(e, row) {
let res = await hasPermission('允许修改分组');
if ( !res) { row.isShow = (e == 0 ? 1 : 0);return; }
try {
await tbProductGroupPut(row)
this.getTableData()
@ -136,6 +143,8 @@ export default {
},
//
async delHandle(ids) {
let res = await hasPermission('允许修改分组');
if ( !res) { return; }
try {
await tbProductGroupDelete(ids)
this.$notify({

View File

@ -20,9 +20,9 @@
</div>
<div class="head-container">
<div class="header_wrap">
<router-link :to="{ name: 'add_shop' }">
<el-button type="primary" icon="el-icon-plus">添加商品</el-button>
</router-link>
<!-- <router-link :to="{ name: 'add_shop' }" > -->
<el-button type="primary" icon="el-icon-plus" @click="toPath( '/product/add_shop')">添加商品</el-button>
<!-- </router-link> -->
<el-select v-model="tableData.sort" placeholder="排序" @change="getTableData">
<el-option value="createdAt,desc" label="创建时间"></el-option>
<el-option value="stockNumber,asc" label="数量由低到高"></el-option>
@ -318,7 +318,11 @@ export default {
async toPath ( path , row) {
let res = await hasPermission('允许修改商品');
if ( !res) { return; }
this.$router.push({path: path, query: { goods_id: row.id }})
let query = {};
if ( row ) {
query.goods_id = row.id;
}
this.$router.push({path: path, query: query})
},
// 线
showStockWarningHandle() {
@ -431,7 +435,9 @@ export default {
}
},
//
showBindCons(item) {
async showBindCons(item) {
let res = await hasPermission('允许修改商品');
if ( !res) { return; }
// console.log(item);
this.$refs.bindCons.show(item)
},
@ -555,6 +561,8 @@ export default {
},
//
async delTableHandle(ids) {
let res = await hasPermission('允许修改商品');
if ( !res) { return; }
try {
await tbProductDelete(ids)
this.getTableData()