修复号源ID为空的bug

wenjuan
刘佳宇 1 year ago
parent 6a2db40e55
commit 9e938d6d34

@ -51,12 +51,14 @@ const getnmrList = async () => {
return { return {
...val, ...val,
time: "", time: "",
id: "",
}; };
});; });;
yytjInfo.value.nmr_list.push({ yytjInfo.value.nmr_list.push({
item_id: -1, item_id: -1,
name: "体检时间", name: "体检时间",
time: "" time: "",
id: "",
}) })
} }
uni.hideLoading(); uni.hideLoading();
@ -71,19 +73,19 @@ const comfrimyy = async () => {
// return; // return;
// } // }
// console.log(yytjInfo.value?.nmr_list); // console.log(yytjInfo.value?.nmr_list);
// for(let i = 0; i < yytjInfo.value?.nmr_list?.length; i++){ for(let i = 0; i < yytjInfo.value?.nmr_list?.length; i++){
// if(!yytjInfo.value?.nmr_list[i].time){ if(!yytjInfo.value?.nmr_list[i].time){
// uni.$lu.toast(""); uni.$lu.toast("请选择预约时间");
// return; return;
// } }
// } }
// if(yytjInfo.value?.nmr_list?.length > 1){ if(yytjInfo.value?.nmr_list?.length > 1){
// plan_nmr_id = yytjInfo.value?.nmr_list[0]?.id; plan_nmr_id = yytjInfo.value?.nmr_list[0]?.id;
// } }
// if(yytjInfo.value?.nmr_list?.length > 1){ if(yytjInfo.value?.nmr_list?.length > 1){
// plan_id = yytjInfo.value?.nmr_list[yytjInfo.value?.nmr_list.length - 1]?.id; plan_id = yytjInfo.value?.nmr_list[yytjInfo.value?.nmr_list.length - 1]?.id;
// } }
console.log(groupInfo.value); console.log(groupInfo.value);

@ -32,7 +32,8 @@ const mountedAction = async () => {
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",
}); });
await init(); // console.log($store.getYytjInfo(), "swsw");
console.log($store.getBuyInfo(), "tyuiopiuytr");
yytjInfo.value = $store.getYytjInfo(); yytjInfo.value = $store.getYytjInfo();
buyInfo.value = $store.getBuyInfo(); buyInfo.value = $store.getBuyInfo();
await getnmrList(); await getnmrList();
@ -44,8 +45,6 @@ onBeforeUnmount(() => {
} }
}); });
const init = async () => {};
const getnmrList = async () => { const getnmrList = async () => {
const response = await $api("BuyInfo", buyInfo.value); const response = await $api("BuyInfo", buyInfo.value);
$response(response, () => { $response(response, () => {
@ -57,6 +56,7 @@ const getnmrList = async () => {
itemsInfo.value = response.data.items_info; itemsInfo.value = response.data.items_info;
truePrice.value = response.data.true_price; truePrice.value = response.data.true_price;
currentDate.value = getToday(); //huo currentDate.value = getToday(); //huo
if (!yytjInfo.value?.nmr_list?.length) { if (!yytjInfo.value?.nmr_list?.length) {
yytjInfo.value.nmr_list = response.data.nmr_list.map((val) => { yytjInfo.value.nmr_list = response.data.nmr_list.map((val) => {
return { return {
@ -101,7 +101,7 @@ const getTjTimeList = async (val) => {
use_type: buyInfo.value.group_id ? 2 : 1, use_type: buyInfo.value.group_id ? 2 : 1,
checkup_type_id: buyInfo.value.group_id checkup_type_id: buyInfo.value.group_id
? $store.getGroupInfo()?.checkup_type_id ? $store.getGroupInfo()?.checkup_type_id
: $store.getCheckupTypeId().id, : $store.getCheckupTypeId()?.id,
amount: truePrice.value, amount: truePrice.value,
}; };
apiText = "GetDayPlanList"; apiText = "GetDayPlanList";
@ -123,11 +123,11 @@ const getTjTimeList = async (val) => {
time_list.value.forEach((item) => { time_list.value.forEach((item) => {
console.log(item.date); console.log(item.date);
item.newTime = item.time.slice(0, 5); item.newTime = item.time.slice(0, 5);
item.date = currentDate.value; item.date = currentDate.value;
}); });
date_list.value.forEach((item) => { date_list.value.forEach((item) => {
console.log(item) console.log(item);
item.item_id = val.item_id; item.item_id = val.item_id;
const [year, month, day] = item.date.split("-"); const [year, month, day] = item.date.split("-");
item.newMonthDate = `${month}/${day}`; // item.newMonthDate = `${month}/${day}`; //
item.newWeek = item.xingqi.replace("星期", "周"); item.newWeek = item.xingqi.replace("星期", "周");
@ -183,6 +183,8 @@ const xmmcClick = (val, index) => {
timeIndex.value = null; timeIndex.value = null;
if (val.time) { if (val.time) {
currentDate.value = val.time.split(" ")[0]; currentDate.value = val.time.split(" ")[0];
} else {
currentDate.value = getToday();
} }
// //
getTjTimeList(val); getTjTimeList(val);

@ -22,7 +22,7 @@ export const useStore = defineStore('counter', {
}), }),
actions: { actions: {
getCheckupTypeId() { getCheckupTypeId() {
return JSON.parse(uni.getStorageSync('CHECKUP_TYPE')) || this.checkup_type; return JSON.parse(uni.getStorageSync('CHECKUP_TYPE') || '{}') || this.checkup_type;
}, },
setCheckupTypeId(data) { setCheckupTypeId(data) {
this.checkup_type = data; this.checkup_type = data;
@ -42,6 +42,7 @@ export const useStore = defineStore('counter', {
uni.setStorageSync('YYTJ_INFO', JSON.stringify(yytjInfo)); uni.setStorageSync('YYTJ_INFO', JSON.stringify(yytjInfo));
}, },
getYytjInfo() { getYytjInfo() {
console.log(uni.getStorageSync('YYTJ_INFO'));
return JSON.parse(uni.getStorageSync('YYTJ_INFO') || '{}') || this.yytjInfo; return JSON.parse(uni.getStorageSync('YYTJ_INFO') || '{}') || this.yytjInfo;
}, },
setUser(user) { setUser(user) {

Loading…
Cancel
Save