修改
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
import {useConfigStore} from "@/store";
|
||||
import {formatOrderAmount, getPlatformServiceFee} from "@/utils/merchantOrder";
|
||||
|
||||
const {t} = useI18n();
|
||||
|
||||
const configStore = useConfigStore();
|
||||
|
||||
// 用户会员状态是否已开通
|
||||
|
||||
const show = ref(false);
|
||||
const priceData = ref({})
|
||||
const priceData = ref<Record<string, any>>({})
|
||||
|
||||
function onOpen(data: any, num: number) {
|
||||
function onOpen(data: Record<string, any>) {
|
||||
priceData.value = data
|
||||
show.value = true;
|
||||
}
|
||||
@@ -19,6 +18,8 @@ function handleClose() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
const platformFee = computed(() => getPlatformServiceFee(priceData.value))
|
||||
|
||||
defineExpose({
|
||||
onOpen,
|
||||
});
|
||||
@@ -32,24 +33,31 @@ defineExpose({
|
||||
>
|
||||
<view>
|
||||
<view class="center h-102rpx bg-#F7F7F7 text-40rpx lh-40rpx font-bold text-#333">
|
||||
{{ t('pages-user.order.checkout.priceDetail.title') }}?
|
||||
{{ t('pages-user.order.checkout.priceDetail.title') }}
|
||||
</view>
|
||||
<view class="border-bottom text-32rpx lh-32rpx font-500 text-#333 py-36rpx px-30rpx">
|
||||
<view class="flex-center-sb mb-20rpx">
|
||||
<view>{{ t('pages-user.order.checkout.priceDetail.serviceFees') }}</view>
|
||||
<view>${{
|
||||
(Number(priceData?.tip) + Number(priceData?.deliveryFee)).toFixed(2)
|
||||
}}
|
||||
</view>
|
||||
<view>{{ t('pages-user.order.checkout.priceDetail.taxation') }}</view>
|
||||
<view>${{ formatOrderAmount(priceData?.tax) }}</view>
|
||||
</view>
|
||||
<view v-if="priceData?.deliveryFeeCharged !== false && Number(priceData?.deliveryFee) > 0"
|
||||
class="flex-center-sb mb-20rpx">
|
||||
<view>{{ t('pages-user.order.checkout.priceDetail.deliveryFee') }}</view>
|
||||
<view>${{ formatOrderAmount(priceData?.deliveryFee) }}</view>
|
||||
</view>
|
||||
<view v-if="priceData?.tipCharged !== false && Number(priceData?.tip) > 0"
|
||||
class="flex-center-sb mb-20rpx">
|
||||
<view>{{ t('pages-user.order.checkout.priceDetail.tip') }}</view>
|
||||
<view>${{ formatOrderAmount(priceData?.tip) }}</view>
|
||||
</view>
|
||||
<view v-if="Number(platformFee) > 0" class="flex-center-sb mb-20rpx text-26rpx text-#999">
|
||||
<view>{{ t('pages-user.order.platformServiceFee') }}</view>
|
||||
<view>${{ platformFee }}</view>
|
||||
</view>
|
||||
<view class="text-24rpx lh-28rpx text-#9E9E9E">
|
||||
{{ t('pages-user.order.checkout.priceDetail.desc') }}
|
||||
{{ t('pages-user.order.checkout.priceDetail.platformFeeNote') }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-center-sb border-bottom h-104rpx text-32rpx lh-32rpx font-500 text-#333 px-30rpx">
|
||||
<view>{{ t('pages-user.order.checkout.priceDetail.taxation') }}</view>
|
||||
<view>${{ Number(priceData?.tax) }}</view>
|
||||
</view>
|
||||
<view class="px-30rpx pt-40rpx">
|
||||
<wd-button
|
||||
block
|
||||
@@ -66,4 +74,4 @@ defineExpose({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<script lang="ts" setup>
|
||||
import {appMerchantOrderRejectOrderPost} from '@/service'
|
||||
import {useConfigStore} from '@/store'
|
||||
|
||||
const {t} = useI18n()
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
const configStore = useConfigStore()
|
||||
const show = ref(false)
|
||||
|
||||
const formData = reactive({
|
||||
reason: '',
|
||||
orderId: '',
|
||||
})
|
||||
|
||||
function onOpen(orderId: string) {
|
||||
formData.orderId = orderId
|
||||
formData.reason = ''
|
||||
show.value = true
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
show.value = false
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
if (!formData.reason.trim()) {
|
||||
uni.showToast({
|
||||
title: t('pages-user.order.toast.rejectOrderReasonRequired'),
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
appMerchantOrderRejectOrderPost({
|
||||
body: {
|
||||
orderId: formData.orderId,
|
||||
reason: formData.reason.trim(),
|
||||
},
|
||||
}).then(() => {
|
||||
uni.showToast({
|
||||
title: t('toast.rejectSuccess'),
|
||||
icon: 'none',
|
||||
})
|
||||
emit('close')
|
||||
handleClose()
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
onOpen,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<wd-popup v-model="show" custom-style="border-radius:32rpx 32rpx 0 0;" position="bottom" @close="handleClose">
|
||||
<view class="px-30rpx pt-40rpx relative">
|
||||
<view class="text-34rpx text-#333 font-bold text-center mb-37rpx">
|
||||
{{ t('pages-user.order.rejectOrderReason') }}
|
||||
</view>
|
||||
|
||||
<image
|
||||
class="w-28rpx h-28rpx absolute top-40rpx right-30rpx"
|
||||
src="@img/chef/100404.png"
|
||||
@click="handleClose"
|
||||
/>
|
||||
|
||||
<view class="min-h-234rpx box-border bg-#F7F7F7 rounded-14rpx overflow-hidden px-18rpx py-10rpx mb-36rpx">
|
||||
<wd-textarea
|
||||
v-model="formData.reason"
|
||||
:maxlength="100"
|
||||
:placeholder="t('pages-user.order.toast.rejectOrderReasonRequired')"
|
||||
auto-height
|
||||
custom-class="!bg-#F7F7F7"
|
||||
custom-textarea-container-class="!bg-#F7F7F7"
|
||||
no-border
|
||||
/>
|
||||
</view>
|
||||
|
||||
<wd-button
|
||||
block
|
||||
custom-class="!h-98rpx !text-30rpx !font-bold !rounded-16rpx !bg-#14181B"
|
||||
@click="handleSubmit"
|
||||
>
|
||||
{{ t('common.submit') }}
|
||||
</wd-button>
|
||||
|
||||
<view :style="[configStore.iosSafeBottomPlaceholder]"/>
|
||||
</view>
|
||||
</wd-popup>
|
||||
</template>
|
||||
@@ -4,23 +4,29 @@ import {
|
||||
appMerchantOrderAgreeRefundPost,
|
||||
appMerchantOrderDetailPost,
|
||||
appMerchantOrderReceiveOrderPost,
|
||||
type MerchantOrderVo,
|
||||
} from "@/service";
|
||||
import RefusePopup from "./components/refuse-popup/refuse-popup.vue";
|
||||
import RejectOrderPopup from "./components/reject-order-popup/reject-order-popup.vue";
|
||||
import {OrderCancelStatus, OrderStatus} from "@/constant/enums";
|
||||
import {callPhone, formatDateTimeRange, formatTimestampWithMonthName, navGoogleMap} from "@/utils/utils";
|
||||
import {
|
||||
formatOrderAmount,
|
||||
getMerchantReceiveAmount,
|
||||
getPlatformServiceFee,
|
||||
payStatusLabel,
|
||||
toOrderIdString,
|
||||
type MerchantOrderDetailVo,
|
||||
} from "@/utils/merchantOrder";
|
||||
import {requireMerchantToken} from "@/utils/merchantToken";
|
||||
import PriceDetail from "./components/price-detail/price-detail.vue";
|
||||
import startDelivery from "./components/start-delivery/start-delivery.vue";
|
||||
import OrderSkeleton from "./components/order-skeleton.vue";
|
||||
import {useMessage} from "wot-design-uni";
|
||||
import {rejectUserOrderApi} from "@/pages-user/service";
|
||||
|
||||
const message = useMessage();
|
||||
const {t} = useI18n();
|
||||
const configStore = useConfigStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const refusePopup = ref()
|
||||
const rejectOrderPopup = ref()
|
||||
const collapseValue = ref(false)
|
||||
|
||||
// 拨打电话
|
||||
@@ -87,7 +93,7 @@ onShow(() => {
|
||||
}
|
||||
})
|
||||
|
||||
const orderDetail = ref<MerchantOrderVo>()
|
||||
const orderDetail = ref<MerchantOrderDetailVo>()
|
||||
const loading = ref(false)
|
||||
|
||||
function appMerchantOrderDetail() {
|
||||
@@ -136,10 +142,12 @@ const priceDetailRef = ref(null)
|
||||
// 打开价格明细
|
||||
const openPriceDetail = () => {
|
||||
priceDetailRef.value?.onOpen({
|
||||
tip: orderDetail.value.tip,
|
||||
tax: orderDetail.value.tax,
|
||||
deliveryFee: orderDetail.value.deliveryFee
|
||||
}, 0);
|
||||
tip: orderDetail.value?.tip,
|
||||
tax: orderDetail.value?.tax,
|
||||
deliveryFee: orderDetail.value?.deliveryFee,
|
||||
deliveryFeeCharged: orderDetail.value?.deliveryFeeCharged,
|
||||
tipCharged: orderDetail.value?.tipCharged,
|
||||
});
|
||||
};
|
||||
|
||||
// 接单
|
||||
@@ -165,23 +173,16 @@ function startReceiving() {
|
||||
const startDeliveryRef = ref(null)
|
||||
|
||||
function startDeliveryFun() {
|
||||
startDeliveryRef.value?.onOpen(orderDetail.value.id)
|
||||
startDeliveryRef.value?.onOpen(toOrderIdString(orderDetail.value?.id))
|
||||
}
|
||||
|
||||
// 点击已送达
|
||||
function deliveredOrder() {
|
||||
navigateTo('/pages-user/pages/order/delivered-order?id=' + orderDetail.value.id)
|
||||
navigateTo('/pages-user/pages/order/delivered-order?id=' + toOrderIdString(orderDetail.value?.id))
|
||||
}
|
||||
|
||||
// 核销订单
|
||||
function writeOff() {
|
||||
if (!userStore.currentMerchantToken) {
|
||||
uni.showToast({
|
||||
title: t('toast.pleaseSelectStore'),
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!requireMerchantToken(userStore)) return
|
||||
navigateTo('/pages-user/pages/scan-code/index')
|
||||
}
|
||||
|
||||
@@ -190,39 +191,8 @@ function submitDelivery() {
|
||||
}
|
||||
|
||||
|
||||
// 拒绝开始订单, 直接拒绝用户的订单
|
||||
function rejectStartOrder() {
|
||||
message
|
||||
.confirm({
|
||||
title: t("common.prompt.system-prompt"),
|
||||
msg: `${t("common.prompt.system-prompt-reject")}`,
|
||||
confirmButtonText: t("common.yes"),
|
||||
cancelButtonText: t("common.no"),
|
||||
cancelButtonProps: {
|
||||
customClass:
|
||||
"!h-88rpx !w-258rpx !min-w-auto !text-30rpx !lh-42rpx !font-bold !border-#666666 !rounded-20rpx",
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass:
|
||||
"!h-88rpx !w-258rpx !min-w-auto !text-30rpx !lh-42rpx !font-bold !bg-primary !rounded-20rpx",
|
||||
},
|
||||
})
|
||||
.then(async () => {
|
||||
rejectUserOrderApi({
|
||||
orderId: orderId.value,
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: t('toast.rejectSuccess'),
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
// 获取订单详情
|
||||
appMerchantOrderDetail()
|
||||
}, 500)
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
rejectOrderPopup.value?.onOpen(orderId.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -397,8 +367,8 @@ function rejectStartOrder() {
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 自取已隐藏:自取订单信息卡片 -->
|
||||
<template v-if="false">
|
||||
<!-- 自取订单信息卡片 -->
|
||||
<template v-if="orderDetail?.receiveMethod === 2">
|
||||
<view class="bg-white rounded-16rpx p-24rpx mb-20rpx flex-center-sb">
|
||||
<view class="flex items-center text-28rpx text-#333">
|
||||
<text>{{ t('pages-user.order.pickUp') }}:</text>
|
||||
@@ -466,24 +436,61 @@ function rejectStartOrder() {
|
||||
<!-- 订单总计 -->
|
||||
<view class="mt-32rpx border-t-1rpx">
|
||||
<view class="flex justify-between mb-16rpx text-30rpx text-#333333 font-normal">
|
||||
<text class="">{{ t('pages.order.subtotal') }}</text>
|
||||
<text class="">${{ orderDetail?.actualPrice }}</text>
|
||||
<text>{{ t('pages.order.subtotal') }}</text>
|
||||
<text>${{ formatOrderAmount(orderDetail?.actualPrice) }}</text>
|
||||
</view>
|
||||
<view class="flex justify-between mb-16rpx text-30rpx text-#333333 font-normal">
|
||||
<view class="flex items-center">
|
||||
<text class="">{{ t('pages.order.taxesAndFees') }}</text>
|
||||
<image class="w-28rpx h-28rpx shrink-0 ml-10rpx" src="@img/chef/207.png" @click="openPriceDetail"></image>
|
||||
</view>
|
||||
<view class="flex items-center gap-16rpx">
|
||||
<text class="">${{
|
||||
(Number(orderDetail?.tax) + Number(orderDetail?.tip) + Number(orderDetail?.deliveryFee)).toFixed(2)
|
||||
}}
|
||||
</text>
|
||||
<text>{{ t('pages.order.taxesAndFees') }}</text>
|
||||
<image class="w-28rpx h-28rpx shrink-0 ml-10rpx" src="@img/chef/207.png" @click="openPriceDetail"/>
|
||||
</view>
|
||||
<text>${{ formatOrderAmount(orderDetail?.tax) }}</text>
|
||||
</view>
|
||||
<view class="flex justify-between text-30rpx text-#333333 font-normal">
|
||||
<text class="">{{ t('pages.order.total') }}</text>
|
||||
<text class="">${{ orderDetail?.paidAmount }}</text>
|
||||
<view
|
||||
v-if="Number(getPlatformServiceFee(orderDetail)) > 0"
|
||||
class="flex justify-between mb-16rpx text-26rpx text-#999 font-normal"
|
||||
>
|
||||
<text>{{ t('pages-user.order.platformServiceFee') }}</text>
|
||||
<text>${{ getPlatformServiceFee(orderDetail) }}</text>
|
||||
</view>
|
||||
<view class="flex justify-between mb-16rpx text-30rpx text-#333333 font-normal">
|
||||
<text>{{ t('pages-user.order.customerPaidAmount') }}</text>
|
||||
<text>${{ formatOrderAmount(orderDetail?.paidAmount) }}</text>
|
||||
</view>
|
||||
<view class="flex justify-between text-30rpx text-#333333 font-500">
|
||||
<text>{{ t('pages-user.order.merchantReceiveAmount') }}</text>
|
||||
<text class="text-#00A76D">${{ getMerchantReceiveAmount(orderDetail) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 配送单信息 -->
|
||||
<view
|
||||
v-if="orderDetail?.merchantDeliveryOrderVo || orderDetail?.merchantDeliveryOrderId"
|
||||
class="bg-white rounded-16rpx pt-32rpx mb-30rpx text-28rpx text-#333333 font-normal"
|
||||
>
|
||||
<view class="flex items-center mb-30rpx">
|
||||
<view class="bg-#FF7112 w-10rpx h-30rpx mr-14rpx"/>
|
||||
<text>{{ t('pages-user.order.deliveryOrderInfo') }}</text>
|
||||
</view>
|
||||
<view class="px-24rpx pb-24rpx">
|
||||
<view v-if="orderDetail?.deliveryDate" class="flex-center-sb h-72rpx border-bottom">
|
||||
<text class="text-#666">{{ t('pages-user.order.deliveryDate') }}</text>
|
||||
<text>{{ orderDetail.deliveryDate }}</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="orderDetail?.merchantDeliveryOrderVo?.groupDeliveryFee != null"
|
||||
class="flex-center-sb h-72rpx border-bottom"
|
||||
>
|
||||
<text class="text-#666">{{ t('pages-user.order.groupDeliveryFee') }}</text>
|
||||
<text>${{ formatOrderAmount(orderDetail.merchantDeliveryOrderVo.groupDeliveryFee) }}</text>
|
||||
</view>
|
||||
<view
|
||||
v-if="orderDetail?.merchantDeliveryOrderVo?.groupTip != null"
|
||||
class="flex-center-sb h-72rpx"
|
||||
>
|
||||
<text class="text-#666">{{ t('pages-user.order.groupTip') }}</text>
|
||||
<text>${{ formatOrderAmount(orderDetail.merchantDeliveryOrderVo.groupTip) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -522,7 +529,7 @@ function rejectStartOrder() {
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="flex-center-sb h-88rpx">
|
||||
<view class="flex-center-sb h-88rpx border-bottom">
|
||||
<text class="text-28rpx text-#333333 font-normal">{{ t('pages-user.order.payMethod') }}</text>
|
||||
<text class="text-28rpx text-#333333 font-normal">
|
||||
{{
|
||||
@@ -530,6 +537,11 @@ function rejectStartOrder() {
|
||||
}}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view v-if="orderDetail?.payStatus != null" class="flex-center-sb h-88rpx">
|
||||
<text class="text-28rpx text-#333333 font-normal">{{ t('pages-user.order.payStatus.title') }}</text>
|
||||
<text class="text-28rpx text-#333333 font-normal">{{ payStatusLabel(orderDetail?.payStatus, t) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -637,8 +649,8 @@ function rejectStartOrder() {
|
||||
</view>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 自取已隐藏:自取订单底部操作按钮 -->
|
||||
<template v-if="false">
|
||||
<!-- 自取订单底部操作按钮 -->
|
||||
<template v-if="orderDetail?.receiveMethod === 2">
|
||||
<template v-if="orderStatus === OrderStatus.HAS_PENDING_PAYMENT">
|
||||
<view class="">
|
||||
<view :style="[configStore.iosSafeBottomPlaceholder]" class="h-118rpx"></view>
|
||||
@@ -675,6 +687,8 @@ function rejectStartOrder() {
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 拒绝接单 -->
|
||||
<reject-order-popup ref="rejectOrderPopup" @close="appMerchantOrderDetail"/>
|
||||
<!-- 拒绝取消订单 -->
|
||||
<refuse-popup ref="refusePopup" @close="appMerchantOrderDetail"/>
|
||||
<!-- 价格详情 -->
|
||||
|
||||
Reference in New Issue
Block a user