ソースを参照

更多设置优化

shish 8 ヶ月 前
コミット
15fdd81832
1 ファイル変更34 行追加16 行削除
  1. 34 16
      ghsApp/src/admin/shop/sk.vue

+ 34 - 16
ghsApp/src/admin/shop/sk.vue

@@ -72,8 +72,8 @@
             <text style="font-size: 30upx;font-weight: bold;">【花材】跑腿费计算方式</text>
           </view>
           <view style="display: flex; align-items: center; margin-left:30upx;">
-            <input class="input-field" type="number" v-model="hcFreeKm" placeholder="0" style="width: 80upx;" />
-            <text style="margin-left: 20upx;">公里内免费配送</text>
+            <input class="input-field" type="number" v-model="hcFreeKm" placeholder="0" style="width:100upx;" @focus="hcFreeKm = ''" />
+            <text style="margin-left: 20upx;font-size:30upx;">公里内免费配送</text>
           </view>
           <view class="action-btn">
             <button class="btn-add" @click="addFlowerMaterial">添加</button>
@@ -83,11 +83,11 @@
               <view class="material-info">
                 <view class="info-row">
                   <text>满</text>
-                  <input class="input-field" v-model="item.minAmount" type="number" placeholder="0" />
+                  <input class="input-field" v-model="item.num" type="number" placeholder="0" @focus="clearItemField(item, 'num')" />
                   <text>扎,</text>
-                  <input class="input-field" v-model="item.price" type="digit" placeholder="0" />
+                  <input class="input-field" v-model="item.price" type="digit" placeholder="0" @focus="clearItemField(item, 'price')" />
                   <text>元,</text>
-                  <input class="input-field" v-model="item.minDistance" type="digit" placeholder="0" />
+                  <input class="input-field" v-model="item.distance" type="digit" placeholder="0" @focus="clearItemField(item, 'distance')" />
                   <text>公里内免费配送</text>
                 </view>
               </view>
@@ -102,7 +102,7 @@
 
           <tui-list-cell class="line-cell" :hover="false">
             <view class="tui-title">包配送的</view>
-            <input class="input-field" v-model="hsFreeKm" type="number" placeholder="0" />
+            <input class="input-field" v-model="hsFreeKm" type="number" placeholder="0" @focus="hsFreeKm = ''" />
             <view>公里内免费配送</view>
           </tui-list-cell>
 
@@ -110,7 +110,7 @@
             <view class="tui-title">{{hsFreeKm}}公里以上</view>
             <view class="input-row">
               <text>每公里加收</text>
-              <input class="input-field" v-model="hsAddFee" type="digit" placeholder="0" />
+              <input class="input-field" v-model="hsAddFee" type="digit" placeholder="0" @focus="hsAddFee = ''" />
               <text>元</text>
             </view>
           </tui-list-cell>
@@ -150,7 +150,7 @@ export default {
       selectItemOk:0,
       wxStoreId:'',
       // 花材批发和零售配置
-      flowerMaterials: [{minAmount:0,price:0,minDistance:0}],
+      flowerMaterials: [{num:0,price:0,distance:0}],
       // 花束配置
       hsFreeKm: 0,
       hsAddFee: 0,
@@ -212,16 +212,18 @@ export default {
       uni.navigateBack()
     },
     commitSave(){
-      console.log(this.flowerMaterials)
-      return
+      let that = this
       modifyExt({
-        flowerMaterials: this.flowerMaterials,
+        hcMap: JSON.stringify(this.flowerMaterials),
         hsFreeKm: this.hsFreeKm,
         hsAddFee: this.hsAddFee,
         hcFreeKm: this.hcFreeKm
       }).then(res=>{
         if(res.code == 1){
           this.$msg(res.msg)
+          setTimeout(() => {
+            that.goBack()
+          }, 1200)
         }
       })
     },
@@ -249,8 +251,10 @@ export default {
           let main = res.data.main?res.data.main:[]
           this.wxStoreId = main.wxStoreId
           // 加载花材批发和零售配置
-          this.flowerMaterials = res.data.flowerMaterials ? res.data.flowerMaterials : [{minAmount:0,price:0,minDistance:0}]
-          // 加载花束配置
+          this.flowerMaterials = res.data.hcMap ? JSON.parse(res.data.hcMap) : [{num:0,price:0,distance:0}]
+          console.log(this.flowerMaterials)
+          console.log(typeof this.flowerMaterials)
+          this.hcFreeKm = res.data.hcFreeKm ? res.data.hcFreeKm : 0
           this.hsFreeKm = res.data.hsFreeKm ? res.data.hsFreeKm : 0
           this.hsAddFee = res.data.hsAddFee ? res.data.hsAddFee : 0
         }
@@ -262,9 +266,9 @@ export default {
     // 花材批发和零售 - 添加
     addFlowerMaterial() {
       this.flowerMaterials.push({
-        minAmount: '',
+        num: '',
         price: '',
-        minDistance: ''
+        distance: ''
       })
     },
     // 花材批发和零售 - 删除
@@ -307,6 +311,10 @@ export default {
           this.$msg(res.msg || '保存失败')
         }
       })
+    },
+    // 清空循环中的item字段
+    clearItemField(item, fieldName) {
+      this.$set(item, fieldName, '')
     }
   },
 };
@@ -316,6 +324,7 @@ export default {
 .app-content {
   min-height: calc(100vh - 20upx);
   padding-top: 20upx;
+  padding-bottom: 140upx;
 }
 .prompt-text {
   color: $fontColor3;
@@ -339,10 +348,19 @@ export default {
 }
 // 按钮
 .confirm-btn {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
   width: calc(100% - 60upx);
-  margin: 60upx 30upx 20upx;
+  padding: 20upx 30upx;
   display: flex;
   gap: 20upx;
+  background-color: #fff;
+  box-shadow: 0 -2upx 10upx rgba(0, 0, 0, 0.1);
+  z-index: 100;
+  /* 兼容 iOS safe area */
+  padding-bottom: max(20upx, env(safe-area-inset-bottom));
   .admin-button-com {
     flex: 1;
   }