From 9e938d6d34370703a2763493f67016cf27db55b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BD=B3=E5=AE=87?= <17601616548@163.com> Date: Sat, 28 Sep 2024 22:29:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=B7=E6=BA=90ID=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- h5/pages/main/tjyy/tjyy.vue | 28 +++++++++++++++------------- h5/pages/main/yytjsj/yytjsj.vue | 16 +++++++++------- h5/store/index.js | 3 ++- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/h5/pages/main/tjyy/tjyy.vue b/h5/pages/main/tjyy/tjyy.vue index 4048789..b9eb881 100755 --- a/h5/pages/main/tjyy/tjyy.vue +++ b/h5/pages/main/tjyy/tjyy.vue @@ -51,12 +51,14 @@ const getnmrList = async () => { return { ...val, time: "", + id: "", }; });; yytjInfo.value.nmr_list.push({ item_id: -1, name: "体检时间", - time: "" + time: "", + id: "", }) } uni.hideLoading(); @@ -71,19 +73,19 @@ const comfrimyy = async () => { // return; // } // console.log(yytjInfo.value?.nmr_list); - // for(let i = 0; i < yytjInfo.value?.nmr_list?.length; i++){ - // if(!yytjInfo.value?.nmr_list[i].time){ - // uni.$lu.toast("请选择预约时间"); - // return; - // } - // } + for(let i = 0; i < yytjInfo.value?.nmr_list?.length; i++){ + if(!yytjInfo.value?.nmr_list[i].time){ + uni.$lu.toast("请选择预约时间"); + return; + } + } - // if(yytjInfo.value?.nmr_list?.length > 1){ - // plan_nmr_id = yytjInfo.value?.nmr_list[0]?.id; - // } - // if(yytjInfo.value?.nmr_list?.length > 1){ - // plan_id = yytjInfo.value?.nmr_list[yytjInfo.value?.nmr_list.length - 1]?.id; - // } + if(yytjInfo.value?.nmr_list?.length > 1){ + plan_nmr_id = yytjInfo.value?.nmr_list[0]?.id; + } + if(yytjInfo.value?.nmr_list?.length > 1){ + plan_id = yytjInfo.value?.nmr_list[yytjInfo.value?.nmr_list.length - 1]?.id; + } console.log(groupInfo.value); diff --git a/h5/pages/main/yytjsj/yytjsj.vue b/h5/pages/main/yytjsj/yytjsj.vue index 2ae38d4..c72fb09 100755 --- a/h5/pages/main/yytjsj/yytjsj.vue +++ b/h5/pages/main/yytjsj/yytjsj.vue @@ -32,7 +32,8 @@ const mountedAction = async () => { uni.showLoading({ title: "加载中", }); - await init(); // + console.log($store.getYytjInfo(), "swsw"); + console.log($store.getBuyInfo(), "tyuiopiuytr"); yytjInfo.value = $store.getYytjInfo(); buyInfo.value = $store.getBuyInfo(); await getnmrList(); @@ -44,8 +45,6 @@ onBeforeUnmount(() => { } }); -const init = async () => {}; - const getnmrList = async () => { const response = await $api("BuyInfo", buyInfo.value); $response(response, () => { @@ -57,6 +56,7 @@ const getnmrList = async () => { itemsInfo.value = response.data.items_info; truePrice.value = response.data.true_price; currentDate.value = getToday(); //huo获取今天的日期 + if (!yytjInfo.value?.nmr_list?.length) { yytjInfo.value.nmr_list = response.data.nmr_list.map((val) => { return { @@ -101,7 +101,7 @@ const getTjTimeList = async (val) => { use_type: buyInfo.value.group_id ? 2 : 1, checkup_type_id: buyInfo.value.group_id ? $store.getGroupInfo()?.checkup_type_id - : $store.getCheckupTypeId().id, + : $store.getCheckupTypeId()?.id, amount: truePrice.value, }; apiText = "GetDayPlanList"; @@ -123,11 +123,11 @@ const getTjTimeList = async (val) => { time_list.value.forEach((item) => { console.log(item.date); item.newTime = item.time.slice(0, 5); - item.date = currentDate.value; + item.date = currentDate.value; }); date_list.value.forEach((item) => { - console.log(item) - item.item_id = val.item_id; + console.log(item); + item.item_id = val.item_id; const [year, month, day] = item.date.split("-"); item.newMonthDate = `${month}/${day}`; //月份日期 item.newWeek = item.xingqi.replace("星期", "周"); @@ -183,6 +183,8 @@ const xmmcClick = (val, index) => { timeIndex.value = null; if (val.time) { currentDate.value = val.time.split(" ")[0]; + } else { + currentDate.value = getToday(); } // 体检号源 getTjTimeList(val); diff --git a/h5/store/index.js b/h5/store/index.js index 2596b0a..bc88a59 100644 --- a/h5/store/index.js +++ b/h5/store/index.js @@ -22,7 +22,7 @@ export const useStore = defineStore('counter', { }), actions: { getCheckupTypeId() { - return JSON.parse(uni.getStorageSync('CHECKUP_TYPE')) || this.checkup_type; + return JSON.parse(uni.getStorageSync('CHECKUP_TYPE') || '{}') || this.checkup_type; }, setCheckupTypeId(data) { this.checkup_type = data; @@ -42,6 +42,7 @@ export const useStore = defineStore('counter', { uni.setStorageSync('YYTJ_INFO', JSON.stringify(yytjInfo)); }, getYytjInfo() { + console.log(uni.getStorageSync('YYTJ_INFO')); return JSON.parse(uni.getStorageSync('YYTJ_INFO') || '{}') || this.yytjInfo; }, setUser(user) {