2023-10-11 11:27:47 +08:00
|
|
|
|
<template>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<view
|
|
|
|
|
:class="['order']"
|
|
|
|
|
v-if="data"
|
|
|
|
|
>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
<view
|
2024-02-08 21:01:37 +08:00
|
|
|
|
class="order-header"
|
|
|
|
|
@tap="toOrderInfo"
|
2023-10-11 11:27:47 +08:00
|
|
|
|
>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<view class="order-logo">
|
|
|
|
|
<view class="color-y">Y</view>
|
|
|
|
|
<view>SHOP商城</view>
|
|
|
|
|
</view>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
<view
|
2024-02-08 21:01:37 +08:00
|
|
|
|
class="order-status status-2"
|
|
|
|
|
v-if="data._status"
|
2023-10-11 11:27:47 +08:00
|
|
|
|
>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
{{ data._status._type === '8' && data.shippingType === 2 ? "待核销" : data._status._title }}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
class="order-goods"
|
|
|
|
|
@tap="toOrderInfo"
|
|
|
|
|
>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
<view
|
2024-02-08 21:01:37 +08:00
|
|
|
|
v-for="(item, index) in data.cartInfo"
|
|
|
|
|
class="order-evaluate"
|
|
|
|
|
:class="{evaluateBtn: data._status._type == 3}"
|
2023-10-11 11:27:47 +08:00
|
|
|
|
>
|
2023-11-14 17:21:03 +08:00
|
|
|
|
<view
|
2024-02-08 21:01:37 +08:00
|
|
|
|
v-if="data._status._type == 3 && item.isReply === 0"
|
|
|
|
|
class="order-actions-primary order-evaluate-btn"
|
|
|
|
|
@tap.stop="toEvaluate(item.unique,data.orderId)"
|
2023-11-14 17:21:03 +08:00
|
|
|
|
>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
去评价
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<Goods
|
|
|
|
|
row
|
|
|
|
|
:jump="false"
|
|
|
|
|
imgWidth="200rpx"
|
|
|
|
|
info-padding="10rpx 40rpx"
|
|
|
|
|
:goods="item.productInfo"
|
|
|
|
|
>
|
|
|
|
|
<template #options>
|
|
|
|
|
<view
|
|
|
|
|
class="goods-options">
|
|
|
|
|
<!-- sku select -->
|
|
|
|
|
<view class="sku-row flex">
|
|
|
|
|
<view
|
|
|
|
|
class="sku-info flex flex-jc__sb flex-ai__center"
|
|
|
|
|
>
|
|
|
|
|
<view class="info">
|
|
|
|
|
{{
|
|
|
|
|
item.productInfo && item.productInfo.attrInfo && item.productInfo.attrInfo.sku
|
|
|
|
|
}}
|
|
|
|
|
</view>
|
|
|
|
|
<view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 售后 -->
|
|
|
|
|
|
|
|
|
|
<!-- bottom -->
|
|
|
|
|
<view class="price-row flex flex-ai__center flex-jc__sb">
|
|
|
|
|
<!-- price -->
|
|
|
|
|
<view class="price-box flex flex-ai__center">
|
|
|
|
|
¥{{ item.truePrice }}
|
|
|
|
|
</view>
|
|
|
|
|
<!-- -->
|
|
|
|
|
<view class="flex flex-ai__center">
|
|
|
|
|
<view
|
|
|
|
|
class="after-sale-box"
|
|
|
|
|
v-if="item.orderDetailState!==1"
|
|
|
|
|
>
|
|
|
|
|
<span v-if="item.orderDetailState===2"> 售后中 </span>
|
|
|
|
|
<span v-if="item.orderDetailState===3"> 售后完成 </span>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="price-box cart-num flex flex-ai__end">
|
|
|
|
|
x{{ item.cartNum }}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
</Goods>
|
|
|
|
|
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
class="order-info"
|
|
|
|
|
@tap="toOrderInfo"
|
|
|
|
|
>
|
|
|
|
|
<view class="text">总价:¥{{ data.cost }}</view>
|
|
|
|
|
<view class="text">总优惠:¥{{ couponPrice }}</view>
|
|
|
|
|
<view class="text">运费:¥{{ totalPostage }}</view>
|
|
|
|
|
<view class="text flex flex-ai__center">总计:
|
|
|
|
|
<view class="total-price">¥{{ totalPrice }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="data._status">
|
2023-10-11 11:27:47 +08:00
|
|
|
|
<view
|
2024-02-08 21:01:37 +08:00
|
|
|
|
class="order-actions"
|
|
|
|
|
|
2023-10-11 11:27:47 +08:00
|
|
|
|
>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<!-- 未支付 -->
|
|
|
|
|
<view class="order-actions-left">
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<view class="order-actions-btns">
|
|
|
|
|
<view
|
|
|
|
|
v-if="data._status._type === '0'"
|
|
|
|
|
class="order-actions-default"
|
|
|
|
|
@tap="showModal(1)"
|
|
|
|
|
>
|
|
|
|
|
取消订单
|
2023-11-14 17:21:03 +08:00
|
|
|
|
</view>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<view
|
|
|
|
|
v-if="data._status._type === '0'"
|
|
|
|
|
class="order-actions-primary"
|
|
|
|
|
@tap="handlePay"
|
|
|
|
|
>
|
|
|
|
|
立即付款
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
v-if="(data.shippingType ===1&&['1','2','3','4','8','6'].includes(data._status._type))||data.shippingType ===2&&['6'].includes(data._status._type)"
|
|
|
|
|
class="order-actions-default"
|
|
|
|
|
@tap="toSelectRefundGood(data.id)"
|
|
|
|
|
>
|
|
|
|
|
申请退款
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
v-if="(data.shippingType ===2 && ['8'].includes(data._status._type))"
|
|
|
|
|
class="order-actions-default"
|
|
|
|
|
@tap="showModal(3)"
|
|
|
|
|
>
|
|
|
|
|
取消订单
|
|
|
|
|
</view>
|
|
|
|
|
<!-- _type: 2待收货 3已收货 4已完成 8代发货 6待成团 7已成团 -->
|
|
|
|
|
<view
|
|
|
|
|
v-if="data._status._type==='8' && data.shippingType === 2"
|
|
|
|
|
class="order-actions-primary"
|
|
|
|
|
@tap="emit('checkOffCode',data.writeOffCode)"
|
|
|
|
|
>
|
|
|
|
|
核销码
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
class="order-actions-default"
|
|
|
|
|
v-if="data._status._type === '2'"
|
|
|
|
|
@tap="toOrderInfo"
|
|
|
|
|
>
|
|
|
|
|
查看物流
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
v-if="data._status._type === '2'"
|
|
|
|
|
class="order-actions-primary"
|
|
|
|
|
@tap="showModal(2)"
|
|
|
|
|
>
|
|
|
|
|
确认收货
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
v-if="['4','5','-2'].includes(data._status._type)"
|
|
|
|
|
class="order-actions-default"
|
|
|
|
|
@tap="showModal(0)"
|
|
|
|
|
>
|
|
|
|
|
删除订单
|
|
|
|
|
</view>
|
|
|
|
|
<view
|
|
|
|
|
v-if="data._status._type === '6'"
|
|
|
|
|
class="order-actions-primary"
|
|
|
|
|
@tap="goGroupByDetail({teamworkId:data.teamworkId})"
|
|
|
|
|
>
|
|
|
|
|
邀请好友拼团
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<Modal
|
|
|
|
|
ref="modalRef"
|
|
|
|
|
:content="modalTitle"
|
|
|
|
|
@confirm="confirmModal" />
|
|
|
|
|
</view>
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-02-08 21:01:37 +08:00
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
import { cancelAfterVerification, orderTake } from '@/api/order'
|
2023-11-17 20:55:32 +08:00
|
|
|
|
import Modal from "@/components/Modal/index.vue"
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
import { useRouter } from "@/hooks/useRouter";
|
2023-11-17 20:55:32 +08:00
|
|
|
|
import { useInterface } from "@/hooks/useInterface";
|
2024-02-08 21:01:37 +08:00
|
|
|
|
import { useOrder } from "@/hooks/useOrder";
|
|
|
|
|
import { useJump } from "@/hooks/useJump";
|
|
|
|
|
import Goods from "@/components/goodsComponents/Goods.vue";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
modalRef,
|
|
|
|
|
modalType,
|
|
|
|
|
modalTitle,
|
|
|
|
|
showModal,
|
|
|
|
|
cancelOrder,
|
|
|
|
|
deleteOrder,
|
|
|
|
|
toEvaluate,
|
|
|
|
|
toSelectRefundGood,
|
|
|
|
|
showWsReceipt,
|
|
|
|
|
} = useOrder()
|
|
|
|
|
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2023-11-14 17:21:03 +08:00
|
|
|
|
const {push} = useRouter()
|
2024-02-08 21:01:37 +08:00
|
|
|
|
const {goGroupByDetail} = useJump()
|
|
|
|
|
|
2023-11-17 20:55:32 +08:00
|
|
|
|
const {toast} = useInterface()
|
2023-11-14 17:21:03 +08:00
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
const emit = defineEmits(['refresh', 'pay', 'checkOffCode'])
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
|
|
|
|
const props = defineProps(['class', 'data'])
|
|
|
|
|
|
|
|
|
|
const data = ref(props.data)
|
|
|
|
|
|
|
|
|
|
// 运费金额
|
2023-11-14 17:21:03 +08:00
|
|
|
|
const totalPostage = ref(props.data.totalPostage)
|
2023-10-11 11:27:47 +08:00
|
|
|
|
// 实际支付金额
|
|
|
|
|
const payPrice = ref(props.data.payPrice)
|
|
|
|
|
// 优惠券金额
|
2024-02-08 21:01:37 +08:00
|
|
|
|
const couponPrice = ref(props.data.totalCouponPrice)
|
2023-10-11 11:27:47 +08:00
|
|
|
|
// 订单总价
|
|
|
|
|
const totalPrice = ref(props.data.totalPrice)
|
|
|
|
|
|
2023-11-17 20:55:32 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 确认取消订单
|
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
|
*/
|
2024-02-08 21:01:37 +08:00
|
|
|
|
async function doCancelOrder() {
|
|
|
|
|
cancelOrder(data.value).then(() => {
|
|
|
|
|
emit('refresh')
|
2023-11-17 20:55:32 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 确认删除订单
|
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
|
*/
|
2024-02-08 21:01:37 +08:00
|
|
|
|
async function doDeleteOrder() {
|
|
|
|
|
deleteOrder(data.value).then(() => {
|
|
|
|
|
emit('refresh')
|
2023-11-17 20:55:32 +08:00
|
|
|
|
})
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-17 20:55:32 +08:00
|
|
|
|
/**
|
|
|
|
|
* 确认收货
|
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
|
*/
|
2024-02-08 21:01:37 +08:00
|
|
|
|
async function doTakeGoods() {
|
2023-11-17 20:55:32 +08:00
|
|
|
|
let option = {
|
|
|
|
|
uni: data.value.orderId,
|
|
|
|
|
}
|
2024-02-08 21:01:37 +08:00
|
|
|
|
let payInfo = JSON.parse(data.value.payInfo)
|
|
|
|
|
showWsReceipt(payInfo.transaction_id).then(async (res) => {
|
|
|
|
|
if (res === 'success') {
|
|
|
|
|
await orderTake(option)
|
|
|
|
|
emit('refresh')
|
|
|
|
|
toast({title: '已收货'});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const doCancelAnOrder = async () => {
|
|
|
|
|
await cancelAfterVerification({id: data.value.orderId})
|
|
|
|
|
toast({title: '取消成功'})
|
2023-11-17 20:55:32 +08:00
|
|
|
|
emit('refresh')
|
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 确认弹窗
|
|
|
|
|
*/
|
|
|
|
|
function confirmModal() {
|
|
|
|
|
const funcArr = [doDeleteOrder, doCancelOrder, doTakeGoods, doCancelAnOrder]
|
|
|
|
|
funcArr[modalType.value]()
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
function handlePay() {
|
2023-11-14 17:21:03 +08:00
|
|
|
|
emit('pay', data.value.orderId)
|
2023-10-11 11:27:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-11-17 20:55:32 +08:00
|
|
|
|
function toOrderInfo() {
|
2023-11-14 17:21:03 +08:00
|
|
|
|
push({url: '/pages/orderInfo/orderInfo'}, {
|
|
|
|
|
data: {
|
2023-10-11 11:27:47 +08:00
|
|
|
|
key: data.value.unique,
|
|
|
|
|
orderId: data.value.orderId,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
2024-02-08 21:01:37 +08:00
|
|
|
|
<style
|
|
|
|
|
lang="scss"
|
|
|
|
|
scoped>
|
|
|
|
|
.order-header {
|
2023-11-17 20:55:32 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
box-sizing: border-box;
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
|
|
|
|
.order-logo, .order-status {
|
2023-11-17 20:55:32 +08:00
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
|
|
|
|
.order-logo {
|
2023-11-17 20:55:32 +08:00
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
|
|
|
|
.order-status {
|
2023-11-17 20:55:32 +08:00
|
|
|
|
max-width: 80%;
|
|
|
|
|
text-align: right;
|
|
|
|
|
white-space: pre-wrap;
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-08 21:01:37 +08:00
|
|
|
|
|
|
|
|
|
// 商品SKU 数量等操作条
|
|
|
|
|
.goods-options {
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.sku-row {
|
|
|
|
|
margin-bottom: 30rpx;
|
|
|
|
|
|
|
|
|
|
.sku-info {
|
|
|
|
|
@include usePadding(10, 4);
|
|
|
|
|
border: 1rpx solid #ccc;
|
|
|
|
|
border-radius: 5rpx;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
transition: all .3s;
|
|
|
|
|
max-width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.info {
|
|
|
|
|
width: 100%;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
|
scale: 1.1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
|
margin-left: 15rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.price-row {
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
.price-box {
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
color: $primary-color;
|
|
|
|
|
|
|
|
|
|
.old-price {
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
color: $tips-color;
|
|
|
|
|
text-decoration: line-through;
|
|
|
|
|
margin-left: 10rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.after-sale-box {
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
margin-right: 5rpx;
|
|
|
|
|
color: $tips-color;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.cart-num {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
|
|
|
|
.input {
|
|
|
|
|
width: 120rpx;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input {
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.button {
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
width: 34rpx;
|
|
|
|
|
aspect-ratio: 1/1;
|
|
|
|
|
border-radius: 5rpx;
|
|
|
|
|
border: 2rpx solid #cccccc;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
transition: all .3s;
|
|
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
|
scale: 1.2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-11 11:27:47 +08:00
|
|
|
|
</style>
|