订单详情页修改

parent 8010e319
......@@ -57,12 +57,7 @@
</view>
</view>
</view>
<wd-icon
name="chevron-right"
size="22px"
color="#333"
v-if="orderDetail.baseOrder.prodType === 9"
></wd-icon>
<wd-icon name="chevron-right" size="22px" color="#333"></wd-icon>
</view>
<view class="rectangle-with-semicircles"></view>
......@@ -138,18 +133,18 @@
<view class="info" v-if="prodDetail && orderDetail.baseOrder.prodType === 5">
<view class="menu padding">
<text class="title">到店吃套餐</text>
<view class="menu-box" v-for="(item, index) in prodDetail.prodAdditionals" :key="index">
<view class="menu-box" v-for="(item, index) in productCombination" :key="index">
<view class="header">
<view class="circle"></view>
<text class="h-name">{{ item.categorizeName }}</text>
<text class="h-name">{{ item[0].categorizeName }}</text>
</view>
<view class="list-box">
<text class="name">{{ item.prodName }}</text>
<view class="list-box" v-for="(i, n) in item" :key="n">
<text class="name">{{ i.prodName }}</text>
<view class="right-box">
<text class="num">({{ item.count }}份)</text>
<text class="num">({{ i.count }}份)</text>
<view class="price-box">
<text class="icon"></text>
<text class="num">{{ item.price }}</text>
<text class="num">{{ i.price }}</text>
</view>
</view>
</view>
......@@ -171,7 +166,7 @@
}}
</text>
</view>
<view class="row">
<view class="row" v-if="prodDetail.groupPurchasePackageRule.rule">
<text class="name">使用规则</text>
<text class="colon"></text>
<text class="textarea">{{ prodDetail.groupPurchasePackageRule.rule }}</text>
......@@ -319,11 +314,29 @@ const codeDetail = (item) => {
* 获取商品详情
*/
const prodDetail = ref();
const productCombination = ref([]);
const getProductDetail = async (id) => {
const res = await getProdDetail({ prodId: id });
prodDetail.value = res.data.data;
productCombination.value = groupByCategorizeName(res.data.data.prodAdditionals);
};
// 定义一个函数来根据 categorizeName 字段对数据进行分组
function groupByCategorizeName(prodAdditionals) {
if (!Array.isArray(prodAdditionals) || prodAdditionals.length === 0) {
return [];
}
const grouped = prodAdditionals.reduce((result, item) => {
if (!result[item.categorizeName]) {
result[item.categorizeName] = [];
}
result[item.categorizeName].push(item);
return result;
}, {});
return Object.values(grouped);
}
/**
* 获取商铺信息
*/
......@@ -432,6 +445,11 @@ const anotherOrder = () => {
};
const toProdDetail = () => {
if (orderDetail.value.baseOrder.prodType === 5) {
xma.navigateTo({
url: `/pages/packageDetails/packageDetails?prodId=${orderDetail.value.orderItems[0].prodId}`,
});
}
if (orderDetail.value.baseOrder.prodType === 9) {
xma.navigateTo({
url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?shopId=${orderDetail.value.baseOrder.shopId}&prodId=${orderDetail.value.orderItems[0].prodId}`,
......@@ -520,7 +538,7 @@ page {
.price-box {
display: flex;
align-items: last baseline;
align-items: baseline;
.icon {
font-weight: bold;
......@@ -602,6 +620,7 @@ page {
.between {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 28rpx;
}
......@@ -650,6 +669,7 @@ page {
font-size: 32rpx;
line-height: 56rpx;
font-weight: bold;
max-width: 520rpx;
}
.btn {
......@@ -769,7 +789,7 @@ page {
.price-box {
display: flex;
align-items: last baseline;
align-items: baseline;
text {
font-family: PingFang SC Bold;
......@@ -781,6 +801,7 @@ page {
.icon {
font-size: 26rpx;
// line-height: 28rpx;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment