完善售后模块
This commit is contained in:
parent
1e347ca68f
commit
38eedaffe0
@ -7,4 +7,5 @@ export const apiArr = {
|
||||
revokeApply: "/api/v2/wechat/commodity/after-sales/revoke-apply", //撤销售后申请
|
||||
changeGoodsList: "/api/v2/wechat/commodity/after-sales/change-goods-list", //商品售后换货商品列表
|
||||
updateApply: "/api/v2/wechat/commodity/after-sales/update-apply", //商品订单售后修改申请
|
||||
createReview: "/api/v2/wechat/commodity/review/create", //创建订单评价
|
||||
};
|
||||
|
||||
@ -2,24 +2,20 @@
|
||||
<view class="order-list">
|
||||
<view class="order-item" v-for="(item, index) in orderList" :key="index">
|
||||
<view class="order-header">
|
||||
<text class="order-name">{{ item.orderName }}</text>
|
||||
<text class="order-number">{{ item.orderNumber }}</text>
|
||||
<text class="order-name">{{ item.supplier_name }}</text>
|
||||
<text class="order-number">{{ item.order_no }}</text>
|
||||
</view>
|
||||
<view class="product-list">
|
||||
<view
|
||||
class="product-item"
|
||||
v-for="(product, pIndex) in item.products"
|
||||
:key="pIndex"
|
||||
>
|
||||
<view class="product-item" v-for="(product, pIndex) in item.commodity_order_item_list" :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>
|
||||
<image :src="product.commodity_pic"></image>
|
||||
<view class="tag" v-if="product.is_same_day === 1">当日达</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>
|
||||
<text class="product-name">{{ product.goods_name }}</text>
|
||||
<text class="product-spec">{{ product.goods_spec }}</text>
|
||||
<text class="product-unit">{{ product.sales_price }}/{{ product.goods_unit }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<button class="evaluate-btn" @click="evaluateOrder(product)">
|
||||
@ -35,56 +31,15 @@
|
||||
import { request, NavgateTo } from "../../../utils";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
orderData: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
orderList: [
|
||||
{
|
||||
orderName: "衡水商贸国际公司",
|
||||
orderNumber: "4534534255",
|
||||
products: [
|
||||
{
|
||||
imageUrl: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/product.png",
|
||||
tag: "当日达",
|
||||
name: "货品名称",
|
||||
spec: "货品规格",
|
||||
unit: "货品单位",
|
||||
},
|
||||
{
|
||||
imageUrl: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/product.png",
|
||||
tag: "当日达",
|
||||
name: "货品名称",
|
||||
spec: "货品规格",
|
||||
unit: "货品单位",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
orderNumber: "54352342331",
|
||||
products: [
|
||||
{
|
||||
imageUrl: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/product.png",
|
||||
tag: "",
|
||||
name: "货品名称",
|
||||
spec: "货品规格",
|
||||
unit: "货品单位",
|
||||
},
|
||||
{
|
||||
imageUrl: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/product.png",
|
||||
tag: "",
|
||||
name: "货品名称",
|
||||
spec: "货品规格",
|
||||
unit: "货品单位",
|
||||
},
|
||||
{
|
||||
imageUrl: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/product.png",
|
||||
tag: "",
|
||||
name: "货品名称",
|
||||
spec: "货品规格",
|
||||
unit: "货品单位",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
orderList: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -93,6 +48,21 @@ export default {
|
||||
NavgateTo(`../evaluate/index?item=${JSON.stringify(item)}`);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// 组件挂载时初始化数据
|
||||
this.orderList = this.orderData;
|
||||
console.log("🚀 ~ mounted ~ this.orderList:", this.orderList);
|
||||
},
|
||||
watch: {
|
||||
// 监听orderData的变化,确保子组件能响应父组件数据更新
|
||||
orderData: {
|
||||
handler(newVal) {
|
||||
this.orderList = newVal;
|
||||
console.log("🚀 ~ watch orderData ~ this.orderList:", this.orderList);
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@ -6,11 +6,11 @@
|
||||
<!-- 订单编号 -->
|
||||
<view class="order-info">
|
||||
<text class="order-label">订单编号</text>
|
||||
<text class="order-value">38757328485</text>
|
||||
<text class="order-value">{{ itemObj.order_no }}</text>
|
||||
</view>
|
||||
<view class="goods">
|
||||
<view>
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png" class="goodsImg"></image>
|
||||
<image :src="itemObj.commodity_order_item_list[0].commodity_pic" class="goodsImg"></image>
|
||||
</view>
|
||||
<view class="rating">
|
||||
<view>很差</view>
|
||||
@ -23,70 +23,38 @@
|
||||
<!-- 商品品质 -->
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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"
|
||||
>
|
||||
<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="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/upload.png"
|
||||
class="upload-icon"
|
||||
></image>
|
||||
<view class="upload-btn" @click="chooseImage" v-if="imageList.length < 3">
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/upload.png" class="upload-icon">
|
||||
</image>
|
||||
<view class="upload-text">上传图片</view>
|
||||
<view class="upload-count">({{ imageList.length }}/3)</view>
|
||||
</view>
|
||||
@ -101,31 +69,22 @@
|
||||
|
||||
<script>
|
||||
import uImage from "../../../uni_modules/uview-ui/components/u--image/u--image.vue";
|
||||
import { picUrl, NavgateTo, request } from "../../../utils";
|
||||
import { apiArr } from "../../../api/afterSale";
|
||||
|
||||
export default {
|
||||
components: { uImage },
|
||||
data() {
|
||||
return {
|
||||
// 商品列表
|
||||
goods: [
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index1.png" },
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index2.png" },
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index3.png" },
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index4.png" },
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index5.png" },
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index1.png" },
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index2.png" },
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index3.png" },
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index4.png" },
|
||||
{ image: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/order_index5.png" },
|
||||
],
|
||||
// 评分数据
|
||||
qualityRating: 5,
|
||||
qualityRating: 0,
|
||||
speedRating: 0,
|
||||
serviceRating: 0,
|
||||
// 评价内容
|
||||
comment: "",
|
||||
// 图片列表
|
||||
imageList: [],
|
||||
itemObj: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -160,19 +119,29 @@ export default {
|
||||
});
|
||||
return;
|
||||
}
|
||||
//
|
||||
uni.showToast({
|
||||
title: "评价提交成功",
|
||||
icon: "success",
|
||||
const params = {
|
||||
order_id: this.itemObj.id,
|
||||
goods_id: this.itemObj.commodity_order_item_list[0].goods_id,
|
||||
user_id: uni.getStorageSync("userId"),
|
||||
quality_score: this.qualityRating,
|
||||
speed_score: this.speedRating,
|
||||
service_score: this.serviceRating,
|
||||
user_review: this.comment,
|
||||
review_image: this.imageList,
|
||||
}
|
||||
request(apiArr.createReview, "POST", params).then((res) => {
|
||||
uni.showToast({
|
||||
title: "评价提交成功",
|
||||
icon: "success",
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log("🚀 ~ onLoad ~ options:", options);
|
||||
const itemObj = JSON.parse(decodeURIComponent(options.item));
|
||||
this.itemObj = JSON.parse(decodeURIComponent(options.item));
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -10,12 +10,12 @@
|
||||
|
||||
<view class="content">
|
||||
<view v-if="selectedTab === 6">
|
||||
<awaitRated />
|
||||
<awaitRated :orderData="orderData" />
|
||||
</view>
|
||||
<view v-if="selectedTab === 7">
|
||||
<rated />
|
||||
<view v-else-if="selectedTab === 7">
|
||||
<rated :orderData="orderData" />
|
||||
</view>
|
||||
<view v-if="selectedTab === 8">
|
||||
<view v-else-if="selectedTab === 8">
|
||||
<afterSale :afterSaleList="afterSaleList" @revokeApply="revokeApply" />
|
||||
</view>
|
||||
<view v-else>
|
||||
@ -33,7 +33,7 @@
|
||||
</view>
|
||||
<view v-else class="order_status">{{
|
||||
getOrderStatus(item.order_status)
|
||||
}}</view>
|
||||
}}</view>
|
||||
</view>
|
||||
<text>提交订单:{{ item.order_time }}</text>
|
||||
</view>
|
||||
@ -69,17 +69,17 @@
|
||||
<view class="btn-group" v-if="item.order_status === 5">
|
||||
<text class="afterSaleNum">{{ item.commodity_order_item_list.length }}笔售后</text>
|
||||
<button class="cancel-btn" @click="afterSale(item)">退换/售后</button>
|
||||
<button class="pay-btn">评价</button>
|
||||
<button class="pay-btn" @click="orderEvaluate(item)" :disabled="item.evauate_status === 1">评价</button>
|
||||
</view>
|
||||
<view class="btn-group" v-if="item.order_status === 6">
|
||||
<!-- <button class="cancel-btn" @click="orderEvaluate">
|
||||
服务评价
|
||||
</button>
|
||||
<button class="yfd-btn" @click="cancelOrder">运费单</button>
|
||||
<button class="pay-btn" @click="cancelOrder">再来一单</button> -->
|
||||
<button class="yfd-btn" @click="cancelOrder">运费单</button> -->
|
||||
<button class="pay-btn" @click="goToPay(item)">再来一单</button>
|
||||
</view>
|
||||
<view class="btn-group" v-if="item.order_status === 7">
|
||||
<button class="pay-btn" @click="cancelOrder">再来一单</button>
|
||||
<button class="pay-btn" @click="goToPay(item)">再来一单</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -164,14 +164,27 @@ export default {
|
||||
showTkPopup: false,//申请退款
|
||||
afterSaleItem: '',//操作对象
|
||||
afterSaleList: [],//售后列表
|
||||
selectStatus: '',//选中的status
|
||||
evaluateStatus: '',//评价状态
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
selectTab(index, item) {
|
||||
this.selectedTab = index;
|
||||
if (index !== 6) {
|
||||
this.getOrderList();
|
||||
if (index == 6) {
|
||||
this.evaluateStatus = 2;
|
||||
this.selectStatus = ''
|
||||
} else if (index == 7) {
|
||||
this.evaluateStatus = 1;
|
||||
this.selectStatus = ''
|
||||
} else if (index == 2) {
|
||||
this.selectStatus = 6;
|
||||
this.evaluateStatus = ''
|
||||
} else {
|
||||
this.selectStatus = index;
|
||||
this.evaluateStatus = ''
|
||||
}
|
||||
this.getOrderList();
|
||||
},
|
||||
// 取消订单
|
||||
cancelOrder(item) {
|
||||
@ -181,7 +194,6 @@ export default {
|
||||
|
||||
// 处理订单取消事件
|
||||
handleOrderCancelled(data) {
|
||||
console.log("🚀 ~ handleOrderCancelled ~ 取消原因:", data.reason);
|
||||
const params = {
|
||||
order_id: this.afterSaleItem.id,
|
||||
method: 1,
|
||||
@ -195,7 +207,6 @@ export default {
|
||||
|
||||
// 售后按钮
|
||||
afterSale(item) {
|
||||
console.log("🚀 ~ afterSale ~ item:", item)
|
||||
this.afterSaleGoods = item.commodity_order_item_list;
|
||||
// 保存完整的订单对象
|
||||
this.afterSaleOrderItem = item;
|
||||
@ -206,7 +217,6 @@ export default {
|
||||
// request(afterSaleApi.isAllow, "POST", {
|
||||
// order_id: item.id,
|
||||
// }).then((res) => {
|
||||
// console.log("🚀 ~ afterSale ~ res:", res)
|
||||
// if (res.data.is_allow_after_sales) {
|
||||
// this.afterSaleGoods = res.data.allow_items;
|
||||
// // this.selectedAsGood = item.commodity_order_item_list[0].id;
|
||||
@ -219,8 +229,6 @@ export default {
|
||||
|
||||
// 处理退款提交事件
|
||||
handleRefundSubmitted(data) {
|
||||
console.log("🚀 ~ handleRefundSubmitted ~ handleRefundSubmitted:", this.afterSaleOrderItem)
|
||||
console.log("🚀 ~ handleRefundSubmitted ~ 退款申请提交成功:", data);
|
||||
const params = {
|
||||
nick_name: uni.getStorageSync("nickName"),
|
||||
order_id: this.afterSaleOrderItem.id,
|
||||
@ -236,7 +244,6 @@ export default {
|
||||
receiving_address: data.merchantAddress,
|
||||
change_goods_id: data.changeServiceId
|
||||
}
|
||||
console.log("🚀 ~ handleRefundConfirmed ~ parasm:", params)
|
||||
// request(afterSaleApi.afterSaleCreate, "POST", params).then((res) => {
|
||||
// this.getOrderList();
|
||||
// });
|
||||
@ -256,8 +263,6 @@ export default {
|
||||
|
||||
// 处理退款确认事件
|
||||
handleRefundConfirmed(data) {
|
||||
console.log("🚀 ~ handleRefundConfirmed ~ handleRefundConfirmed:", this.afterSaleItem)
|
||||
console.log("🚀 ~ handleRefundConfirmed ~ 退款原因:", data.reason);
|
||||
const params = {
|
||||
nick_name: uni.getStorageSync("nickName"),
|
||||
order_id: this.afterSaleItem.id,
|
||||
@ -267,7 +272,6 @@ export default {
|
||||
refund_amount: this.afterSaleItem.total_amount,
|
||||
order_status: 3
|
||||
}
|
||||
console.log("🚀 ~ handleRefundConfirmed ~ parasm:", params)
|
||||
request(afterSaleApi.afterSaleCreate, "POST", params).then((res) => {
|
||||
this.getOrderList();
|
||||
});
|
||||
@ -284,7 +288,6 @@ export default {
|
||||
order_id: item.id,
|
||||
method: 2,
|
||||
}
|
||||
console.log("🚀 ~ confirmReceiving ~ params:", params)
|
||||
request(afterSaleApi.cancelOrConfirm, "POST", params).then((res) => {
|
||||
this.getOrderList();
|
||||
});
|
||||
@ -293,7 +296,44 @@ export default {
|
||||
});
|
||||
},
|
||||
goToPay(item) {
|
||||
console.log(item);
|
||||
// 创建转换后的商品数组
|
||||
const transformedItems = item.commodity_order_item_list.map(goods => ({
|
||||
checked: true,
|
||||
commodity_goods_info: {
|
||||
commodity_brief: "",
|
||||
commodity_id: goods.goods_id,
|
||||
commodity_pic: goods.commodity_pic,
|
||||
goods_alias: goods.goods_name,
|
||||
goods_carousel: "",
|
||||
goods_detail_pic: "",
|
||||
goods_intro: goods.goods_name,
|
||||
goods_name: goods.goods_name,
|
||||
goods_no: "",
|
||||
goods_spec: goods.goods_spec,
|
||||
goods_status: 1,
|
||||
goods_unit: goods.goods_unit,
|
||||
goods_video: "",
|
||||
group_buy_activity_info: null,
|
||||
id: goods.id,
|
||||
is_same_day: goods.is_same_day || false,
|
||||
is_support_same_day: goods.is_support_same_day || 2,
|
||||
market_price: goods.sales_price,
|
||||
sales_price: goods.sales_price,
|
||||
stock_quantity: goods.stock_quantity
|
||||
},
|
||||
commodity_id: goods.goods_id,
|
||||
count: goods.count,
|
||||
create_time: item.create_time,
|
||||
goods_id: goods.id,
|
||||
group_buy_id: 0,
|
||||
id: goods.id,
|
||||
supplier_id: item.supplier_id,
|
||||
supplier_name: item.supplier_name,
|
||||
update_time: item.update_time,
|
||||
user_id: item.user_id
|
||||
}));
|
||||
|
||||
NavgateTo(`/packages/shop/groupPurchaseSubmit/index?shopCarList=${JSON.stringify(transformedItems)}`)
|
||||
},
|
||||
toDetails(item) {
|
||||
NavgateTo(
|
||||
@ -305,8 +345,8 @@ export default {
|
||||
NavgateTo(`/packages/myOrders/logistics/index`);
|
||||
},
|
||||
|
||||
orderEvaluate() {
|
||||
NavgateTo(`/packages/myOrders/orderEvaluate/index`);
|
||||
orderEvaluate(item) {
|
||||
NavgateTo(`/packages/myOrders/evaluate/index?item=${JSON.stringify(item)}`);
|
||||
},
|
||||
|
||||
getOrderStatus(order_status) {
|
||||
@ -331,8 +371,10 @@ export default {
|
||||
},
|
||||
|
||||
getOrderList() {
|
||||
this.orderData = []
|
||||
request(afterSaleApi.orderList, "POST", {
|
||||
order_status: this.selectedTab,
|
||||
order_status: this.selectStatus,
|
||||
evaluate_status: this.evaluateStatus,
|
||||
user_id: uni.getStorageSync("userId"),
|
||||
}).then((res) => {
|
||||
res.order_list.forEach(item => {
|
||||
|
||||
@ -140,17 +140,17 @@
|
||||
<view class="bottom-buttons" v-if="status === '4'">
|
||||
<button class="cancel-btn" @click="checkLogistics">查看物流</button>
|
||||
<!-- <button class="yfd-btn" @click="cancelOrder">运费单</button> -->
|
||||
<button class="pay-btn" @click="gotoPayment">立即支付</button>
|
||||
<button class="pay-btn" @click="confirmReceiving">确认收货</button>
|
||||
</view>
|
||||
<view class="bottom-buttons" v-if="status === '5'">
|
||||
<!-- <button class="cancel-btn" @click="orderEvaluate">服务评价</button> -->
|
||||
<!-- <button class="cancel-btn" @click="afterSale">退换/售后</button> -->
|
||||
<!-- <button class="yfd-btn" @click="cancelOrder">运费单</button> -->
|
||||
<button class="pay-btn" @click="gotoPayment">立即支付</button>
|
||||
<button class="pay-btn" @click="orderEvaluate" :disabled="orderInfo.evauate_status === 1">评价</button>
|
||||
</view>
|
||||
<view class="bottom-buttons" v-if="status === '6'">
|
||||
<!-- <button class="yfd-btn" @click="cancelOrder">运费单</button> -->
|
||||
<!-- <button class="cancel-btn" @click="cancelOrder">服务评价</button> -->
|
||||
<!-- <button class="pay-btn" @click="gotoPayment">再来一单</button> -->
|
||||
<button class="pay-btn" @click="gotoPayment">再来一单</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -267,17 +267,56 @@ export default {
|
||||
});
|
||||
},
|
||||
gotoPayment() {
|
||||
// 跳转到支付页面
|
||||
// uni.navigateTo({
|
||||
// url: "/kitchen/pay/index",
|
||||
// });
|
||||
// 创建转换后的商品数组
|
||||
const transformedItems = this.orderInfo.commodity_order_item_list.map(goods => ({
|
||||
checked: true,
|
||||
commodity_goods_info: {
|
||||
commodity_brief: "",
|
||||
commodity_id: goods.goods_id,
|
||||
commodity_pic: goods.commodity_pic,
|
||||
goods_alias: goods.goods_name,
|
||||
goods_carousel: "",
|
||||
goods_detail_pic: "",
|
||||
goods_intro: goods.goods_name,
|
||||
goods_name: goods.goods_name,
|
||||
goods_no: "",
|
||||
goods_spec: goods.goods_spec,
|
||||
goods_status: 1,
|
||||
goods_unit: goods.goods_unit,
|
||||
goods_video: "",
|
||||
group_buy_activity_info: null,
|
||||
id: goods.id,
|
||||
is_same_day: goods.is_same_day || false,
|
||||
is_support_same_day: goods.is_support_same_day || 2,
|
||||
market_price: goods.sales_price,
|
||||
sales_price: goods.sales_price,
|
||||
stock_quantity: goods.stock_quantity
|
||||
},
|
||||
commodity_id: goods.goods_id,
|
||||
count: goods.count,
|
||||
create_time: this.orderInfo.create_time,
|
||||
goods_id: goods.id,
|
||||
group_buy_id: 0,
|
||||
id: goods.id,
|
||||
supplier_id: this.orderInfo.supplier_id,
|
||||
supplier_name: this.orderInfo.supplier_name,
|
||||
update_time: this.orderInfo.update_time,
|
||||
user_id: this.orderInfo.user_id
|
||||
}));
|
||||
|
||||
NavgateTo(`/packages/shop/groupPurchaseSubmit/index?shopCarList=${JSON.stringify(transformedItems)}`)
|
||||
},
|
||||
checkLogistics() {
|
||||
NavgateTo(`/packages/myOrders/logistics/index`);
|
||||
},
|
||||
|
||||
orderEvaluate() {
|
||||
NavgateTo(`/packages/myOrders/orderEvaluate/index`);
|
||||
NavgateTo(`/packages/myOrders/evaluate/index?item=${JSON.stringify(this.orderInfo)}`);
|
||||
},
|
||||
|
||||
// 售后按钮
|
||||
afterSale() {
|
||||
NavgateTo(`/packages/myOrders/afterSale/index`);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@ -66,8 +66,8 @@
|
||||
}
|
||||
|
||||
.image-item image {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-text {
|
||||
|
||||
@ -1,44 +1,38 @@
|
||||
<template>
|
||||
<view class="evaluation-container">
|
||||
<!-- 评价内容区域 -->
|
||||
<view class="evaluation-content">
|
||||
<!-- 订单头部信息 -->
|
||||
<view class="order-header">
|
||||
<text class="order-name">{{ orderInfo.orderName }}</text>
|
||||
<text class="order-number">{{ orderInfo.orderNumber }}</text>
|
||||
</view>
|
||||
|
||||
<view class="evaluation-area">
|
||||
<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 v-for="(item, index) in orderList" :key="index">
|
||||
<view class="evaluation-content">
|
||||
<!-- 订单头部信息 -->
|
||||
<view class="order-header">
|
||||
<text class="order-name">{{ item.supplier_name }}</text>
|
||||
<text class="order-number">{{ item.order_no }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="order-date">{{ orderInfo.date }}</text>
|
||||
</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>
|
||||
<text class="product-spec">{{ productInfo.spec }}</text>
|
||||
<text class="product-unit">{{ productInfo.unit }}</text>
|
||||
<view class="evaluation-area">
|
||||
<text class="evaluation-text">{{ item.evaluate_info.user_review }}</text>
|
||||
<!-- 评价图片区域 -->
|
||||
<view class="image-list" v-if="item.evaluate_info.review_image && item.evaluate_info.review_image.length > 0">
|
||||
<view class="image-item" v-for="(img, index) in parseReviewImages(item.evaluate_info.review_image)" :key="index">
|
||||
<image :src="img"></image>
|
||||
</view>
|
||||
</view>
|
||||
<text class="order-date">{{ item.evaluate_info.create_time }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 商品信息区域 -->
|
||||
<view class="product-info">
|
||||
<view class="product-img">
|
||||
<image :src="item.commodity_order_item_list[0].commodity_pic"></image>
|
||||
<view class="tag" v-if="item.commodity_order_item_list[0].is_same_day === 1" :key="index">当日达</view>
|
||||
</view>
|
||||
<view class="product-details">
|
||||
<text class="product-name">{{ item.commodity_order_item_list[0].goods_name }}</text>
|
||||
<text class="product-spec">{{ item.commodity_order_item_list[0].goods_spec }}</text>
|
||||
<text class="product-unit">{{ item.commodity_order_item_list[0].sales_price }}/{{ item.commodity_order_item_list[0].goods_unit }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -47,30 +41,61 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
orderData: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
orderInfo: {
|
||||
orderName: "衡水商贸国际公司",
|
||||
orderNumber: "4534534255",
|
||||
date: "2025-07-21",
|
||||
},
|
||||
evaluationInfo: {
|
||||
content: "评价文字内容",
|
||||
images: [
|
||||
{ url: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/eval1.png", text: "评价图片" },
|
||||
{ url: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/eval2.png", text: "评价图片" },
|
||||
{ url: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/eval3.png", text: "评价图片" },
|
||||
],
|
||||
},
|
||||
productInfo: {
|
||||
imageUrl: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/product.png",
|
||||
tags: ["当日达", "当日达"],
|
||||
name: "货品名称",
|
||||
spec: "货品规格",
|
||||
unit: "货品单位",
|
||||
},
|
||||
orderList: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 解析评价图片格式
|
||||
parseReviewImages(reviewImage) {
|
||||
try {
|
||||
// 检查是否为字符串类型且包含有效内容
|
||||
if (typeof reviewImage === 'string' && reviewImage.trim()) {
|
||||
// 去除可能的引号和空格,然后尝试解析为数组
|
||||
const cleanStr = reviewImage.replace(/^"|"$/g, '').replace(/^'|'$/g, '').trim();
|
||||
let images = [];
|
||||
|
||||
// 尝试使用JSON解析
|
||||
if (cleanStr.startsWith('[') && cleanStr.endsWith(']')) {
|
||||
images = JSON.parse(cleanStr);
|
||||
} else if (cleanStr.includes(',')) {
|
||||
// 如果是逗号分隔的字符串
|
||||
images = cleanStr.split(',').map(img => img.trim());
|
||||
}
|
||||
|
||||
// 确保返回的是数组并且每个元素都是有效的URL
|
||||
return Array.isArray(images) ? images : [];
|
||||
}
|
||||
// 如果已经是数组则直接返回
|
||||
return Array.isArray(reviewImage) ? reviewImage : [];
|
||||
} catch (error) {
|
||||
console.error('解析评价图片失败:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 组件挂载时初始化数据
|
||||
this.orderList = this.orderData;
|
||||
console.log("🚀 ~ mounted ~ this.orderList:", this.orderList);
|
||||
},
|
||||
watch: {
|
||||
// 监听orderData的变化,确保子组件能响应父组件数据更新
|
||||
orderData: {
|
||||
handler(newVal) {
|
||||
this.orderList = newVal;
|
||||
console.log("🚀 ~ watch orderData ~ this.orderList:", this.orderList);
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@ -334,6 +334,7 @@ export default {
|
||||
},
|
||||
onLoad(options) {
|
||||
this.carList = JSON.parse(options.shopCarList)
|
||||
console.log("🚀 ~ onLoad ~ JSON.parse(options.shopCarList):", JSON.parse(options.shopCarList))
|
||||
},
|
||||
onShow() {
|
||||
this.getUserAddress()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user