feat(订单)
This commit is contained in:
parent
05ce9595e7
commit
bfe36ac0e8
|
@ -38,7 +38,7 @@
|
|||
<view class="item" v-for="(item, index) in state.more" :key="item.name">
|
||||
<view class="label">{{ item.name }}</view>
|
||||
<view class="value">{{ index !== 0 ? item.value : fen2yuan(item.value) }}</view>
|
||||
<view class="last"> 昨日 {{ item.last }} </view>
|
||||
<view class="last"> 昨日 {{ index === 0 ? fen2yuan(item.last) : item.last }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
v-for="order in state.pagination.list"
|
||||
:key="order.id"
|
||||
>
|
||||
<view @tap="onOrderDetail(order.id)">
|
||||
<view @tap="onOrderDetail(order.id, state.currentTab)">
|
||||
<view class="order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20">
|
||||
<view class="order-no">订单号:{{ order.no }}</view>
|
||||
<view class="order-state ss-font-26" :class="formatOrderColor(order)">
|
||||
|
@ -153,13 +153,15 @@ const tabMaps = [
|
|||
{
|
||||
name: '已付款',
|
||||
value: '50,60',
|
||||
commentStatus: 2,
|
||||
},
|
||||
{
|
||||
name: '已评价',
|
||||
value: '30',
|
||||
commentStatus: 1,
|
||||
},
|
||||
{
|
||||
name: '已退货',
|
||||
name: '已退款',
|
||||
value: '10,20',
|
||||
},
|
||||
]
|
||||
|
@ -211,6 +213,7 @@ function onTabsChange(e) {
|
|||
function onOrderDetail(id) {
|
||||
peach.$router.go('/pages/order/detail', {
|
||||
id,
|
||||
currentTabIndex: state.value.currentTab,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -222,6 +225,11 @@ async function getOrderList() {
|
|||
pageSize: state.value.pagination.pageSize,
|
||||
status: state.value.currentTab !== 3 ? tabMaps[state.value.currentTab].value : undefined,
|
||||
refundStatus: state.value.currentTab === 3 ? tabMaps[state.value.currentTab].value : undefined,
|
||||
commentStatus: tabMaps[state.value.currentTab].commentStatus
|
||||
? state.value.currentTab === 1
|
||||
? false
|
||||
: true
|
||||
: undefined,
|
||||
})
|
||||
|
||||
data.list.forEach((item) => {
|
||||
|
|
|
@ -115,6 +115,56 @@
|
|||
</button>
|
||||
</view>
|
||||
</template> -->
|
||||
<template #refund>
|
||||
<view
|
||||
class="refund-content"
|
||||
v-if="
|
||||
(state.currentTabIndex == 3 || state.currentTabIndex == 0) &&
|
||||
item.refundStatus === 4
|
||||
"
|
||||
>
|
||||
<view class="refund-item">
|
||||
<view class="ss-flex ss-flex-1">
|
||||
<text class="title">退款原因:</text>
|
||||
<text class="detail">{{ item.refundReason }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="refund-item">
|
||||
<view class="ss-flex ss-flex-1">
|
||||
<text class="title">备注:</text>
|
||||
<text class="detail">{{ item.refundRemark || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template #comment>
|
||||
<view
|
||||
class="form-item"
|
||||
v-if="(state.currentTabIndex == 2 || state.currentTabIndex == 0) && item.comment"
|
||||
>
|
||||
<view class="divide-line"></view>
|
||||
<view class="star-box ss-flex ss-col-center">
|
||||
<view class="star-title ss-m-r-40">商品质量</view>
|
||||
<uni-rate v-model="item.comment.descriptionScores" />
|
||||
</view>
|
||||
<view class="star-box ss-flex ss-col-center">
|
||||
<view class="star-title ss-m-r-40">服务态度</view>
|
||||
<uni-rate v-model="item.comment.benefitScores" />
|
||||
</view>
|
||||
<!-- 评价 -->
|
||||
<view class="area-box">
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
type="textarea"
|
||||
maxlength="120"
|
||||
autoHeight
|
||||
v-model="item.comment.content"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template #priceSuffix>
|
||||
<button class="ss-reset-button tag-btn" v-if="item.status_text">
|
||||
{{ item.status_text }}
|
||||
|
@ -269,6 +319,7 @@ import OrderApi from '@/peach/api/trade/order'
|
|||
const statusBarHeight = peach.$platform.device.statusBarHeight * 2
|
||||
|
||||
const state = reactive({
|
||||
currentTabIndex: -1,
|
||||
orderInfo: {},
|
||||
merchantTradeNo: '', // 商户订单号
|
||||
comeinType: '', // 进入订单详情的来源类型
|
||||
|
@ -396,8 +447,24 @@ async function getOrderDetail(id) {
|
|||
handleOrderButtons(state.orderInfo)
|
||||
}
|
||||
|
||||
async function getOrderComment(id) {
|
||||
let res = await OrderApi.orderComment(id)
|
||||
|
||||
if (res.data.length > 0) {
|
||||
for (let item of state.orderInfo.items) {
|
||||
let temp = res.data.find((sitem) => item.id === sitem.orderItemId)
|
||||
|
||||
if (temp) {
|
||||
item.comment = temp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(async (options) => {
|
||||
state.currentTabIndex = options.currentTabIndex
|
||||
await getOrderDetail(options.id)
|
||||
await getOrderComment(options.id)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -488,6 +555,55 @@ onLoad(async (options) => {
|
|||
border-radius: 14rpx;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
|
||||
.refund-content {
|
||||
padding: 20rpx;
|
||||
.refund-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: normal;
|
||||
margin-bottom: 24rpx;
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
.detail {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-item {
|
||||
.divide-line {
|
||||
height: 1px;
|
||||
background-color: #f9fafb;
|
||||
width: 100%;
|
||||
margin: 20rpx;
|
||||
}
|
||||
background: #fff;
|
||||
|
||||
.star-box {
|
||||
height: 50rpx;
|
||||
padding: 0 25rpx;
|
||||
}
|
||||
|
||||
.star-title {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.area-box {
|
||||
width: 690rpx;
|
||||
border-radius: 20rpx;
|
||||
padding: 28rpx;
|
||||
margin: auto;
|
||||
|
||||
.img-box {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,14 @@ const OrderUtil = {
|
|||
data: data,
|
||||
})
|
||||
},
|
||||
|
||||
// 订单商品评论
|
||||
orderComment: (id) => {
|
||||
return request({
|
||||
url: '/product/comment/get-by-order-id/' + id,
|
||||
method: 'GET',
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export default OrderUtil
|
||||
|
|
|
@ -40,6 +40,12 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<slot name="refund"></slot>
|
||||
</view>
|
||||
<view>
|
||||
<slot name="comment"></slot>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -88,6 +88,12 @@ export function formatOrderStatusDescription(order) {
|
|||
}
|
||||
|
||||
export function formatOrderStatus(order) {
|
||||
if (order.refundStatus === 10) {
|
||||
return '部分退款'
|
||||
}
|
||||
if (order.refundStatus === 20) {
|
||||
return '整单退款'
|
||||
}
|
||||
if (order.status === 0) {
|
||||
return '待付款'
|
||||
}
|
||||
|
@ -104,7 +110,7 @@ export function formatOrderStatus(order) {
|
|||
return '待评价'
|
||||
}
|
||||
if (order.status === 30 && order.commentStatus) {
|
||||
return '已完成'
|
||||
return '已评价'
|
||||
}
|
||||
if (order.status === 50) {
|
||||
return '待核销'
|
||||
|
@ -116,6 +122,10 @@ export function formatOrderStatus(order) {
|
|||
}
|
||||
|
||||
export function formatOrderColor(order) {
|
||||
if (order.refundStatus === 10 || order.refundStatus === 20) {
|
||||
return 'danger-color'
|
||||
}
|
||||
|
||||
if (order.status === 0) {
|
||||
return 'info-color'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue