mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-28 13:31:04 +00:00
fix(送礼订单): 送礼人隐藏履约评价售后入口;领取礼物选地址正确回跳确认页
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
e7e6a1a187
commit
d4fa21ea00
@ -54,8 +54,9 @@ class OrderCenterUserServices extends OrderCenterServices
|
||||
/**
|
||||
* 送礼订单详情按查看者身份裁剪渲染配置
|
||||
*
|
||||
* - 购买者:隐藏收货信息、物流轨迹,以及确认收货/申请退款/查看物流按钮;
|
||||
* - 领取人:只读视角,保留收货信息、物流轨迹与确认收货/查看物流按钮,
|
||||
* - 购买者(送礼人):隐藏收货信息、物流轨迹、售后进度,以及确认收货/申请退款/
|
||||
* 查看物流/去评价/申请售后/查看售后按钮(履约与评价由领取人侧处理);
|
||||
* - 领取人:只读视角,保留收货信息、物流轨迹与确认收货/查看物流/去评价按钮,
|
||||
* 隐藏金额/支付/发票等下单人信息。
|
||||
* 非送礼订单不做任何处理。
|
||||
*
|
||||
@ -90,19 +91,28 @@ class OrderCenterUserServices extends OrderCenterServices
|
||||
// 领取人:隐藏金额/支付/发票与下单人权益入口,保留收货信息、物流轨迹
|
||||
$sections = array_values(array_filter(
|
||||
$sections,
|
||||
fn($section) => !in_array($section['key'] ?? '', ['pricing', 'payment', 'invoice', 'coupon_gift', 'points_reward'], true)
|
||||
fn($section) => !in_array($section['key'] ?? '', ['pricing', 'invoice', 'coupon_gift', 'points_reward'], true)
|
||||
));
|
||||
$result['page_config']['extensions']['viewer_role'] = 'gift_receiver';
|
||||
// 领取人不可开票(非付款人);可评价/收货/看物流
|
||||
$visibleActions = ['confirmReceive', 'viewLogistics', 'goComment'];
|
||||
$hiddenActions = [];
|
||||
} else {
|
||||
// 购买者:不展示收货信息与物流轨迹,隐藏确认收货/申请退款/查看物流
|
||||
// 送礼人:不展示收货/物流/售后进度;隐藏履约、评价与售后入口(开票仍保留)
|
||||
$sections = array_values(array_filter(
|
||||
$sections,
|
||||
fn($section) => !in_array($section['key'] ?? '', ['delivery', 'logistics'], true)
|
||||
fn($section) => !in_array($section['key'] ?? '', ['delivery', 'logistics', 'after_sale'], true)
|
||||
));
|
||||
$result['page_config']['extensions']['viewer_role'] = 'gift_sender';
|
||||
$visibleActions = [];
|
||||
$hiddenActions = ['confirmReceive', 'applyRefund', 'viewLogistics'];
|
||||
$hiddenActions = [
|
||||
'confirmReceive',
|
||||
'applyRefund',
|
||||
'viewLogistics',
|
||||
'goComment',
|
||||
'applyAfterSale',
|
||||
'viewAfterSale',
|
||||
];
|
||||
}
|
||||
|
||||
// 按查看者身份处理礼物信息与底部操作按钮
|
||||
@ -224,13 +234,23 @@ class OrderCenterUserServices extends OrderCenterServices
|
||||
$itemExtra = $item['extra_info'] ?? [];
|
||||
$item['is_gift'] = (!empty($itemExtra['gift']) || isset($itemExtra['gift_mark'])) ? 1 : 0;
|
||||
$item['gift_price'] = $item['gift_price'] ?? '0.00';
|
||||
// 礼物领取人视角(非下单人):只读列表,仅保留查看物流,避免出现退款/取消/删除等下单人操作
|
||||
// 礼物领取人视角(非下单人):只读列表,仅保留收货/物流/评价
|
||||
$item['is_gift_receiver'] = ((int)($item['uid'] ?? 0) !== $uid && (int)($item['gift_uid'] ?? 0) === $uid) ? 1 : 0;
|
||||
if ($item['is_gift_receiver']) {
|
||||
$item['order_buttons'] = array_values(array_filter(
|
||||
$item['order_buttons'] ?? [],
|
||||
fn($button) => in_array($button['action'] ?? '', ['confirmReceive', 'viewLogistics', 'goComment'], true)
|
||||
));
|
||||
} elseif ((int)($item['is_gift'] ?? 0) === 1) {
|
||||
// 送礼人列表:与详情策略一致,不展示评价与售后(含退款)及履约相关按钮
|
||||
$item['order_buttons'] = array_values(array_filter(
|
||||
$item['order_buttons'] ?? [],
|
||||
fn($button) => !in_array(
|
||||
$button['action'] ?? '',
|
||||
['confirmReceive', 'applyRefund', 'viewLogistics', 'goComment', 'applyAfterSale', 'viewAfterSale'],
|
||||
true
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -567,7 +567,8 @@
|
||||
couponId.value = options.couponId || 0;
|
||||
noCoupon.value = Number(options.noCoupon) || 0;
|
||||
pinkId.value = options.pinkId ? parseInt(options.pinkId) : 0;
|
||||
addressId.value = options.addressId || 0;
|
||||
// 地址列表回跳可能带 addressId 或 address_id,两种都认
|
||||
addressId.value = options.addressId || options.address_id || 0;
|
||||
cartId.value = options.cartId;
|
||||
orderId.value = options.order_id || 0
|
||||
is_address.value = options.is_address ? true : false;
|
||||
|
||||
@ -151,6 +151,34 @@ function backToOrderCreate(addressId) {
|
||||
uni.$emit('orderCreateAddressSelect', { addressId: addressId });
|
||||
uni.navigateBack({ delta: 2 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否领取礼物选地址链路(is_gift=2)
|
||||
* 与正常购买 / 下单引擎回跳互斥,避免误进 center/order/create
|
||||
*/
|
||||
function isGiftReceiveFlow() {
|
||||
return Number(is_gift.value) === 2 && !!orderId.value;
|
||||
}
|
||||
|
||||
/** 回跳礼物确认页并带回新建/编辑后的地址 */
|
||||
function redirectGiftConfirm(addressId) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/goods/order_confirm/index?order_id=' + orderId.value +
|
||||
'&is_gift=2&addressId=' + addressId + '&is_address=1'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存地址后的统一回跳:礼物领取 → 礼物确认页;有 cartId → 正常下单页;其余原逻辑
|
||||
* @param {number|string} addressId
|
||||
*/
|
||||
function afterAddressSaved(addressId) {
|
||||
if (isGiftReceiveFlow() && addressId) {
|
||||
redirectGiftConfirm(addressId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
// 获取选择的地区
|
||||
function handleGetRegion(regionData) {
|
||||
@ -307,6 +335,10 @@ function getWxAddress() {
|
||||
type: 1,
|
||||
}).then(res => {
|
||||
setTimeout(function() {
|
||||
const savedId = id.value ? id.value : res.data.id;
|
||||
if (afterAddressSaved(savedId)) {
|
||||
return;
|
||||
}
|
||||
if (cartId.value) {
|
||||
let cartIdVal = cartId.value;
|
||||
let pinkIdVal = pinkId.value;
|
||||
@ -317,11 +349,7 @@ function getWxAddress() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/center/order/create/index?cartId=' +
|
||||
cartIdVal +
|
||||
'&address_id=' + (
|
||||
id.value ? id
|
||||
.value :
|
||||
res.data
|
||||
.id) +
|
||||
'&address_id=' + savedId +
|
||||
'&pinkId=' +
|
||||
pinkIdVal +
|
||||
'&couponId=' +
|
||||
@ -334,7 +362,7 @@ function getWxAddress() {
|
||||
'&order_id=' + orderId.value
|
||||
});
|
||||
} else if (from.value === 'order_create') {
|
||||
backToOrderCreate(id.value ? id.value : res.data.id);
|
||||
backToOrderCreate(savedId);
|
||||
} else {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
@ -401,6 +429,10 @@ function getAddress() {
|
||||
title: i18n.t(`添加成功`),
|
||||
icon: 'success'
|
||||
}, () => {
|
||||
const savedId = id.value ? id.value : res.data.id;
|
||||
if (afterAddressSaved(savedId)) {
|
||||
return;
|
||||
}
|
||||
if (cartId.value) {
|
||||
let cartIdVal = cartId.value;
|
||||
let pinkIdVal = pinkId.value;
|
||||
@ -410,15 +442,13 @@ function getAddress() {
|
||||
couponId.value = '';
|
||||
uni.navigateTo({
|
||||
url: '/pages/center/order/create/index?cartId=' +
|
||||
cartIdVal + '&address_id=' + (id.value ? id.value :
|
||||
res.data
|
||||
.id) + '&pinkId=' + pinkIdVal +
|
||||
cartIdVal + '&address_id=' + savedId + '&pinkId=' + pinkIdVal +
|
||||
'&couponId=' +
|
||||
couponIdVal + '&new=' + news.value + '&is_gift=' + is_gift.value +
|
||||
'&order_id=' + orderId.value
|
||||
});
|
||||
} else if (from.value === 'order_create') {
|
||||
backToOrderCreate(id.value ? id.value : res.data.id);
|
||||
backToOrderCreate(savedId);
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/user_address_list/index'
|
||||
@ -482,6 +512,10 @@ function formSubmit(e) {
|
||||
icon: 'success'
|
||||
});
|
||||
setTimeout(function() {
|
||||
const savedId = id.value ? id.value : res.data.id;
|
||||
if (afterAddressSaved(savedId)) {
|
||||
return;
|
||||
}
|
||||
if (cartId.value) {
|
||||
let cartIdVal = cartId.value;
|
||||
let pinkIdVal = pinkId.value;
|
||||
@ -491,15 +525,14 @@ function formSubmit(e) {
|
||||
couponId.value = '';
|
||||
uni.navigateTo({
|
||||
url: '/pages/center/order/create/index?new=' + news.value +
|
||||
'&cartId=' + cartIdVal + '&address_id=' + (id.value ? id.value :
|
||||
res.data.id) + '&pinkId=' + pinkIdVal + '&couponId=' +
|
||||
'&cartId=' + cartIdVal + '&address_id=' + savedId + '&pinkId=' + pinkIdVal + '&couponId=' +
|
||||
couponIdVal +
|
||||
'&noCoupon=' + noCoupon
|
||||
.value + '&is_gift=' + is_gift.value +
|
||||
'&order_id=' + orderId.value
|
||||
});
|
||||
} else if (from.value === 'order_create') {
|
||||
backToOrderCreate(id.value ? id.value : res.data.id);
|
||||
backToOrderCreate(savedId);
|
||||
} else {
|
||||
// #ifdef H5
|
||||
return history.back();
|
||||
|
||||
@ -368,6 +368,22 @@ function addAddress() {
|
||||
(from.value === 'order_create' ? '&from=order_create' : '')
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 是否领取礼物选地址链路(is_gift=2)
|
||||
* 与正常购买 / 下单引擎回跳互斥,避免误进 center/order/create
|
||||
*/
|
||||
function isGiftReceiveFlow() {
|
||||
return Number(is_gift.value) === 2 && !!orderId.value;
|
||||
}
|
||||
|
||||
/** 回跳礼物确认页并带回选中地址 */
|
||||
function redirectGiftConfirm(addressId) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/goods/order_confirm/index?order_id=' + orderId.value +
|
||||
'&is_gift=2&addressId=' + addressId + '&is_address=1'
|
||||
});
|
||||
}
|
||||
|
||||
function goOrder(id) {
|
||||
let cartIdVal = '';
|
||||
let pinkIdVal = '';
|
||||
@ -379,6 +395,11 @@ function goOrder(id) {
|
||||
uni.navigateBack();
|
||||
return;
|
||||
}
|
||||
// 领取礼物:回到礼物确认页,不走正常购买下单页
|
||||
if (isGiftReceiveFlow() && id) {
|
||||
redirectGiftConfirm(id);
|
||||
return;
|
||||
}
|
||||
if (cartId.value && id) {
|
||||
cartIdVal = cartId.value;
|
||||
pinkIdVal = pinkId.value;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user