新增再次购买功能

This commit is contained in:
weipengfei 2024-05-08 15:25:03 +08:00
parent 605acbe2b9
commit 0061b65d63
4 changed files with 33 additions and 6 deletions

View File

@ -33,4 +33,9 @@ export const cancelOrderApi = (data)=>{
//订单确认收货 //订单确认收货
export const confirmReceiptApi = (data)=>{ export const confirmReceiptApi = (data)=>{
return request.post('/order/RetailOrder/confirm_receipt', data); return request.post('/order/RetailOrder/confirm_receipt', data);
}
//订单再次购买
export const purchaseAgainApi = (data)=>{
return request.get('/order/RetailOrder/purchase_again', data);
} }

View File

@ -133,7 +133,7 @@
<view></view> <view></view>
<view style="width: 450rpx;"> <view style="width: 450rpx;">
<up-button v-if="datas.status==0||datas.status==1" color="#20B128" shape="circle" @click="showTake=true">确认收货</up-button> <up-button v-if="datas.status==0||datas.status==1" color="#20B128" shape="circle" @click="showTake=true">确认收货</up-button>
<up-button v-else color="#20B128" plain shape="circle" @click="">再次购买</up-button> <up-button v-else color="#20B128" plain shape="circle" @click="purchaseAgain">再次购买</up-button>
</view> </view>
</block> </block>
</view> </view>
@ -153,7 +153,7 @@
import orderCanclePopup from "@/components/orderCanclePopup.vue"; import orderCanclePopup from "@/components/orderCanclePopup.vue";
import shopListPopupVue from "@/components/shopListPopup.vue"; import shopListPopupVue from "@/components/shopListPopup.vue";
import modal from "@/components/modal.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"; import { addressListsApi, merchantListApi } from "@/api/user.js";
const showCancel = ref(false); const showCancel = ref(false);
@ -336,6 +336,15 @@
}) })
} }
//
const purchaseAgain = ()=>{
purchaseAgainApi({
order_id: datas.value.id
}).then(res=>{
uni.$u.toast('已加入购物车');
})
}
// //
let targetDate = ""; let targetDate = "";
let countDown = ref(""); let countDown = ref("");

View File

@ -33,7 +33,7 @@
<!-- <view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle">申请售后</up-button></view> --> <!-- <view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle">申请售后</up-button></view> -->
<view @click="takeOrder" v-if="datas.status==1" style="width: 80px;"><up-button size="small" color="#20B128" <view @click="takeOrder" v-if="datas.status==1" style="width: 80px;"><up-button size="small" color="#20B128"
shape="circle">确认收货</up-button></view> shape="circle">确认收货</up-button></view>
<view v-if="datas.status==2||datas.status==3" style="width: 80px;"><up-button size="small" plain color="#20B128" <view @click="purchaseAgain" v-if="datas.status==2||datas.status==3" style="width: 80px;"><up-button size="small" plain color="#20B128"
shape="circle">再次购买</up-button></view> shape="circle">再次购买</up-button></view>
<view @click="navTo" style="width: 80px;"><up-button size="small" plain color="#20B128" <view @click="navTo" style="width: 80px;"><up-button size="small" plain color="#20B128"
shape="circle">查看详情</up-button></view> shape="circle">查看详情</up-button></view>
@ -67,7 +67,7 @@
}) })
} }
const emit = defineEmits(['cancleOrder', 'rePay', 'takeOrder']); const emit = defineEmits(['cancleOrder', 'rePay', 'takeOrder', 'purchaseAgain']);
const cancleOrder = ()=>{ const cancleOrder = ()=>{
emit('cancleOrder', props.datas) emit('cancleOrder', props.datas)
} }
@ -76,6 +76,10 @@
emit('takeOrder', props.datas) emit('takeOrder', props.datas)
} }
const purchaseAgain = ()=>{
emit('purchaseAgain', props.datas)
}
const rePay = ()=>{ const rePay = ()=>{
emit('rePay', props.datas) emit('rePay', props.datas)
} }

View File

@ -20,7 +20,7 @@
<view class="page-box"> <view class="page-box">
<view v-if="list.length>0" class="list"> <view v-if="list.length>0" class="list">
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k" @cancleOrder="cancleOrder" @takeOrder="takeOrder" <good v-for="(item, index) in list" :datas="item" :key="index" :type="k" @cancleOrder="cancleOrder" @takeOrder="takeOrder"
@rePay="rePay"></good> @rePay="rePay" @purchaseAgain="purchaseAgain"></good>
</view> </view>
<view v-if="!where[k].loading&&list.length==0" style="padding-top: 100rpx;"> <view v-if="!where[k].loading&&list.length==0" style="padding-top: 100rpx;">
<up-empty text="订单空空如也" <up-empty text="订单空空如也"
@ -50,7 +50,7 @@
import good from "./component/good.vue"; import good from "./component/good.vue";
import orderCanclePopup from "@/components/orderCanclePopup.vue" import orderCanclePopup from "@/components/orderCanclePopup.vue"
import modal from "@/components/modal.vue" import modal from "@/components/modal.vue"
import { cancelOrderApi, rePaymentApi, confirmReceiptApi, orderListApi } from "@/api/order.js" import { cancelOrderApi, rePaymentApi, confirmReceiptApi, orderListApi, purchaseAgainApi } from "@/api/order.js"
const tabsActive = ref(0) const tabsActive = ref(0)
const changeTab = ({ index }) => { const changeTab = ({ index }) => {
@ -110,6 +110,15 @@
reloadAll(); reloadAll();
}) })
} }
//
const purchaseAgain = (e)=>{
purchaseAgainApi({
order_id: e.id
}).then(res=>{
uni.$u.toast('已加入购物车');
})
}
const rePay = (e) => { const rePay = (e) => {
rePaymentApi({ rePaymentApi({