diff --git a/pages/shop/SellerDetail.vue b/pages/shop/SellerDetail.vue index 2f9ae10..47a86ab 100644 --- a/pages/shop/SellerDetail.vue +++ b/pages/shop/SellerDetail.vue @@ -377,15 +377,14 @@ }) .then((res) => { if (this.identity == 0) { - // 商家视角:优先使用手艺人信息,若没有则使用商家自己的信息 - const provider = res.data.user_syr || res.data.user_sj || {}; + const userSyr = res.data.user_syr || {}; // 避免 null 展开报错 this.orderInfo = res.data ? { - ...res.data.order, - ...res.data.work_seat, - ...provider, - work_hour_id: res.data.work_seat.id, - order_id: res.data.order.id, - user_sj_id: provider.id, + ...res.data.order, + ...res.data.work_seat, + ...userSyr, + work_hour_id: res.data.work_seat.id, + order_id: res.data.order.id, + syr_id: userSyr.id, // 用于判断是否有手艺人/顾客信息 } : {}; } else if (this.identity == 1) { // 手艺人视角 diff --git a/pages/shop/manHourDetail.vue b/pages/shop/manHourDetail.vue index 29fd098..5229af5 100644 --- a/pages/shop/manHourDetail.vue +++ b/pages/shop/manHourDetail.vue @@ -411,13 +411,14 @@ }) .then((res) => { if (this.identity == 0) { + const userSyr = res.data.user_syr || {}; // 避免 null 展开报错 this.orderInfo = res.data ? { ...res.data.order, ...res.data.work_hour, - ...res.data.user_syr, + ...userSyr, // 有手艺人就展开,没有就是空对象 work_hour_id: res.data.work_hour.id, order_id: res.data.order.id, - user_sj_id: res.data.user_syr.id, + syr_id: userSyr.id, // 手艺人ID(无手艺人时为 undefined) } : {}; console.log(this.orderInfo, '----------------------------------') } else if (this.identity == 1) {