商品列表,商品给分组列表接口增加参数

This commit is contained in:
YeMingfei666 2024-10-11 18:17:15 +08:00
parent 07d02ada45
commit 510122921e
1 changed files with 47 additions and 40 deletions

View File

@ -41,11 +41,11 @@
<view class="goods-list u-p-30"> <view class="goods-list u-p-30">
<template v-if="pageData.goodsList.length"> <template v-if="pageData.goodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index"> <view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" @changeClick="goodsChangeClick" <my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow"
@edit="toGoodsDetail" @changeClick="goodsChangeClick" @edit="toGoodsDetail" @editStock="changeStockShow"
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow" @guigeClick="editGuigeShow" @baosun="baosunShow" @radioClick="goodsRadioClick" :index="index"
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel" :data="item" @del="goodsDel" :showChecked="showChecked"
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods> :showDetail="pageData.showGoodsDetail"></my-goods>
</view> </view>
</template> </template>
<template v-if="pageData.hasAjax&&!pageData.goodsList.length"> <template v-if="pageData.hasAjax&&!pageData.goodsList.length">
@ -150,7 +150,9 @@
watch watch
} from 'vue'; } from 'vue';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import {hasPermission} from '@/commons/utils/hasPermission.js'; import {
hasPermission
} from '@/commons/utils/hasPermission.js';
import myGoods from './components/goods.vue' import myGoods from './components/goods.vue'
import myControl from './components/control.vue' import myControl from './components/control.vue'
import myCategory from './components/category.vue' import myCategory from './components/category.vue'
@ -191,10 +193,13 @@
query: { query: {
page: 0, page: 0,
size: 10, size: 10,
createdAt: [],
id: "",
categoryId: '', categoryId: '',
name: '', name: '',
isPauseSale:'', isPauseSale: '',
isGrounding:'' sort: "createdAt,desc",
isGrounding: ''
}, },
category: '', category: '',
categoryList: [], // categoryList: [], //
@ -288,8 +293,8 @@
// //
async function changeStockShow(index) { async function changeStockShow(index) {
const res= await hasPermission('允许修改商品库存') const res = await hasPermission('允许修改商品库存')
if(!res){ if (!res) {
return return
} }
pageData.selGoodsIndex = index pageData.selGoodsIndex = index
@ -393,9 +398,10 @@
pageData.totalElements = res.totalElements pageData.totalElements = res.totalElements
}) })
} }
function watchEmitInit(){
function watchEmitInit() {
uni.$off('update:productIndex') uni.$off('update:productIndex')
uni.$on('update:productIndex',(data)=>{ uni.$on('update:productIndex', (data) => {
getGoodsList() getGoodsList()
}) })
} }
@ -425,6 +431,7 @@
pageData.reportData = pageData.goodsList[index] pageData.reportData = pageData.goodsList[index]
reportDamage.value.open(); reportDamage.value.open();
} }
function returnGoodsStockData() { function returnGoodsStockData() {
return reactive({ return reactive({
sort: 0, sort: 0,
@ -493,14 +500,14 @@
}); });
} }
function resetQuery(){ function resetQuery() {
pageData.totalElements=0; pageData.totalElements = 0;
pageData.query.page=0; pageData.query.page = 0;
} }
async function toGoodsDetail(id){ async function toGoodsDetail(id) {
const res= await hasPermission('允许修改商品') const res = await hasPermission('允许修改商品')
if(!res){ if (!res) {
return return
} }
go.to('PAGES_PRODUCT_ADD', { go.to('PAGES_PRODUCT_ADD', {
@ -513,24 +520,24 @@
pageData.stateCurrent = index; pageData.stateCurrent = index;
resetQuery() resetQuery()
console.log(index); console.log(index);
if(index==0){ if (index == 0) {
pageData.query.isPauseSale='' pageData.query.isPauseSale = ''
pageData.query.isGrounding='' pageData.query.isGrounding = ''
return return
} }
if(index==1){ if (index == 1) {
pageData.query.isPauseSale=1 pageData.query.isPauseSale = 1
pageData.query.isGrounding='' pageData.query.isGrounding = ''
return return
} }
if(index==2){ if (index == 2) {
pageData.query.isPauseSale='' pageData.query.isPauseSale = ''
pageData.query.isGrounding=1 pageData.query.isGrounding = 1
return return
} }
if(index==3){ if (index == 3) {
pageData.query.isPauseSale='' pageData.query.isPauseSale = ''
pageData.query.isGrounding=0 pageData.query.isGrounding = 0
return return
} }
} }