feat : 完成页面我的订单部分 - 待评价 已评价 评价

This commit is contained in:
赵毅 2025-07-23 17:18:39 +08:00
parent 82b4ba8b07
commit 0770dd40fb
9 changed files with 905 additions and 104 deletions

View File

@ -0,0 +1,217 @@
page {
background-color: #f0f2f5;
min-height: 100vh;
overflow-y: hidden;
}
.container {
padding: 20rpx;
}
/* 商品图片区域 */
.goods-scroll {
width: 96%;
white-space: nowrap;
margin-bottom: 30rpx;
padding: 20rpx 15rpx;
background-color: #ffffff;
}
.goods-list {
display: inline-flex;
}
.goods-item {
width: 120rpx;
height: 120rpx;
margin-right: 16rpx;
border-radius: 8rpx;
overflow: hidden;
}
.goods-img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* 订单编号 */
.order-info {
display: flex;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1rpx solid #EEEEEE;
margin-bottom: 30rpx;
}
.order-label {
font-size: 26rpx;
color: #9a9a9a;
}
.order-value {
font-size: 26rpx;
color: #333333;
}
.goods{
display: flex;
align-items: center;
justify-content: flex-start;
gap: 20rpx;
}
/* 货品图 */
.goodsImg{
display: flex;
width: 100rpx;
height: 100rpx;
}
/* 评分区域 */
.rating{
width: 460rpx;
display: flex;
justify-content: space-between;
margin: 0 0 0rpx 55rpx;
color: #a6a6a6;
}
.rating-section {
background-color: #FFFFFF;
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: 30rpx;
height: 80vh;
}
.rating-item {
display: flex;
align-items: center;
margin-bottom: 30rpx;
margin-top: 20rpx;
}
.rating-item:last-child {
margin-bottom: 0;
}
.rating-label {
width: 160rpx;
font-size: 28rpx;
color: #333333;
font-weight: bold;
}
/* 评价输入 */
.comment-section {
padding: 20rpx;
margin-bottom: 30rpx;
border-top: 1rpx solid #f5f5f5;
}
.comment-input {
width: 100%;
min-height: 100rpx;
font-size: 26rpx;
color: #333333;
line-height: 1.5;
}
/* 图片上传 */
.upload-section {
/* background-color: #FFFFFF; */
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: 40rpx;
display: flex;
}
.upload-btn {
display: flex;
width: 150rpx;
height: 150rpx;
padding: 15rpx;
background-color: #f6f6f6;
flex-direction: column;
justify-content: center;
align-items: center;
margin-bottom: 20rpx;
border-radius: 20rpx;
}
.upload-icon {
width: 60rpx;
height: 50rpx;
margin-right: 10rpx;
}
.upload-text {
font-size: 28rpx;
color: #333333;
margin: 10rpx 0;
}
.upload-count {
font-size: 28rpx;
color: #999999;
}
.image-list {
display: flex;
/* flex-wrap: wrap; */
}
.image-item {
width: 170rpx;
height: 170rpx;
margin-right: 20rpx;
margin-bottom: 20rpx;
position: relative;
border-radius: 20rpx;
overflow: hidden;
}
.uploaded-img {
width: 100%;
height: 100%;
object-fit: cover;
}
.delete-btn {
position: absolute;
top: -10rpx;
right: -10rpx;
width: 36rpx;
height: 36rpx;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.delete-icon {
color: #FFFFFF;
font-size: 24rpx;
font-weight: bold;
}
/* 提交按钮 */
.submit-btn {
width: 90%;
height: 98rpx;
background-color: #ff4117;
border-radius: 49rpx;
display: flex;
justify-content: center;
align-items: center;
margin-top: 20rpx;
margin: 0 auto;
}
.btn-text {
font-size: 32rpx;
color: #FFFFFF;
font-weight: bold;
}

View File

@ -0,0 +1,190 @@
<template>
<view class="container">
<!-- 商品图片区域 -->
<scroll-view class="goods-scroll" scroll-x>
<view class="goods-list">
<view class="goods-item" v-for="(item, index) in goods" :key="index">
<image :src="item.image" class="goods-img"></image>
</view>
</view>
</scroll-view>
<!-- 评分区域 -->
<view class="rating-section">
<!-- 订单编号 -->
<view class="order-info">
<text class="order-label">订单编号</text>
<text class="order-value">38757328485</text>
</view>
<view class="goods">
<view>
<image src="http://localhost:8080/test.png" class="goodsImg"></image>
</view>
<view class="rating">
<view>很差</view>
<view></view>
<view>一般</view>
<view>不错</view>
<view>满意</view>
</view>
</view>
<!-- 商品品质 -->
<view class="rating-item">
<text class="rating-label">商品品质</text>
<u-rate
v-model="qualityRating"
size="40"
active-color="#FFB400"
inactive-color="#EEEEEE"
gutter="60"
></u-rate>
</view>
<!-- 配送速度 -->
<view class="rating-item">
<text class="rating-label">配送速度</text>
<u-rate
v-model="speedRating"
size="40"
active-color="#FFB400"
inactive-color="#EEEEEE"
gutter="60"
></u-rate>
</view>
<!-- 快递员服务 -->
<view class="rating-item">
<text class="rating-label">快递员服务</text>
<u-rate
v-model="serviceRating"
size="40"
active-color="#FFB400"
inactive-color="#EEEEEE"
gutter="60"
></u-rate>
</view>
<!-- 评价输入 -->
<view class="comment-section">
<textarea
class="comment-input"
placeholder="展开说说对商品的想法吧…"
v-model="comment"
></textarea>
</view>
<!-- 图片上传 -->
<view class="upload-section">
<view class="image-list">
<view
class="image-item"
v-for="(img, index) in imageList"
:key="index"
>
<image :src="img" class="uploaded-img"></image>
<view class="delete-btn" @click="deleteImage(index)">
<text class="delete-icon">×</text>
</view>
</view>
</view>
<view
class="upload-btn"
@click="chooseImage"
v-if="imageList.length < 3"
>
<image
src="http://localhost:8080/upload.png"
class="upload-icon"
></image>
<view class="upload-text">上传图片</view>
<view class="upload-count">({{ imageList.length }}/3)</view>
</view>
</view>
<!-- 提交按钮 -->
<view class="submit-btn" @click="submitEvaluate">
<text class="btn-text">提交</text>
</view>
</view>
</view>
</template>
<script>
import uImage from "../../../uni_modules/uview-ui/components/u--image/u--image.vue";
export default {
components: { uImage },
data() {
return {
//
goods: [
{ image: "http://localhost:8080/order_index1.png" },
{ image: "http://localhost:8080/order_index2.png" },
{ image: "http://localhost:8080/order_index3.png" },
{ image: "http://localhost:8080/order_index4.png" },
{ image: "http://localhost:8080/order_index5.png" },
{ image: "http://localhost:8080/order_index1.png" },
{ image: "http://localhost:8080/order_index2.png" },
{ image: "http://localhost:8080/order_index3.png" },
{ image: "http://localhost:8080/order_index4.png" },
{ image: "http://localhost:8080/order_index5.png" },
],
//
qualityRating: 5,
speedRating: 0,
serviceRating: 0,
//
comment: "",
//
imageList: [],
};
},
methods: {
//
chooseImage() {
if (this.imageList.length >= 3) {
uni.showToast({
title: "最多上传3张图片",
icon: "none",
});
return;
}
uni.chooseImage({
count: 3 - this.imageList.length,
sizeType: ["original", "compressed"],
sourceType: ["album", "camera"],
success: (res) => {
this.imageList = this.imageList.concat(res.tempFilePaths);
},
});
},
//
deleteImage(index) {
this.imageList.splice(index, 1);
},
//
submitEvaluate() {
if (!this.comment.trim() && this.imageList.length === 0) {
uni.showToast({
title: "请至少填写评价内容或上传图片",
icon: "none",
});
return;
}
// API
uni.showToast({
title: "评价提交成功",
icon: "success",
});
setTimeout(() => {
uni.navigateBack();
}, 1500);
},
},
onLoad(options) {
console.log("🚀 ~ onLoad ~ options:", options);
const itemObj = JSON.parse(decodeURIComponent(options.item));
},
};
</script>
<style>
@import url("./index.css");
</style>

View File

@ -0,0 +1,100 @@
.order-list {
padding: 15px;
background-color: #f5f5f5;
}
.order-item {
background-color: white;
border-radius: 10px;
padding: 15px;
margin-bottom: 15px;
}
.order-header {
margin-bottom: 15px;
}
.order-number {
font-size: 16px;
font-weight: bold;
color: #333;
}
.product-list {
border-top: 1px solid #eee;
padding-top: 15px;
}
.product-item {
display: flex;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #eee;
}
.product-item:last-child {
border-bottom: none;
}
.product-info {
flex: 1;
display: flex;
align-items: center;
}
.product-img {
position: relative;
width: 80px;
height: 80px;
margin-right: 15px;
}
.product-img image {
width: 100%;
height: 100%;
border-radius: 5px;
}
.tag {
position: absolute;
top: 0;
left: 0;
background-color: #ff7d00;
color: white;
font-size: 12px;
padding: 2px 5px;
border-radius: 3px 0 3px 0;
}
.product-details {
flex: 1;
}
.product-name {
font-size: 14px;
color: #333;
margin-bottom: 5px;
display: block;
}
.product-spec,
.product-unit {
font-size: 12px;
color: #666;
margin-bottom: 3px;
display: block;
}
.evaluate-btn {
background-color: #ff7d00;
color: white;
border: none;
border-radius: 10px;
/* padding: 8px 15px; */
font-size: 14px;
min-width: 80px;
}
.evaluate-btn::after {
border: none;
}

View File

@ -0,0 +1,93 @@
<template>
<view class="order-list">
<view class="order-item" v-for="(item, index) in orderList" :key="index">
<view class="order-header">
<text class="order-number">{{ item.orderNumber }}</text>
</view>
<view class="product-list">
<view class="product-item" v-for="(product, pIndex) in item.products" :key="pIndex">
<view class="product-info">
<view class="product-img">
<image :src="product.imageUrl" mode="aspectFit"></image>
<view class="tag" v-if="product.tag">{{ product.tag }}</view>
</view>
<view class="product-details">
<text class="product-name">{{ product.name }}</text>
<text class="product-spec">{{ product.spec }}</text>
<text class="product-unit">{{ product.unit }}</text>
</view>
</view>
<button class="evaluate-btn" @click="evaluateOrder(product)">评价</button>
</view>
</view>
</view>
</view>
</template>
<script>
import { request, NavgateTo } from '../../../utils';
export default {
data() {
return {
orderList: [
{
orderNumber: '4534534255',
products: [
{
imageUrl: 'http://localhost:8080/product.png',
tag: '当日达',
name: '货品名称',
spec: '货品规格',
unit: '货品单位'
},
{
imageUrl: 'http://localhost:8080/product.png',
tag: '当日达',
name: '货品名称',
spec: '货品规格',
unit: '货品单位'
}
]
},
{
orderNumber: '54352342331',
products: [
{
imageUrl: 'http://localhost:8080/product.png',
tag: '',
name: '货品名称',
spec: '货品规格',
unit: '货品单位'
},
{
imageUrl: 'http://localhost:8080/product.png',
tag: '',
name: '货品名称',
spec: '货品规格',
unit: '货品单位'
},
{
imageUrl: 'http://localhost:8080/product.png',
tag: '',
name: '货品名称',
spec: '货品规格',
unit: '货品单位'
}
]
}
]
};
},
methods: {
evaluateOrder(item) {
console.log("🚀 ~ evaluateOrder ~ orderNumber:", item)
NavgateTo(`../evaluate/index?item=${JSON.stringify(item)}`);
}
}
}
</script>
<style>
@import url("./awaitRated.css");
</style>

View File

@ -11,6 +11,9 @@ page {
height: 100rpx; height: 100rpx;
padding: 0 20rpx; padding: 0 20rpx;
box-sizing: border-box; box-sizing: border-box;
display: flex;
overflow-x: auto;
white-space: nowrap;
} }
.tabItem { .tabItem {

View File

@ -12,8 +12,13 @@
</view> </view>
<view class="content"> <view class="content">
<view v-for="(category, catIndex) in categoryList" :key="catIndex"> <view v-if="selectedTab === 5">
<view v-if="selectedTab === catIndex"> <awaitRated />
</view>
<view v-if="selectedTab === 6">
<rated />
</view>
<view v-else>
<view v-for="(item, index) in orderData" :key="index"> <view v-for="(item, index) in orderData" :key="index">
<view class="contentList"> <view class="contentList">
<!-- 订单头部信息 --> <!-- 订单头部信息 -->
@ -66,33 +71,24 @@
</view> </view>
<view class="btn-group" v-if="item.order_status === 6"> <view class="btn-group" v-if="item.order_status === 6">
<button class="yfd-btn" @click="cancelOrder">运费单</button> <button class="yfd-btn" @click="cancelOrder">运费单</button>
<button class="pay-btn" @click="cancelOrder"> <button class="pay-btn" @click="cancelOrder">再来一单</button>
再来一单
</button>
</view> </view>
<view class="btn-group" v-if="item.order_status === 4"> <view class="btn-group" v-if="item.order_status === 4">
<button class="cancel-btn" @click="checkLogistics"> <button class="cancel-btn" @click="checkLogistics">
查看物流 查看物流
</button> </button>
<button class="yfd-btn" @click="cancelOrder">运费单</button> <button class="yfd-btn" @click="cancelOrder">运费单</button>
<button class="pay-btn" @click="cancelOrder"> <button class="pay-btn" @click="cancelOrder">再来一单</button>
再来一单
</button>
</view> </view>
<view class="btn-group" v-if="item.order_status === 5"> <view class="btn-group" v-if="item.order_status === 5">
<button class="cancel-btn" @click="orderEvaluate"> <button class="cancel-btn" @click="orderEvaluate">
服务评价 服务评价
</button> </button>
<button class="yfd-btn" @click="cancelOrder">运费单</button> <button class="yfd-btn" @click="cancelOrder">运费单</button>
<button class="pay-btn" @click="cancelOrder"> <button class="pay-btn" @click="cancelOrder">再来一单</button>
再来一单
</button>
</view> </view>
<view class="btn-group" v-if="item.order_status === 7"> <view class="btn-group" v-if="item.order_status === 7">
<button class="pay-btn" @click="cancelOrder"> <button class="pay-btn" @click="cancelOrder">再来一单</button>
再来一单
</button>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -104,9 +100,15 @@
</template> </template>
<script> <script>
import { picUrl, NavgateTo, request } from "../../../utils"; import { picUrl, NavgateTo, request } from "../../../utils";
import { apiArr } from "../../../api/order" import { apiArr } from "../../../api/order";
import Rated from "./rated.vue";
import AwaitRated from "./awaitRated.vue";
export default { export default {
components: {
Rated,
AwaitRated,
},
data() { data() {
return { return {
categoryList: [ categoryList: [
@ -115,15 +117,19 @@ export default {
{ category_name: "待发货" }, { category_name: "待发货" },
{ category_name: "配送中" }, { category_name: "配送中" },
{ category_name: "已完成" }, { category_name: "已完成" },
{ category_name: "待评价" },
{ category_name: "已评价" },
], ],
selectedTab: 0, selectedTab: 0,
orderData:[], orderData: [],
}; };
}, },
methods: { methods: {
selectTab(index, item) { selectTab(index, item) {
this.selectedTab = index; this.selectedTab = index;
this.getOrderList() if (index !== 6) {
this.getOrderList();
}
}, },
cancelOrder() { cancelOrder() {
// //
@ -141,42 +147,44 @@ export default {
console.log("🚀 ~ goToPay ~ goToPay:", "去支付..."); console.log("🚀 ~ goToPay ~ goToPay:", "去支付...");
}, },
toDetails(order_status) { toDetails(order_status) {
NavgateTo(`/packages/myOrders/orderDetails/index?order_status=${order_status}`); NavgateTo(
`/packages/myOrders/orderDetails/index?order_status=${order_status}`
);
}, },
checkLogistics() { checkLogistics() {
NavgateTo(`/packages/myOrders/logistics/index`); NavgateTo(`/packages/myOrders/logistics/index`);
}, },
orderEvaluate(){ orderEvaluate() {
NavgateTo(`/packages/myOrders/orderEvaluate/index`); NavgateTo(`/packages/myOrders/orderEvaluate/index`);
}, },
getOrderStatus(order_status){ getOrderStatus(order_status) {
switch(order_status){ switch (order_status) {
case 1: case 1:
return '待付款' return "待付款";
case 2: case 2:
return '支付中' return "支付中";
case 3: case 3:
return '待发货' return "待发货";
case 4: case 4:
return '配送中' return "配送中";
case 5: case 5:
return '已完成' return "已完成";
case 6: case 6:
return '已取消' return "已取消";
case 7: case 7:
return '退款中' return "退款中";
case 8: case 8:
return '已退款' return "已退款";
} }
}, },
getOrderList(){ getOrderList() {
request(apiArr.orderList, "POST", { request(apiArr.orderList, "POST", {
user_id: uni.getStorageSync('userId') user_id: uni.getStorageSync("userId"),
}).then(res => { }).then((res) => {
const orderList = res.order_list || []; const orderList = res.order_list || [];
let filteredData = orderList; let filteredData = orderList;
@ -185,16 +193,18 @@ export default {
1: 1, // 1: 1, //
2: 3, // 2: 3, //
3: 4, // 3: 4, //
4: 5 // 4: 5, //
}; };
const targetStatus = statusMap[this.selectedTab]; const targetStatus = statusMap[this.selectedTab];
if (targetStatus) { if (targetStatus) {
filteredData = orderList.filter(item => item.order_status === targetStatus); filteredData = orderList.filter(
(item) => item.order_status === targetStatus
);
} }
} }
this.orderData = filteredData; this.orderData = filteredData;
}) });
} },
}, },
onLoad(options) { onLoad(options) {

View File

@ -0,0 +1,113 @@
.evaluation-container {
padding: 20rpx;
background-color: #f5f5f5;
min-height: 100vh;
}
.order-header {
display: flex;
justify-content: space-between;
padding: 15rpx 0;
border-bottom: 1rpx solid #eee;
margin-bottom: 20rpx;
}
.order-number {
font-size: 32rpx;
font-weight: 600;
color: #333;
}
.order-date {
font-size: 26rpx;
color: #999;
}
.evaluation-content {
background: #fff;
border-radius: 10rpx;
padding: 20rpx;
margin-bottom: 20rpx;
}
.evaluation-text {
font-size: 28rpx;
color: #333;
line-height: 40rpx;
margin-bottom: 20rpx;
}
.image-list {
display: flex;
gap: 15rpx;
padding: 10rpx 0;
}
.image-item {
width: 140rpx;
height: 140rpx;
border: 1rpx dashed #ddd;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.image-item image {
width: 80rpx;
height: 80rpx;
}
.image-text {
font-size: 24rpx;
color: #999;
margin-top: 10rpx;
}
.product-info {
background: #fff;
border-radius: 10rpx;
padding: 20rpx;
display: flex;
align-items: center;
}
.product-img {
position: relative;
margin-right: 20rpx;
}
.product-img image {
width: 120rpx;
height: 120rpx;
border-radius: 8rpx;
}
.tag {
position: absolute;
top: 0;
left: 0;
background: #ff7a00;
color: #fff;
font-size: 20rpx;
padding: 2rpx 8rpx;
margin-right: 5rpx;
}
.product-details {
flex: 1;
}
.product-name {
font-size: 28rpx;
color: #333;
margin-bottom: 10rpx;
line-height: 40rpx;
}
.product-specs {
display: flex;
gap: 20rpx;
font-size: 26rpx;
color: #666;
}

View File

@ -0,0 +1,69 @@
<template>
<view class="evaluation-container">
<!-- 订单头部信息 -->
<view class="order-header">
<text class="order-number">{{ orderInfo.orderNumber }}</text>
<text class="order-date">{{ orderInfo.date }}</text>
</view>
<!-- 评价内容区域 -->
<view class="evaluation-content">
<text class="evaluation-text">{{ evaluationInfo.content }}</text>
<!-- 评价图片区域 -->
<view class="image-list">
<view class="image-item" v-for="(img, index) in evaluationInfo.images" :key="index">
<image :src="img.url" mode="aspectFill"></image>
<text class="image-text">{{ img.text }}</text>
</view>
</view>
</view>
<!-- 商品信息区域 -->
<view class="product-info">
<view class="product-img">
<image :src="productInfo.imageUrl" mode="aspectFit"></image>
<view class="tag" v-for="(tag, index) in productInfo.tags" :key="index">{{ tag }}</view>
</view>
<view class="product-details">
<text class="product-name">{{ productInfo.name }}</text>
<view class="product-specs">
<text class="spec-item">{{ productInfo.spec }}</text>
<text class="spec-item">{{ productInfo.unit }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
orderInfo: {
orderNumber: '4534534255',
date: '2025-07-21'
},
evaluationInfo: {
content: '评价文字内容',
images: [
{ url: 'http://localhost:8080/eval1.png', text: '评价图片' },
{ url: 'http://localhost:8080/eval2.png', text: '评价图片' },
{ url: 'http://localhost:8080/eval3.png', text: '评价图片' }
]
},
productInfo: {
imageUrl: 'http://localhost:8080/product.png',
tags: ['当日达', '当日达'],
name: '货品名称',
spec: '货品规格',
unit: '货品单位'
}
};
}
};
</script>
<style>
@import url("./rated.css");
</style>

View File

@ -782,6 +782,12 @@
"style": { "style": {
"navigationBarTitleText": "选择自提点" "navigationBarTitleText": "选择自提点"
} }
},
{
"path": "evaluate/index",
"style": {
"navigationBarTitleText": "评价"
}
} }
] ]
} }