代码提交
This commit is contained in:
@ -1,206 +1,119 @@
|
||||
<template>
|
||||
<view>
|
||||
<view
|
||||
:class="['order', className]"
|
||||
v-if="data"
|
||||
:class="['order', className]"
|
||||
v-if="data"
|
||||
>
|
||||
|
||||
<view
|
||||
class="order-header"
|
||||
@tap="toOrderInfo"
|
||||
class="order-header"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
<view class="order-logo">
|
||||
<!-- <image :src="data." alt=""> -->
|
||||
<view class="color-y">Y</view>
|
||||
<view>SHOP商城</view>
|
||||
</view>
|
||||
<view class="order-status status-1">
|
||||
{{ data._status._msg }}
|
||||
<view
|
||||
class="order-status status-2"
|
||||
v-if="data._status"
|
||||
>
|
||||
{{ data._status._title }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="order-goods"
|
||||
@tap="toOrderInfo"
|
||||
class="order-goods"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
<goods
|
||||
list
|
||||
interval
|
||||
desc="3"
|
||||
showAction
|
||||
model
|
||||
purchase="x3"
|
||||
:data="item.productInfo"
|
||||
v-for="(item, index) in data.cartInfo"
|
||||
/>
|
||||
</view>
|
||||
<view
|
||||
class="order-info"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
<text>总价:¥{{ payPrice }}</text>
|
||||
<text>优惠:¥{{ deductionPrice }}</text>
|
||||
<text>运费:-¥{{ freightPrice }}</text>
|
||||
<text>总计:¥{{ totalPrice }}</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 0"
|
||||
>
|
||||
<!-- 未支付 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
v-for="(item, index) in data.cartInfo"
|
||||
class="order-evaluate"
|
||||
:class="{evaluateBtn: data._status._type == 3}"
|
||||
>
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="handleCancel"
|
||||
>
|
||||
取消订单
|
||||
</view>
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="handlePay"
|
||||
>
|
||||
立即付款
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 1"
|
||||
>
|
||||
<!-- 待发货 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="toSelectRefundGood"
|
||||
>
|
||||
申请退款
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 2"
|
||||
>
|
||||
<!-- 待收货 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看物流
|
||||
</view>
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="handleOrderTake"
|
||||
>
|
||||
确认收货
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 3"
|
||||
>
|
||||
<!-- 待评价 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="handleDelete"
|
||||
>
|
||||
删除订单
|
||||
</view>
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
v-if="data._status._type == 3 && item.isReply === 0"
|
||||
class="order-actions-primary order-evaluate-btn"
|
||||
@tap.stop="toEvaluate(item)"
|
||||
>
|
||||
去评价
|
||||
</view>
|
||||
<goods
|
||||
list
|
||||
interval
|
||||
desc="3"
|
||||
showAction
|
||||
model
|
||||
:purchase="item.cartNum"
|
||||
:data="item.productInfo"
|
||||
>
|
||||
<template #price>
|
||||
¥{{ item.truePrice }}
|
||||
</template>
|
||||
</goods>
|
||||
</view>
|
||||
</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
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 4"
|
||||
>
|
||||
<!-- 已完成 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-delete"
|
||||
@tap="handleDelete"
|
||||
>
|
||||
删除订单
|
||||
</view>
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看订单
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="data._status">
|
||||
<view
|
||||
class="order-actions"
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 5"
|
||||
>
|
||||
<!-- 退款中 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看订单
|
||||
>
|
||||
<!-- 未支付 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 6"
|
||||
>
|
||||
<!-- 已退款 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看订单
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-actions"
|
||||
v-if="data._status._type == 7"
|
||||
>
|
||||
<!-- 退款 -->
|
||||
<view class="order-actions-left">
|
||||
</view>
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
class="order-actions-primary"
|
||||
@tap="toOrderInfo"
|
||||
>
|
||||
查看订单
|
||||
<view class="order-actions-btns">
|
||||
<view
|
||||
v-if="data._status._type == 0"
|
||||
class="order-actions-default"
|
||||
@tap="handleCancel"
|
||||
>
|
||||
取消订单
|
||||
</view>
|
||||
<view
|
||||
v-if="data._status._type == 0"
|
||||
class="order-actions-primary"
|
||||
@tap="handlePay"
|
||||
>
|
||||
立即付款
|
||||
</view>
|
||||
<view
|
||||
v-if="['1','2','3','4'].includes(data._status._type)"
|
||||
class="order-actions-default"
|
||||
@tap="toSelectRefundGood"
|
||||
>
|
||||
申请退款
|
||||
</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="handleOrderTake"
|
||||
>
|
||||
确认收货
|
||||
</view>
|
||||
<view
|
||||
v-if="['4'].includes(data._status._type)"
|
||||
class="order-actions-default"
|
||||
@tap="handleDelete"
|
||||
>
|
||||
删除订单
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -211,24 +124,24 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { orderCancel, orderInfo, orderDelete, orderTake } from '@/api/order'
|
||||
import { orderCancel, orderDelete, orderTake } from '@/api/order'
|
||||
|
||||
import { navigateTo, back } from '@/utils/router'
|
||||
import { useRouter } from "@/hooks/useRouter";
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
const {push} = useRouter()
|
||||
|
||||
const emit = defineEmits(['refresh', 'pay'])
|
||||
|
||||
const props = defineProps(['class', 'data'])
|
||||
|
||||
const data = ref(props.data)
|
||||
|
||||
// 运费金额
|
||||
const freightPrice = ref(props.data.freightPrice)
|
||||
const totalPostage = ref(props.data.totalPostage)
|
||||
// 实际支付金额
|
||||
const payPrice = ref(props.data.payPrice)
|
||||
// 优惠券金额
|
||||
const couponPrice = ref(props.data.couponPrice)
|
||||
// 抵扣金额
|
||||
const deductionPrice = ref(props.data.deductionPrice)
|
||||
// 订单总价
|
||||
const totalPrice = ref(props.data.totalPrice)
|
||||
|
||||
@ -247,7 +160,6 @@ const handleCancel = async () => {
|
||||
duration: 2000
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -255,44 +167,40 @@ const handleCancel = async () => {
|
||||
|
||||
|
||||
const toSelectRefundGood = () => {
|
||||
navigateTo({
|
||||
url: '/pages/selectRefundGood/selectRefundGood',
|
||||
query: {
|
||||
push({url: '/pages/selectRefundGood/selectRefundGood'}, {
|
||||
data: {
|
||||
orderId: data.value.orderId,
|
||||
id: data.value.id,
|
||||
status: data.value.status
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handlePay = () => {
|
||||
|
||||
navigateTo({
|
||||
url: '/pages/selectPlay/selectPlay',
|
||||
query: {
|
||||
key: data.value.unique,
|
||||
orderId: data.value.orderId,
|
||||
}
|
||||
})
|
||||
emit('pay', data.value.orderId)
|
||||
/* push({url: '/pages/selectPlay/selectPlay'}, {
|
||||
data: {
|
||||
key: data.value.unique,
|
||||
orderId: data.value.orderId,
|
||||
}
|
||||
})*/
|
||||
}
|
||||
|
||||
|
||||
const toOrderInfo = () => {
|
||||
navigateTo({
|
||||
url: '/pages/orderInfo/orderInfo',
|
||||
query: {
|
||||
push({url: '/pages/orderInfo/orderInfo'}, {
|
||||
data: {
|
||||
key: data.value.unique,
|
||||
orderId: data.value.orderId,
|
||||
// id: data.value.id,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const toEvaluate = () => {
|
||||
navigateTo({
|
||||
url: '/pages/evaluate/evaluate',
|
||||
query: {
|
||||
unique: data.value.unique,
|
||||
const toEvaluate = (item) => {
|
||||
push({url: '/pages/evaluate/evaluate'}, {
|
||||
data: {
|
||||
unique: item.unique,
|
||||
orderId: data.value.orderId,
|
||||
}
|
||||
})
|
||||
@ -306,7 +214,7 @@ const handleDelete = async () => {
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
await orderDelete({
|
||||
id: data.value.orderId
|
||||
uni: data.value.orderId
|
||||
})
|
||||
data.value = null
|
||||
uni.showToast({
|
||||
@ -314,29 +222,28 @@ const handleDelete = async () => {
|
||||
duration: 2000
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
const handleOrderTake = async () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认收货',
|
||||
success: async (res) => {
|
||||
console.log("gxs --> % success: % res:\n", res)
|
||||
if (res.confirm) {
|
||||
let option = {
|
||||
uni: data.value.orderId,
|
||||
}
|
||||
const res = await orderTake(option)
|
||||
|
||||
await orderTake(option)
|
||||
emit('refresh')
|
||||
uni.showToast({
|
||||
title: '已收货',
|
||||
duration: 2000
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -346,5 +253,6 @@ const handleOrderTake = async () => {
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user