单品改价

This commit is contained in:
duan
2024-12-03 16:19:48 +08:00
parent 74d644c46b
commit c4f43a0626
5 changed files with 166 additions and 75 deletions

View File

@@ -125,9 +125,12 @@
reactive,
onMounted,
ref,
onBeforeMount
onBeforeMount,
} from 'vue';
import {onLoad} from '@dcloudio/uni-app'
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
const units = reactive({
list: [],
current: ''
@@ -187,11 +190,12 @@
}]
},
}
let timer=null
let timer = null
function submit() {
refform.value.validate(res => {
console.log(res)
if(!res){
if (!res) {
$temporaryDishes({
"useType": option.useType,
"masterId": option.masterId,
@@ -200,15 +204,15 @@
"categoryId": category[categoryCurrent.value].id,
"price": form.price,
"num": form.num,
unit:units.list[units.current].id,
unit: units.list[units.current].id,
"note": form.note,
"vipUserId": option.vipUserId
}).then(r=>{
}).then(r => {
uni.$emit('add:cashCai')
clearInterval(timer)
timer=setTimeout(()=>{
timer = setTimeout(() => {
uni.navigateBack()
},500)
}, 500)
})
}
}).catch(err => {
@@ -234,7 +238,7 @@
page: 0,
size: 600
})
const arr = returnAllCategory(res.content).map(v => {
const arr = forList(res.content).map(v => {
return {
...v,
value: v.id
@@ -244,23 +248,39 @@
for (let i in arr) {
category[i] = arr[i]
}
console.log(category);
}
function forList(arr) {
let arrs = []
arr.forEach(ele => {
arrs.push(ele)
if (ele.childrenList.length) {
ele.childrenList.forEach(res => {
arrs.push(res)
})
}
})
return arrs
}
async function init() {
getTbShopUnit()
getCategory()
}
onMounted(() => {
init()
// onMounted(() => {
// init()
// })
onLoad((opt) => {
Object.assign(option, opt)
setTimeout(() => {
init()
}, 600)
})
onBeforeMount(()=>{
onBeforeMount(() => {
clearInterval(timer)
})
const option=reactive({
})
onLoad((opt)=>{
Object.assign(option,opt)
const option = reactive({
})
</script>