shish il y a 6 mois
Parent
commit
8371287e49
1 fichiers modifiés avec 134 ajouts et 24 suppressions
  1. 134 24
      ghsApp/src/admin/billing/affirm.vue

+ 134 - 24
ghsApp/src/admin/billing/affirm.vue

@@ -381,7 +381,7 @@
                 <view class="tui-title">
                   <text>合计金额</text>
                 </view>
-                <text style="color: #3385ff; width: 180upx">¥{{ parseFloat(finalPrice) }}</text>
+                <text style="color: #3385ff; width: 170upx">¥{{ parseFloat(finalPrice) }}</text>
                 <button @tap="showDiscount()" class="admin-button-com middle default" style="margin-left: 0upx;width:140upx;">打折</button>
                 <text v-if="discountValue > 0 && discountValue < 1">{{ Number(discountValue) * 10 }}折</text>
               </tui-list-cell>
@@ -499,24 +499,38 @@
         </view>
       </uni-popup>
       <uni-popup ref="discountRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
-        <view style="display: flex; padding: 20upx; min-height: 25vh; justify-content: space-between; align-items: center; flex-wrap: wrap">
-          <text
-            v-for="(item, index) in discountList"
-            :key="index"
-            @click="setDiscount(item.value)"
-            style="
-              margin-left: 25upx;
-              border: 1upx solid #999999;
-              width: 100upx;
-              height: 100upx;
-              border-radius: 20upx;
-              justify-content: center;
-              align-items: center;
-              display: flex;
-            "
-          >
-            {{ item.name }}
-          </text>
+        <view class="discount-popup-container">
+          <!-- 标题 -->
+          <view class="discount-popup-title">选择打折</view>
+          
+          <!-- 快捷折扣按钮 -->
+          <view class="discount-quick-buttons">
+            <button
+              v-for="(item, index) in discountList"
+              :key="index"
+              @click="setDiscount(item.value)"
+              :class="['discount-quick-btn', { active: discountValue === item.value }]"
+            >
+              {{ item.name }}
+            </button>
+          </view>
+          
+          <!-- 分割线 -->
+          <view class="discount-divider"></view>
+          
+          <!-- 自定义输入 -->
+          <view class="discount-custom-section">
+            <view class="discount-custom-label">自定义折扣</view>
+            <view class="discount-custom-input-group">
+              <input v-model="customDiscount" type="digit" placeholder="输入折扣(输0.85表示85折)" class="discount-custom-input" />
+              <button class="admin-button-com middle blue" @click="setCustomDiscount" > 应用 </button>
+            </view>
+          </view>
+          
+          <!-- 操作按钮 -->
+          <view class="discount-action-buttons">
+            <button class="admin-button-com middle default" @click="cancelDiscount" > 取消 </button>
+          </view>
         </view>
       </uni-popup>
 
@@ -617,9 +631,10 @@ export default {
         { name: '7折', value: 0.7 },
         { name: '8折', value: 0.8 },
         { name: '9折', value: 0.9 },
-        { name: '不打', value: 1 }
+        { name: '不打', value: 1 }
       ],
       discountValue: 0,
+      customDiscount: '',
       staffList: [],
       wlList: [],
       payWayList: [
@@ -916,6 +931,19 @@ export default {
       let price = Number(this.finalPrice) * Number(num);
       price = parseFloat(price.toFixed(2));
       this.modifyPrice = price;
+      this.customDiscount = '';
+      this.$refs.discountRef.close();
+    },
+    setCustomDiscount() {
+      const value = parseFloat(this.customDiscount);
+      if (isNaN(value) || value < 0 || value > 1) {
+        this.$msg('请输入0到1之间的有效折扣值');
+        return;
+      }
+      this.setDiscount(value);
+    },
+    cancelDiscount() {
+      this.customDiscount = '';
       this.$refs.discountRef.close();
     },
     beginScan() {
@@ -1548,10 +1576,6 @@ export default {
   margin-top: 10upx;
 }
 
-.delivery-quotes-scroll {
-  /* 滚动已移除 */
-}
-
 .delivery-quotes-grid {
   display: flex;
   flex-wrap: wrap;
@@ -1682,6 +1706,92 @@ export default {
        border: 1upx solid #3385ff !important;
     }
 }
+
+.discount-quick-btn {
+    width: 120upx;
+    height: 120upx;
+    border-radius: 12upx;
+    border: 2upx solid #ddd;
+    background-color: #f9f9f9;
+    font-size: 32upx;
+    font-weight: 500;
+    color: #333;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    transition: all 0.2s ease;
+    padding: 0;
+    line-height: 1;
+    white-space: nowrap;
+    
+    &.active {
+        border-color: #3385ff;
+        background-color: #3385ff;
+        color: #fff;
+    }
+}
+
+.discount-popup-container {
+    width: 600upx;
+    padding: 30upx;
+    box-sizing: border-box;
+}
+
+.discount-popup-title {
+    font-size: 32upx;
+    font-weight: bold;
+    margin-bottom: 30upx;
+    text-align: center;
+    color: #333;
+}
+
+.discount-quick-buttons {
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: center;
+    gap: 15upx;
+    margin-bottom: 30upx;
+}
+
+.discount-divider {
+    height: 1upx;
+    background-color: #f0f0f0;
+    margin: 20upx 0;
+}
+
+.discount-custom-section {
+    margin-bottom: 30upx;
+}
+
+.discount-custom-label {
+    font-size: 28upx;
+    font-weight: 500;
+    margin-bottom: 15upx;
+    color: #333;
+}
+
+.discount-custom-input-group {
+    display: flex;
+    gap: 10upx;
+    align-items: center;
+}
+
+.discount-custom-input {
+    flex: 1;
+    border: 1upx solid #ddd;
+    border-radius: 8upx;
+    padding: 12upx;
+    font-size: 28upx;
+    box-sizing: border-box;
+    min-height: 70upx;
+    line-height: 45upx;
+}
+
+.discount-action-buttons {
+    display: flex;
+    gap: 15upx;
+    justify-content: center;
+}
 .strike-through {
     text-decoration: line-through;
 }