进入Order History页面:
http://localhost:4200/electronics-spa/en/USD/my-account/order/00001075
点击 Cancel Items:
这个按钮会路由到一个 cancel 页面去:
选择要cancel的行项目:
selector:cx-cancel-order
点击Continue按钮后的处理函数:continue($event)
continue函数里,进行另一个路由跳转:
这说明Commerce Cloud 订单取消是基于行项目的:
form 的提交请求按钮,没有具体实现,类型为submit,因此需要去最上层,找到form的实现:
cx-cancel-order-confirmation节点下面,有form节点:
cx-cancel-order-confirmation
下图第26行的submit函数,即submit按钮点击后的处理函数。
cancer-order-confirmation.component.ts
this.userOrderService.cancelOrder
CancelOrderConfirmationComponent里的实现代码:
save() { const orderCode = this.form.value.orderCode; const entries = this.form.value.entries; const inputs = Object.keys(entries) .filter((entryNumber) => entries[entryNumber] > 0) .map((entryNumber) => ({ orderEntryNumber: Number(entryNumber), quantity: entries[entryNumber], })); this.form.reset(); this.userOrderService.cancelOrder(orderCode, { cancellationRequestEntryInputs: inputs, }); this.userOrderService .getCancelOrderSuccess() .pipe(first(Boolean)) .subscribe(() => this.afterSave(orderCode)); }
订单取消成功后,状态变为Cancelled:
An invoice has been sent by email.
cancellationAndReturn