1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

添加管理员后台取消订单并退款功能;订单发货、取消订单添加二次确认弹窗

This commit is contained in:
程序员小墨 2023-04-24 22:34:00 +08:00
parent 2d82571303
commit 9a8f3d050c
5 changed files with 54 additions and 13 deletions

View File

@ -362,6 +362,22 @@ const envVersion = "【⚠此处修改为当前小程序环境】" // 正式版
##### 配置 Gateway 限流策略(可选)
> 如果你不懂这是在做什么,请直接跳过这一步
修改 `backend/microservice-gateway/src/main/resources/application.yml` 文件中 `routes` 中各个微服务的 `filters` 例如:
```yml
filters: # 路由过滤器,使用自定义的限流过滤器工厂
- name: RateLimitByIp # 设置每秒允许5个请求每次请求需要1个令牌
args:
rate: 5.0
permits: 1
```
##### 打 jar 包
IDEA 中右侧 Maven 双击 Lifestyle 的 package打包完成后的 jar 包可在以下位置找到

View File

@ -295,13 +295,12 @@ public class OrderController {
/**
* 管理员取消订单
*
* @param params
* @param orderId
* @return
*/
@PostMapping("/manage/cancelOrder")
@ResponseBody
public Res cancelOrderByManager(@RequestBody JSONObject params) {
Long orderId = params.getLong("orderId");
public Res cancelOrderByManager(Long orderId) {
if (orderId == null) {
return Res.error("参数错误");
}

View File

@ -42,7 +42,7 @@ export function deliverOrder(params) {
* 关闭订单
* @returns
*/
export function cancelOrder(params) {
export function withdrawOrder(params) {
return send_request({
url: '/shop/order/manage/cancelOrder',
method: 'POST',

View File

@ -86,6 +86,8 @@
<!-- 该订单已被取消 -->
<template #footer>
<span class="dialog-footer">
<el-button v-if="orderDetail.orderStatusCode == 'Processing'" type="danger"
@click="withdrawOrder">取消发货并退款</el-button>
<el-button
v-if="orderDetail.orderStatusCode == 'Processing' || orderDetail.orderStatusCode == 'Shipped'"
type="primary" @click="saveEdit">保存发货信息</el-button>
@ -142,14 +144,38 @@ const editHandle = async function (tabIndex: number, row: any, refreshFunc: Func
const saveEdit = function () {
//
ElMessageBox.confirm('确定要进行发货操作吗?发货后订单将不可撤销。(用户点击收货前仍可以修改发货信息)', '提示', { type: 'warning' })
.then(async () => {
shopOrderApi.deliverOrder({
orderId: orderDetail.value.id,
...shippingInfo.value
}).then(function (data) {
if (data) { //
ElMessage.success({ message: data })
visible.value = false
completeCallback()
}
})
})
.catch(() => { });
}
const withdrawOrder = function () {
//
ElMessageBox.confirm('确定要取消此订单吗?该操作不可撤销。', '提示', { type: 'warning' })
.then(async () => {
shopOrderApi.withdrawOrder({
orderId: orderDetail.value.id,
...shippingInfo.value
}).then(function (data) {
if (data) { //
ElMessage.success({ message: data })
visible.value = false
completeCallback()
}
})
})
.catch(() => { });
}
</script>