diff --git a/pages.json b/pages.json index 7b19f3b..78e4a89 100644 --- a/pages.json +++ b/pages.json @@ -639,7 +639,7 @@ } }, { - "pageId": "PAGES_ADD_TEMP_CUISINE", + "pageId": "PAGES_CHOOSE_ADD_TEMP_CUISINE", "path": "add-temp-cuisine/add-temp-cuisine", "style": { "navigationBarTitleText": "添加临时菜" diff --git a/pagesCreateOrder/add-temp-cuisine/add-temp-cuisine.vue b/pagesCreateOrder/add-temp-cuisine/add-temp-cuisine.vue index 0ef2d25..e7536a8 100644 --- a/pagesCreateOrder/add-temp-cuisine/add-temp-cuisine.vue +++ b/pagesCreateOrder/add-temp-cuisine/add-temp-cuisine.vue @@ -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({ + }) diff --git a/pagesCreateOrder/confirm-order/components/discount.vue b/pagesCreateOrder/confirm-order/components/discount.vue index 478f954..231ffae 100644 --- a/pagesCreateOrder/confirm-order/components/discount.vue +++ b/pagesCreateOrder/confirm-order/components/discount.vue @@ -1,9 +1,9 @@