فهرست منبع

1. 会员等级折扣交互变更 2. 店铺数据展示补充昨日的

shizhongqi 1 ماه پیش
والد
کامیت
b8629d47e5
2فایلهای تغییر یافته به همراه115 افزوده شده و 12 حذف شده
  1. 5 4
      hdApp/src/admin/home/components/mall-home-panel.vue
  2. 110 8
      hdApp/src/admin/member/level.vue

+ 5 - 4
hdApp/src/admin/home/components/mall-home-panel.vue

@@ -45,7 +45,7 @@
               </view>
               <view class="stat-divider"></view>
               <view class="stat-item" @click.stop="pageTo({url:'/admin/custom/visit'})">
-                <view class="stat-label">客(人)</view>
+                <view class="stat-label">访客(人)</view>
                 <view class="stat-value">{{ $util.numberFormat(todayStats.visit) || 0 }}</view>
                 <view class="stat-yesterday">昨日 {{ $util.numberFormat(todayStats.yesterdayVisit) || 0 }}</view>
               </view>
@@ -301,13 +301,14 @@ export default {
     ...mapGetters({ loginInfo: "getLoginInfo", myShopInfo: "getMyShopInfo" }),
     todayStats() {
       const todayData = this.data && this.data.todayData ? this.data.todayData : {}
+      const yesterdayData = this.data && this.data.yesterdayData ? this.data.yesterdayData : {}
       return {
         income: todayData.income || 0,
         order: todayData.order || 0,
         visit: todayData.visit || todayData.custom || 0,
-        yesterdayIncome: todayData.yesterdayIncome || todayData.lastIncome || 0,
-        yesterdayOrder: todayData.yesterdayOrder || todayData.lastOrder || 0,
-        yesterdayVisit: todayData.yesterdayVisit || todayData.lastVisit || 0
+        yesterdayIncome: yesterdayData.income ||  0,
+        yesterdayOrder: yesterdayData.order || 0,
+        yesterdayVisit: yesterdayData.visit || 0
       }
     },
     quickMenuList() {

+ 110 - 8
hdApp/src/admin/member/level.vue

@@ -29,7 +29,25 @@
 						<input v-model="item.amount" type="digit" class="field-inp" placeholder="金额" @focus="() => clearDiscount(index)" />
 					</view>
 					<view class="field-inline col-discount">
-						<input v-model="item.discount" type="digit" class="field-inp short" placeholder="如9.5" />
+						<view
+							v-if="!item.discountEnabled"
+							class="discount-toggle off"
+							@click="enableDiscount(index)"
+						>
+							<text class="discount-off-text">关闭</text>
+						</view>
+						<view v-else class="discount-toggle on">
+							<input
+								v-model="item.discount"
+								type="digit"
+								class="discount-inp"
+								placeholder="如9.5"
+							/>
+							<text class="discount-unit">折</text>
+							<view class="discount-close" @click="disableDiscount(index)">
+								<text class="discount-close-icon">×</text>
+							</view>
+						</view>
 					</view>
 				</view>
 				<view class="card-section">
@@ -40,7 +58,7 @@
 						maxlength="50"
 						placeholder="请输入生日权益内容"
 					/>
-					<view class="char-count">{{ (item.birthdayBenefit || '').length }}/50</view>
+					<view class="char-count">{{ (item.birthdayBenefit || '').length }}/10</view>
 				</view>
 				<view class="card-section">
 					<view class="section-label">会员权益说明</view>
@@ -86,6 +104,7 @@ export default {
 						if (item.discount === undefined || item.discount === null || item.discount === '') {
 							item.discount = 10;
 						}
+						this.$set(item, 'discountEnabled', Number(item.discount) < 10);
 						if (!item.birthdayBenefit) {
 							item.birthdayBenefit = '';
 						}
@@ -103,6 +122,26 @@ export default {
 		clearDiscount(index) {
 			this.$set(this.map[index], 'amount', '');
 		},
+		enableDiscount(index) {
+			this.$set(this.map[index], 'discountEnabled', true);
+			if (!this.map[index].discount || Number(this.map[index].discount) >= 10) {
+				this.$set(this.map[index], 'discount', '');
+			}
+		},
+		disableDiscount(index) {
+			this.$set(this.map[index], 'discountEnabled', false);
+			this.$set(this.map[index], 'discount', 10);
+		},
+		getSubmitData() {
+			return this.map.map(item => {
+				const row = Object.assign({}, item);
+				if (!row.discountEnabled) {
+					row.discount = 10;
+				}
+				delete row.discountEnabled;
+				return row;
+			});
+		},
 		goBack() {
 			uni.navigateBack();
 		},
@@ -112,7 +151,7 @@ export default {
 			}
 			this.$util.confirmModal({ content: '确认提交?' }, () => {
 				modifyLevel({
-					data: this.map,
+					data: this.getSubmitData(),
 					reduceDay: this.reduceDay
 				}).then(res => {
 					if (res.code === 1) {
@@ -136,6 +175,17 @@ export default {
 				this.$msg('请输入有效的消费金额');
 				return false;
 			}
+			const hasInvalidDiscount = this.map.some(item => {
+				if (!item.discountEnabled) {
+					return false;
+				}
+				const discount = parseFloat(item.discount);
+				return item.discount === '' || item.discount === undefined || item.discount === null || isNaN(discount) || discount <= 0 || discount >= 10;
+			});
+			if (hasInvalidDiscount) {
+				this.$msg('开启折扣后请输入小于10的有效折扣');
+				return false;
+			}
 			const hasLongBenefit = this.map.some(item => (item.birthdayBenefit || '').length > 50);
 			if (hasLongBenefit) {
 				this.$msg('生日权益不超过50字');
@@ -245,7 +295,7 @@ export default {
 	text-align: center;
 }
 .col-level {
-	width: 170upx;
+	width: 160upx;
 	flex-shrink: 0;
 }
 .col-amount {
@@ -253,7 +303,7 @@ export default {
 	margin-left: 6upx;
 }
 .col-discount {
-	width: 114upx;
+	width: 180upx;
 	flex-shrink: 0;
 	margin-left: 18upx;
 }
@@ -263,8 +313,8 @@ export default {
 	justify-content: center;
 }
 .member-badge-icon {
-	width: 92upx;
-	height: 92upx;
+	width: 82upx;
+	height: 82upx;
 }
 .level-name {
 	display: flex;
@@ -299,8 +349,60 @@ export default {
 	box-sizing: border-box;
 	background: #fff;
 }
-.field-inp.short {
+.discount-toggle {
 	width: 100%;
+	height: 54upx;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	border-radius: 27upx;
+	box-sizing: border-box;
+	padding: 0 6upx 0 12upx;
+}
+.discount-toggle.off {
+	justify-content: center;
+	padding: 0;
+	background: #f1f3f1;
+	border: 1upx solid #e3e7e3;
+}
+.discount-off-text {
+	font-size: 24upx;
+	color: #9ca3a0;
+}
+.discount-toggle.on {
+	background: #fff;
+	border: 1upx solid #41b94e;
+}
+.discount-inp {
+	flex: 1;
+	min-width: 0;
+	height: 100%;
+	line-height: 54upx;
+	font-size: 26upx;
+	font-weight: 600;
+	color: #368753;
+	text-align: center;
+}
+.discount-unit {
+	flex-shrink: 0;
+	font-size: 22upx;
+	color: #368753;
+	margin-left: 2upx;
+}
+.discount-close {
+	flex-shrink: 0;
+	width: 44upx;
+	height: 44upx;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	margin-left: 2upx;
+}
+.discount-close-icon {
+	font-size: 44upx;
+	color: #b7c0b7;
+	line-height: 1;
+	transform: translateY(-4upx);
 }
 .card-section {
 	position: relative;