diff --git a/api/order.js b/api/order.js index 024dbe0..54f282e 100644 --- a/api/order.js +++ b/api/order.js @@ -33,4 +33,9 @@ export const cancelOrderApi = (data)=>{ //订单确认收货 export const confirmReceiptApi = (data)=>{ return request.post('/order/RetailOrder/confirm_receipt', data); +} + +//订单再次购买 +export const purchaseAgainApi = (data)=>{ + return request.get('/order/RetailOrder/purchase_again', data); } \ No newline at end of file diff --git a/pagesOrder/detail/detail.vue b/pagesOrder/detail/detail.vue index 6578301..844adf5 100644 --- a/pagesOrder/detail/detail.vue +++ b/pagesOrder/detail/detail.vue @@ -133,7 +133,7 @@ 确认收货 - 再次购买 + 再次购买 @@ -153,7 +153,7 @@ import orderCanclePopup from "@/components/orderCanclePopup.vue"; import shopListPopupVue from "@/components/shopListPopup.vue"; import modal from "@/components/modal.vue"; - import { orderDetailApi, cancelOrderApi, rePaymentApi, confirmReceiptApi } from "@/api/order.js" + import { orderDetailApi, cancelOrderApi, rePaymentApi, confirmReceiptApi, purchaseAgainApi } from "@/api/order.js" import { addressListsApi, merchantListApi } from "@/api/user.js"; const showCancel = ref(false); @@ -336,6 +336,15 @@ }) } + // 再次购买 + const purchaseAgain = ()=>{ + purchaseAgainApi({ + order_id: datas.value.id + }).then(res=>{ + uni.$u.toast('已加入购物车'); + }) + } + // 设置目标日期 let targetDate = ""; let countDown = ref(""); diff --git a/pagesOrder/order/component/good.vue b/pagesOrder/order/component/good.vue index a4d22b8..860a751 100644 --- a/pagesOrder/order/component/good.vue +++ b/pagesOrder/order/component/good.vue @@ -33,7 +33,7 @@ 确认收货 - 再次购买 查看详情 @@ -67,7 +67,7 @@ }) } - const emit = defineEmits(['cancleOrder', 'rePay', 'takeOrder']); + const emit = defineEmits(['cancleOrder', 'rePay', 'takeOrder', 'purchaseAgain']); const cancleOrder = ()=>{ emit('cancleOrder', props.datas) } @@ -76,6 +76,10 @@ emit('takeOrder', props.datas) } + const purchaseAgain = ()=>{ + emit('purchaseAgain', props.datas) + } + const rePay = ()=>{ emit('rePay', props.datas) } diff --git a/pagesOrder/order/order.vue b/pagesOrder/order/order.vue index f21d3b7..1f8792d 100644 --- a/pagesOrder/order/order.vue +++ b/pagesOrder/order/order.vue @@ -20,7 +20,7 @@ + @rePay="rePay" @purchaseAgain="purchaseAgain"> { @@ -110,6 +110,15 @@ reloadAll(); }) } + + // 再次购买 + const purchaseAgain = (e)=>{ + purchaseAgainApi({ + order_id: e.id + }).then(res=>{ + uni.$u.toast('已加入购物车'); + }) + } const rePay = (e) => { rePaymentApi({