feat(order): 支持线下付款先发货后结款流程
- 后端移除确认收款时订单状态限制,已发货订单确认收款后自动完成订单 - 管理后台订单列表和操作按钮区分线下付款未付款不同发货状态 - 离线付款弹窗新增发货状态字段及提示文案动态展示 - 订单详情支付状态标签区分已发货待收款状态,更新步骤条显示逻辑 - 小程序端订单状态文本和操作按钮支持线下付款先发货后结款场景
This commit is contained in:
@@ -95,3 +95,28 @@
|
||||
4. 订单信息区新增「配送方式」字段展示(使用 DELIVERY_TYPE_MAP)
|
||||
- deliveryType 值范围来自管理后台 deliveryModal.vue:0=快递配送, 1=无需发货(自提), 2=商家送货
|
||||
- ⚠️ 初次改错了项目(guilixu-taro),已用 git checkout 还原,正确改动在 xinlong-shop-taro
|
||||
|
||||
## 方案A:线下付款先发货后结款(三端同步改动)
|
||||
|
||||
### 后端(guilixu-java)
|
||||
1. `ShopOrderServiceImpl.confirmOfflinePayment()`:移除 `.eq(ShopOrder::getOrderStatus, 0)` 约束,允许已发货订单确认收款。新增逻辑:若 `deliveryStatus=20`(已发货),确认收款后自动 `setOrderStatus=1` 完成订单。
|
||||
2. `ShopOrderController.confirmOfflinePayment()`:更新 `@Operation` 描述和成功消息(不再固定写"进入待发货状态")。
|
||||
3. `ShopOrderService.java`:更新 Javadoc 描述。
|
||||
4. **注意**:Controller 的 `PUT /shop/shop-order`(update)接口发货时**不校验 payStatus**,仅判断 `deliveryStatus 10→20`,所以未付款的线下订单可以直接通过 update 接口发货(前端改 deliveryStatus 即可)。
|
||||
|
||||
### 管理后台(guilixu-admin)
|
||||
1. `src/views/shop/shopOrder/index.vue`:线下付款未付款订单(payType=9, payStatus=0, orderStatus=0)分两种情况:
|
||||
- `deliveryStatus=10`:同时显示「确认收款」+「发货」+「关闭」
|
||||
- `deliveryStatus=20`:仅显示「确认收款」(先发货后结款,已发货状态)
|
||||
2. `src/views/shop/shopOrder/components/OfflinePaymentModal.vue`:
|
||||
- 新增 `deliveryStatus` 表单字段 + `alertMessage` 计算属性:已发货时提示"确认后订单将自动完成",未发货时提示"进入待发货状态"。
|
||||
- 成功消息动态化:`deliveryStatus===20 ? '已自动完成' : '已进入待发货状态'`
|
||||
3. `src/views/shop/shopOrder/components/orderInfo.vue`:
|
||||
- 支付状态标签:`payType=9 && payStatus=0 && deliveryStatus=20` → 蓝色「已发货待收款」
|
||||
- `loadSteps()` 步骤条:线下付款未付款但已发货时,步骤条显示「下单→待收款→已发货」而非停留在「下单」
|
||||
|
||||
### 小程序端(xinlong-shop-taro)
|
||||
1. `src/pages/store/orders/index.tsx`:
|
||||
- `getStatusText()`:新增「已发货待收款」状态(`payType===9 && !payStatus && deliveryStatus===20`)
|
||||
- `getOrderActions()`:发货按钮条件放宽——线下付款未付款(`payType===9`)也能显示发货按钮(支持先发货后结款)
|
||||
- `OP_DESC`:确认收款描述移除"订单将进入待发货状态"(已不是唯一路径)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<a-alert
|
||||
type="info"
|
||||
show-icon
|
||||
message="确认已收到该订单的线下付款(微信转账/银行汇款等),确认后订单将进入待发货状态。"
|
||||
:message="alertMessage"
|
||||
style="margin-bottom: 16px"
|
||||
/>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { ref, reactive, watch, computed } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import type { UploadFile, UploadProps } from 'ant-design-vue';
|
||||
@@ -99,16 +99,25 @@
|
||||
orderId: undefined as number | undefined,
|
||||
orderNo: '' as string,
|
||||
paymentVoucher: '' as string,
|
||||
remarks: '' as string
|
||||
remarks: '' as string,
|
||||
deliveryStatus: undefined as number | undefined
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
paymentVoucher: [
|
||||
{ required: true, message: '请上传支付凭证' }
|
||||
{ required: false, message: '请上传支付凭证' }
|
||||
]
|
||||
};
|
||||
|
||||
// 根据发货状态显示不同的提示文案
|
||||
const alertMessage = computed(() => {
|
||||
if (form.deliveryStatus === 20) {
|
||||
return '该订单已发货,确认收到线下付款(微信转账/银行汇款等)后,订单将自动完成。';
|
||||
}
|
||||
return '确认已收到该订单的线下付款(微信转账/银行汇款等),确认后订单将进入待发货状态。';
|
||||
});
|
||||
|
||||
const formRef = ref();
|
||||
const { resetFields, validate } = useForm(form, rules);
|
||||
|
||||
@@ -197,7 +206,7 @@
|
||||
form.remarks || undefined,
|
||||
form.paymentVoucher || undefined
|
||||
);
|
||||
message.success('确认收款成功,订单已进入待发货状态');
|
||||
message.success(form.deliveryStatus === 20 ? '确认收款成功,订单已自动完成' : '确认收款成功,订单已进入待发货状态');
|
||||
emit('done');
|
||||
updateVisible(false);
|
||||
} catch (error: any) {
|
||||
@@ -218,6 +227,7 @@
|
||||
form.orderNo = props.data?.orderNo || '';
|
||||
form.paymentVoucher = '';
|
||||
form.remarks = '';
|
||||
form.deliveryStatus = props.data?.deliveryStatus;
|
||||
fileList.value = [];
|
||||
} else {
|
||||
resetFields();
|
||||
|
||||
@@ -74,7 +74,8 @@
|
||||
<a-tag v-if="form.payStatus == 1 && form.payType !== 8 && form.payType !== 9" color="green">已付款</a-tag>
|
||||
<a-tag v-if="form.payStatus == 1 && form.payType === 8" color="blue">待收货付款</a-tag>
|
||||
<a-tag v-if="form.payStatus == 1 && form.payType === 9" color="green">已确认收款</a-tag>
|
||||
<a-tag v-if="form.payStatus == 0 && form.payType === 9" color="orange">待确认收款</a-tag>
|
||||
<a-tag v-if="form.payStatus == 0 && form.payType === 9 && form.deliveryStatus === 20" color="blue">已发货待收款</a-tag>
|
||||
<a-tag v-if="form.payStatus == 0 && form.payType === 9 && form.deliveryStatus !== 20" color="orange">待确认收款</a-tag>
|
||||
<a-tag v-if="form.payStatus == 0 && form.payType !== 9">未付款</a-tag>
|
||||
<a-tag v-if="form.payStatus == 3">未付款,占场中</a-tag>
|
||||
</a-descriptions-item>
|
||||
@@ -754,7 +755,21 @@
|
||||
];
|
||||
} else if (order.payStatus === 0) {
|
||||
// 未付款
|
||||
active.value = 0;
|
||||
// 线下付款先发货后结款:已发货时步骤条显示发货状态
|
||||
if (order.payType === 9 && order.deliveryStatus === 20) {
|
||||
active.value = 2;
|
||||
steps.value[1].description = '待收款';
|
||||
steps.value[2].description = order.deliveryTime
|
||||
? toDateString(order.deliveryTime, 'MM-dd HH:mm')
|
||||
: '已发货';
|
||||
if (order.orderStatus === 1) {
|
||||
active.value = 4;
|
||||
steps.value[3].description = '已收货';
|
||||
steps.value[4].description = '订单完成';
|
||||
}
|
||||
} else {
|
||||
active.value = 0;
|
||||
}
|
||||
} else if (order.payStatus === 1) {
|
||||
// 已付款
|
||||
active.value = 1;
|
||||
|
||||
@@ -263,16 +263,26 @@
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- 线下付款·待确认收款状态的操作 -->
|
||||
<template v-if="!record.payStatus && record.orderStatus === 0 && record.payType === 9">
|
||||
<!-- 线下付款·待确认收款状态的操作(支持先发货后结款) -->
|
||||
<template v-if="!record.payStatus && record.orderStatus === 0 && record.payType === 9 && record.deliveryStatus === 10">
|
||||
<a @click.stop="handleConfirmOfflinePayment(record)" class="ele-text-success">
|
||||
<CheckCircleOutlined /> 确认收款
|
||||
</a>
|
||||
<a @click.stop="handleDelivery(record)" class="ele-text-primary">
|
||||
<SendOutlined /> 发货
|
||||
</a>
|
||||
<a @click.stop="handleCancelOrder(record)">
|
||||
<span class="ele-text-warning"> <CloseOutlined /> 关闭 </span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- 线下付款·已发货未收款状态的操作(先发货后结款) -->
|
||||
<template v-if="!record.payStatus && record.orderStatus === 0 && record.payType === 9 && record.deliveryStatus === 20">
|
||||
<a @click.stop="handleConfirmOfflinePayment(record)" class="ele-text-success">
|
||||
<CheckCircleOutlined /> 确认收款
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- 已付款未发货状态的操作 -->
|
||||
<template
|
||||
v-if="
|
||||
|
||||
Reference in New Issue
Block a user