This commit is contained in:
parent
bc1a8e6b3f
commit
1fd330b233
|
|
@ -33,6 +33,7 @@
|
|||
<!-- 菜品列表,按门店分组 -->
|
||||
<view class="section" v-for="shop in shopGroups" :key="shop.shopId">
|
||||
<view class="shop-header">
|
||||
<image v-if="shop.shopPhoto" class="shop-photo" :src="shop.shopPhoto" mode="aspectFill" @click="previewImage(shop.shopPhoto)"></image>
|
||||
<text class="shop-name">{{ shop.shopName }}</text>
|
||||
</view>
|
||||
<view class="dish-item" v-for="item in shop.items" :key="item.id">
|
||||
|
|
@ -131,6 +132,7 @@ export default {
|
|||
map[key] = {
|
||||
shopId: item.shopId,
|
||||
shopName: item.shopName || `门店${item.shopId}`,
|
||||
shopPhoto: item.shopPhoto || '',
|
||||
items: []
|
||||
}
|
||||
}
|
||||
|
|
@ -195,7 +197,12 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
/** 提交跑腿认证 */
|
||||
/** 预览图片 */
|
||||
previewImage(url) {
|
||||
if (!url) return
|
||||
uni.previewImage({ urls: [url] })
|
||||
},
|
||||
|
||||
async submitCert() {
|
||||
if (!this.certForm.realName.trim()) {
|
||||
uni.showToast({ title: '请输入姓名', icon: 'none' })
|
||||
|
|
@ -305,11 +312,21 @@ export default {
|
|||
}
|
||||
|
||||
.shop-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-bottom: 16rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.shop-photo {
|
||||
width: 164rpx;
|
||||
height: 164rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-right: 16rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.shop-name {
|
||||
font-size: 30rpx;
|
||||
font-weight: bold;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,10 @@
|
|||
<view class="order-summary">
|
||||
<text class="section-title">订单商品</text>
|
||||
<view v-for="shopGroup in cartStore.shopList" :key="shopGroup.shopInfo.id" class="shop-group">
|
||||
<text class="shop-group-name">{{ shopGroup.shopInfo.name }}</text>
|
||||
<view class="shop-group-header">
|
||||
<image v-if="shopGroup.shopInfo.photo" class="shop-group-photo" :src="shopGroup.shopInfo.photo" mode="aspectFill"></image>
|
||||
<text class="shop-group-name">{{ shopGroup.shopInfo.name }}</text>
|
||||
</view>
|
||||
<view class="summary-item" v-for="item in shopGroup.items" :key="item.dish.id">
|
||||
<image class="summary-photo" :src="item.dish.photo" mode="aspectFill"></image>
|
||||
<text class="summary-name">{{ item.dish.name }} × {{ item.quantity }}</text>
|
||||
|
|
@ -315,12 +318,24 @@ export default {
|
|||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.shop-group-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.shop-group-photo {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-right: 12rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.shop-group-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
padding: 8rpx 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@
|
|||
this.cartStore.setShopInfo({
|
||||
id: this.shop.id,
|
||||
name: this.shop.name,
|
||||
photo: this.shop.photo,
|
||||
packingFeeType: this.shop.packingFeeType,
|
||||
packingFeeAmount: this.shop.packingFeeAmount
|
||||
})
|
||||
|
|
@ -165,7 +166,15 @@
|
|||
this.cartStore.removeItem(dish.id)
|
||||
},
|
||||
clearCart() {
|
||||
this.cartStore.clearCart();
|
||||
this.cartStore.clearCart()
|
||||
// 清空后重新设置当前门店信息,确保可以继续加购
|
||||
this.cartStore.setShopInfo({
|
||||
id: this.shop.id,
|
||||
name: this.shop.name,
|
||||
photo: this.shop.photo,
|
||||
packingFeeType: this.shop.packingFeeType,
|
||||
packingFeeAmount: this.shop.packingFeeAmount
|
||||
})
|
||||
this.showCartPopup = false
|
||||
},
|
||||
/** 弹窗中减少指定门店的菜品 */
|
||||
|
|
|
|||
|
|
@ -469,7 +469,8 @@
|
|||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 28rpx;
|
||||
font-size: 35rpx;
|
||||
font-weight: 600;
|
||||
color: #585858;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -280,6 +280,10 @@ export default {
|
|||
this.orderId = options.id
|
||||
this.loadDetail()
|
||||
},
|
||||
onShow() {
|
||||
// 每次页面显示时刷新订单数据,确保状态同步
|
||||
if (this.orderId) this.loadDetail()
|
||||
},
|
||||
methods: {
|
||||
goBack() { uni.navigateBack() },
|
||||
/** 加载订单详情 */
|
||||
|
|
|
|||
|
|
@ -100,8 +100,11 @@ export const useCartStore = defineStore('cart', () => {
|
|||
/** 添加菜品到当前门店购物车 */
|
||||
function addItem(dish) {
|
||||
if (!currentShopId.value) return
|
||||
// 门店被清空后自动重建
|
||||
if (!shops.value[currentShopId.value]) {
|
||||
shops.value[currentShopId.value] = { shopInfo: { id: currentShopId.value }, items: [] }
|
||||
}
|
||||
const shop = shops.value[currentShopId.value]
|
||||
if (!shop) return
|
||||
const existing = shop.items.find(i => i.dish.id === dish.id)
|
||||
if (existing) {
|
||||
existing.quantity += 1
|
||||
|
|
@ -126,7 +129,6 @@ export const useCartStore = defineStore('cart', () => {
|
|||
/** 清空所有购物车 */
|
||||
function clearCart() {
|
||||
shops.value = {}
|
||||
currentShopId.value = null
|
||||
}
|
||||
|
||||
/** 获取所有门店的 foodItems(下单用) */
|
||||
|
|
|
|||
|
|
@ -369,6 +369,7 @@ public static class OrderEndpoints
|
|||
Id = fi.Id,
|
||||
ShopId = fi.ShopId,
|
||||
ShopName = fi.Shop?.Name ?? "未知门店",
|
||||
ShopPhoto = fi.Shop?.Photo,
|
||||
DishId = fi.DishId,
|
||||
DishName = fi.Dish?.Name ?? "未知菜品",
|
||||
DishPhoto = fi.Dish?.Photo,
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ public class FoodOrderItemResponse
|
|||
public int Id { get; set; }
|
||||
public int ShopId { get; set; }
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
public string? ShopPhoto { get; set; }
|
||||
public int DishId { get; set; }
|
||||
public string DishName { get; set; } = string.Empty;
|
||||
public string? DishPhoto { get; set; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user