添加管理员后台取消订单并退款功能;订单发货、取消订单添加二次确认弹窗
This commit is contained in:
		@@ -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',
 | 
			
		||||
 
 | 
			
		||||
@@ -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 () {
 | 
			
		||||
    // 保存发货信息
 | 
			
		||||
    shopOrderApi.deliverOrder({
 | 
			
		||||
        orderId: orderDetail.value.id,
 | 
			
		||||
        ...shippingInfo.value
 | 
			
		||||
    }).then(function (data) {
 | 
			
		||||
        ElMessage.success({ message: data })
 | 
			
		||||
        visible.value = false
 | 
			
		||||
        completeCallback()
 | 
			
		||||
    })
 | 
			
		||||
    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>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user