商品分类修复:

1.详情更新,列表未更新
2.开启库存后不填写库存,保存报错
3.多规格库存数量编辑权限验证
This commit is contained in:
YeMingfei666 2024-10-15 16:53:09 +08:00
parent 982bc23d3f
commit 61c455cdb7
3 changed files with 23 additions and 14 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="page"> <view class="page min-page">
<view class="box"> <view class="box">
<view> <view>
<uni-forms :model="category" :rules="rules" err-show-type="toast" ref="form" <uni-forms :model="category" :rules="rules" err-show-type="toast" ref="form"
@ -649,8 +649,9 @@
infoBox.showToast(option.type === 'edit' ? '修改成功' : '添加成功') infoBox.showToast(option.type === 'edit' ? '修改成功' : '添加成功')
timer = setTimeout(() => { timer = setTimeout(() => {
clearTimeout(timer) clearTimeout(timer)
uni.$emit('update:pageCategoryIndex')
go.back() go.back()
}, 1500); }, 500);
// const res = await form.value.validate().then(res => { // const res = await form.value.validate().then(res => {
// go.back() // go.back()
// }) // })

View File

@ -25,20 +25,18 @@
<view class="u-m-t-24 u-flex u-row-between"> <view class="u-m-t-24 u-flex u-row-between">
<view > <view >
<template v-if="data.childrenList.length"> <!-- <template v-if="data.childrenList.length">
<view class="u-flex color-999 u-flex u-col-center" @tap="useTypeClick"> <view class="u-flex color-999 u-flex u-col-center" @tap="useTypeClick">
<text class="u-font-24">{{computedUserType}} </text> <text class="u-font-24">{{computedUserType}} </text>
<view class="u-flex"> <view class="u-flex">
<uni-icons type="right" color="#999"></uni-icons> <uni-icons type="right" color="#999"></uni-icons>
</view> </view>
</view> </view>
</template> </template> -->
<template v-else>
<view class="u-flex"> <view class="u-flex">
<view class="u-m-r-18 color-999">开关</view> <view class="u-m-r-18 color-999">开关</view>
<my-switch v-model="isShow" @change="isShowChange"></my-switch> <my-switch v-model="isShow" @change="isShowChange"></my-switch>
</view> </view>
</template>
</view> </view>
<view class="u-flex no-wrap"> <view class="u-flex no-wrap">
@ -54,6 +52,7 @@
import { import {
computed, computed,
ref, ref,
watch,
watchEffect watchEffect
} from 'vue'; } from 'vue';
import mySwitch from '@/components/my-components/my-switch.vue' import mySwitch from '@/components/my-components/my-switch.vue'
@ -71,7 +70,9 @@
data: { data: {
type: Object, type: Object,
default: () => { default: () => {
return {} return {
isShow:true
}
} }
}, },
showChecked: { showChecked: {
@ -79,8 +80,10 @@
default: false default: false
} }
}) })
let isShow=ref(props.data.isShow) let isShow=ref(props.data.isShow)
watch(()=>props.data.isShow,(newval)=>{
isShow.value=newval
})
function isShowChange(){ function isShowChange(){
console.log(isShow.value); console.log(isShow.value);
emits('isShowChange',{...props.data,isShow:isShow.value}) emits('isShowChange',{...props.data,isShow:isShow.value})

View File

@ -96,14 +96,10 @@
import { import {
reactive, ref, watch reactive, ref, watch
} from 'vue'; } from 'vue';
import {onShow} from '@dcloudio/uni-app' import {onShow,onLoad} from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import myCategory from './components/category.vue' import myCategory from './components/category.vue'
import infoBox from "@/commons/utils/infoBox.js" import infoBox from "@/commons/utils/infoBox.js"
import myPagination from '@/components/my-components/my-pagination.vue'
import myModel from "@/components/my-components/my-model.vue"
import myButton from "@/components/my-components/my-button.vue"
import mySwitch from "@/components/my-components/my-switch.vue"
import {$productCategory} from '@/http/yskApi/goods.js' import {$productCategory} from '@/http/yskApi/goods.js'
@ -162,9 +158,18 @@
}) })
pageData.totalElements=res.totalElements pageData.totalElements=res.totalElements
} }
onShow(()=>{ onLoad(()=>{
init() init()
}) })
function watchEvent(){
uni.$off('update:pageCategoryIndex')
uni.$on('update:pageCategoryIndex',(data)=>{
init()
})
}
onShow(()=>{
watchEvent()
})
function toAddCategory(){ function toAddCategory(){
go.to('PAGES_CATEGORY_EDIT',{type:'add'}) go.to('PAGES_CATEGORY_EDIT',{type:'add'})
} }