Преглед изворни кода

菜品列表管理交互、退款文案

baijunde пре 3 недеља
родитељ
комит
df9b1ff973
2 измењених фајлова са 33 додато и 12 уклоњено
  1. 20 11
      pages/merchantDish/dish/list.vue
  2. 13 1
      pages/merchantDish/orders/refund-details.vue

+ 20 - 11
pages/merchantDish/dish/list.vue

@@ -120,7 +120,7 @@
 								</view>
 								</view>
 							</view>
 							</view>
 							<view class="check" v-if="batchMode">
 							<view class="check" v-if="batchMode">
-								<view :class="['dot', selectedIds.includes(item.id) ? 'on' : '']">
+								<view :class="['dot', selectionDisabled ? 'disabled' : '', selectedIds.includes(item.id) ? 'on' : '']">
 									<u-icon v-if="selectedIds.includes(item.id)" name="checkmark" color="#fff" size="20"></u-icon>
 									<u-icon v-if="selectedIds.includes(item.id)" name="checkmark" color="#fff" size="20"></u-icon>
 								</view>
 								</view>
 							</view>
 							</view>
@@ -135,8 +135,8 @@
 			<view class="primary-btn" @click="goCreate">新建菜品</view>
 			<view class="primary-btn" @click="goCreate">新建菜品</view>
 		</view>
 		</view>
 		<view class="batch-footer" v-else>
 		<view class="batch-footer" v-else>
-			<view class="all" @click="toggleAll">
-				<view :class="['dot', isAllSelected ? 'on' : '']">
+			<view :class="['all', selectionDisabled ? 'disabled' : '']" @click="toggleAll">
+				<view :class="['dot', selectionDisabled ? 'disabled' : '', isAllSelected ? 'on' : '']">
 					<u-icon v-if="isAllSelected" name="checkmark" color="#fff" size="20"></u-icon>
 					<u-icon v-if="isAllSelected" name="checkmark" color="#fff" size="20"></u-icon>
 				</view>
 				</view>
 				全选
 				全选
@@ -144,7 +144,7 @@
 			<view class="batch-btns">
 			<view class="batch-btns">
 				<template v-if="filterStatus === '' || filterStatus === 'reviewing'">
 				<template v-if="filterStatus === '' || filterStatus === 'reviewing'">
 					<view class="b-btn disabled">批量删除</view>
 					<view class="b-btn disabled">批量删除</view>
-					<view :class="['b-btn', selectedOffIds.length ? 'danger' : 'disabled']" @click="batchOff">批量下架</view>
+					<view class="b-btn disabled">批量下架</view>
 					<view class="b-btn disabled">批量上架</view>
 					<view class="b-btn disabled">批量上架</view>
 				</template>
 				</template>
 				<template v-else-if="filterStatus === 'selling' || filterStatus === 'soldout'">
 				<template v-else-if="filterStatus === 'selling' || filterStatus === 'soldout'">
@@ -260,10 +260,8 @@ export default {
 			const ids = list.map((i) => i.id);
 			const ids = list.map((i) => i.id);
 			return ids.length > 0 && ids.every((id) => this.selectedIds.includes(id));
 			return ids.length > 0 && ids.every((id) => this.selectedIds.includes(id));
 		},
 		},
-		selectedOffIds() {
-			return this.currentList
-				.filter((item) => this.selectedIds.includes(item.id) && (item.status === 'selling' || item.status === 'soldout'))
-				.map((item) => item.id);
+		selectionDisabled() {
+			return this.filterStatus === '';
 		},
 		},
 		bannerVisible() {
 		bannerVisible() {
 			return this.applyStatus !== 1;
 			return this.applyStatus !== 1;
@@ -354,7 +352,6 @@ export default {
 			this.reloadList();
 			this.reloadList();
 		},
 		},
 		openPicker(type) {
 		openPicker(type) {
-			if (this.batchMode) return;
 			if (this.pickerShow && this.pickerType === type) {
 			if (this.pickerShow && this.pickerType === type) {
 				this.closePicker();
 				this.closePicker();
 				return;
 				return;
@@ -398,12 +395,13 @@ export default {
 			this.selectedIds = [];
 			this.selectedIds = [];
 		},
 		},
 		toggleSelect(item) {
 		toggleSelect(item) {
-			if (!this.batchMode) return;
+			if (!this.batchMode || this.selectionDisabled) return;
 			const i = this.selectedIds.indexOf(item.id);
 			const i = this.selectedIds.indexOf(item.id);
 			if (i >= 0) this.selectedIds.splice(i, 1);
 			if (i >= 0) this.selectedIds.splice(i, 1);
 			else this.selectedIds.push(item.id);
 			else this.selectedIds.push(item.id);
 		},
 		},
 		toggleAll() {
 		toggleAll() {
+			if (this.selectionDisabled) return;
 			if (this.isAllSelected) this.selectedIds = [];
 			if (this.isAllSelected) this.selectedIds = [];
 			else this.selectedIds = this.currentList.map((i) => i.id);
 			else this.selectedIds = this.currentList.map((i) => i.id);
 		},
 		},
@@ -478,7 +476,7 @@ export default {
 			return true;
 			return true;
 		},
 		},
 		async batchOff() {
 		async batchOff() {
-			const ids = this.filterStatus === '' ? this.selectedOffIds : this.selectedIds;
+			const ids = this.selectedIds;
 			if (!ids.length) {
 			if (!ids.length) {
 				uni.showToast({ title: '请先选择在售菜品', icon: 'none' });
 				uni.showToast({ title: '请先选择在售菜品', icon: 'none' });
 				return;
 				return;
@@ -677,6 +675,10 @@ export default {
 			background: #449aff;
 			background: #449aff;
 			border-color: #449aff;
 			border-color: #449aff;
 		}
 		}
+		&.disabled {
+			background: #f0f0f0;
+			border-color: #ddd;
+		}
 	}
 	}
 	.thumb-wrap {
 	.thumb-wrap {
 		width: 160rpx;
 		width: 160rpx;
@@ -821,6 +823,9 @@ export default {
 		align-items: center;
 		align-items: center;
 		font-size: 26rpx;
 		font-size: 26rpx;
 		margin-right: 20rpx;
 		margin-right: 20rpx;
+		&.disabled {
+			color: #bbb;
+		}
 		.dot {
 		.dot {
 			width: 36rpx;
 			width: 36rpx;
 			height: 36rpx;
 			height: 36rpx;
@@ -835,6 +840,10 @@ export default {
 				background: #449aff;
 				background: #449aff;
 				border-color: #449aff;
 				border-color: #449aff;
 			}
 			}
+			&.disabled {
+				background: #f0f0f0;
+				border-color: #ddd;
+			}
 		}
 		}
 	}
 	}
 	.batch-btns {
 	.batch-btns {

+ 13 - 1
pages/merchantDish/orders/refund-details.vue

@@ -41,7 +41,7 @@
 						<text class="refund-label">退款金额</text>
 						<text class="refund-label">退款金额</text>
 						<text class="refund-currency">¥</text>
 						<text class="refund-currency">¥</text>
 						<text class="refund-value">{{ formatMoney(refundAmount) }}</text>
 						<text class="refund-value">{{ formatMoney(refundAmount) }}</text>
-						<text class="refund-note">不包含餐盒费</text>
+						<text class="refund-note">{{ refundFeeNote }}</text>
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
@@ -154,6 +154,18 @@ export default {
 			const orderText = String(this.product.orderStatusName || '')
 			const orderText = String(this.product.orderStatusName || '')
 			return orderText && !orderText.includes('退款') && !orderText.includes('售后') ? orderText : '待送达'
 			return orderText && !orderText.includes('退款') && !orderText.includes('售后') ? orderText : '待送达'
 		},
 		},
+		refundFeeNote() {
+			const statusText = [
+				this.product.deliveryStatusName,
+				this.product.packageOrderStatusName,
+				this.product.merchantOrderStatusName,
+				this.product.statusName,
+				this.deliveryStatusText
+			].filter(Boolean).join(' ')
+			const servedStatusTexts = ['已出餐', '已送达', '已到达', '已取餐']
+			const isServed = servedStatusTexts.some((text) => statusText.includes(text))
+			return isServed ? '不包含餐盒费' : '包含餐盒费'
+		},
 		dishDescription() {
 		dishDescription() {
 			return this.product.dishName || this.product.packageContent || this.product.dishNames || '暂无菜品信息'
 			return this.product.dishName || this.product.packageContent || this.product.dishNames || '暂无菜品信息'
 		},
 		},