shish 8 месяцев назад
Родитель
Сommit
f3887e123b
2 измененных файлов с 251 добавлено и 10 удалено
  1. 1 1
      ghsApp/src/admin/shop/sk.vue
  2. 250 9
      hdApp/src/admin/shop/sk.vue

+ 1 - 1
ghsApp/src/admin/shop/sk.vue

@@ -352,7 +352,7 @@ export default {
   bottom: 0;
   left: 0;
   right: 0;
-  width: calc(100% - 60upx);
+  width: 100%;
   padding: 20upx 30upx;
   display: flex;
   gap: 20upx;

+ 250 - 9
hdApp/src/admin/shop/sk.vue

@@ -79,10 +79,61 @@
             </radio-group>
           </tui-list-cell>
 
+          <!-- 花材批发和零售 -->
+          <view class="action-btn" style="border-top:1upx solid #2bb931;margin-top:20upx;">
+            <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:100upx;" @focus="hcFreeKm = ''" />
+            <text style="margin-left: 20upx;font-size:30upx;">公里内免费配送</text>
+          </view>
+          <view class="action-btn">
+            <button class="btn-add" @click="addFlowerMaterial">添加</button>
+          </view>
+          <view class="material-list">
+            <view v-for="(item, index) in flowerMaterials" :key="index" class="material-item">
+              <view class="material-info">
+                <view class="info-row">
+                  <text>满</text>
+                  <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" @focus="clearItemField(item, 'price')" />
+                  <text>元,</text>
+                  <input class="input-field" v-model="item.distance" type="digit" placeholder="0" @focus="clearItemField(item, 'distance')" />
+                  <text>公里内免费配送</text>
+                </view>
+              </view>
+              <button class="btn-delete" @click="deleteFlowerMaterial(index)">删除</button>
+            </view>
+          </view>
+
+          <view class="warning-text">如不符合以上情况的,按实际跑腿费计算</view>
+
+          <!-- 花束 -->
+          <view class="section-title" style="border-top:1upx solid #2bb931;">【花束】跑腿费计算方式</view>
+
+          <tui-list-cell class="line-cell" :hover="false">
+            <view class="tui-title">包配送的</view>
+            <input class="input-field" v-model="hsFreeKm" type="number" placeholder="0" @focus="hsFreeKm = ''" />
+            <view>公里内免费配送</view>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false">
+            <view class="tui-title">{{hsFreeKm}}公里以上</view>
+            <view class="input-row">
+              <text>每公里加收</text>
+              <input class="input-field" v-model="hsAddFee" type="digit" placeholder="0" @focus="hsAddFee = ''" />
+              <text>元</text>
+            </view>
+          </tui-list-cell>
+
+          <view class="warning-text">没有包配送的花束,按实际跑腿费计算</view>
 
         </view>
+
         <view class="confirm-btn">
-          <button class="admin-button-com big blue" @click="goBack">返回</button>
+          <button class="admin-button-com big default" @click="goBack">返回</button>
+          <button class="admin-button-com big blue" @click="commitSave">提交</button>
         </view>
     </view>
   </view>
@@ -111,9 +162,18 @@ export default {
       thirdSend:0,
       thirdSendFee:0,
       wxStoreId:'',
-      needWork:0
+      needWork:0,
+      // 花材批发和零售配置
+      flowerMaterials: [{num:0,price:0,distance:0}],
+      // 花束配置
+      hsFreeKm: 0,
+      hsAddFee: 0,
+      hcFreeKm:0
     };
   },
+  onLoad() {
+    this.init()
+  },
   onShow() {
       let that = this
       if(that.form.customId != 0 && !that.$util.isEmpty(that.form.customId) && that.form.selectCustomOk==1){
@@ -174,16 +234,23 @@ export default {
       })
       getMyExtInfo().then(res=>{
         if(res.code == 1){
-          this.losingItem = res.data.losingItem
-          this.zjGatheringItem = res.data.zjGatheringItem
-          this.losingItemName = res.data.losingItemName
-          this.zjGatheringItemName = res.data.zjGatheringItemName
+          this.losingItem = res.data.losingItem?res.data.losingItem:0
+          this.losingItemName = res.data.losingItemName?res.data.losingItemName:''
+          this.zjGatheringItem = res.data.zjGatheringItem?res.data.zjGatheringItem:0
+          this.zjGatheringItemName = res.data.zjGatheringItemName?res.data.zjGatheringItemName:''
           this.orderFlow = res.data.orderFlow
           this.thirdSend = res.data.thirdSend
           this.thirdSendFee = res.data.thirdSendFee
           this.needWork = res.data.needWork
           let main = res.data.main?res.data.main:[]
           this.wxStoreId = main.wxStoreId
+          // 加载花材批发和零售配置
+          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
         }
       })
     },
@@ -198,6 +265,75 @@ export default {
       }else{
         //先操作
       }
+    },
+    commitSave(){
+      let that = this
+      modifyExt({
+        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)
+        }
+      })
+    },
+    // 花材批发和零售 - 添加
+    addFlowerMaterial() {
+      this.flowerMaterials.push({
+        num: '',
+        price: '',
+        distance: ''
+      })
+    },
+    // 花材批发和零售 - 删除
+    deleteFlowerMaterial(index) {
+      uni.showModal({
+        title: '确认删除',
+        content: '确认删除该配置吗?',
+        success: (res) => {
+          if (res.confirm) {
+            this.flowerMaterials.splice(index, 1)
+            this.saveFlowerMaterials()
+          }
+        }
+      })
+    },
+    // 保存花材配置
+    saveFlowerMaterials() {
+      if (this.flowerMaterials.length === 0) {
+        return
+      }
+      modifyExt({
+        flowerMaterials: this.flowerMaterials
+      }).then(res => {
+        if (res.code === 1) {
+          this.$msg('花材配置保存成功')
+        } else {
+          this.$msg(res.msg || '保存失败')
+        }
+      })
+    },
+    // 保存花束配置
+    saveBundleConfig() {
+      modifyExt({
+        hsFreeKm: this.hsFreeKm,
+        hsAddFee: this.hsAddFee
+      }).then(res => {
+        if (res.code === 1) {
+          this.$msg('花束配置保存成功')
+        } else {
+          this.$msg(res.msg || '保存失败')
+        }
+      })
+    },
+    // 清空循环中的item字段
+    clearItemField(item, fieldName) {
+      this.$set(item, fieldName, '')
     }
   },
 };
@@ -207,6 +343,7 @@ export default {
 .app-content {
   min-height: calc(100vh - 20upx);
   padding-top: 20upx;
+  padding-bottom: 140upx;
 }
 .prompt-text {
   color: $fontColor3;
@@ -230,10 +367,114 @@ export default {
 }
 // 按钮
 .confirm-btn {
-  width: calc(100% - 60upx);
-  margin: 60upx 30upx 20upx;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  width: 100%;
+  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 {
-    width: 100%;
+    flex: 1;
   }
 }
+
+// 新增样式
+.section-title {
+  padding: 20upx 30upx;
+  font-size: 28upx;
+  font-weight: bold;
+  color: #333;
+  margin-top: 20upx;
+  background-color: #f5f5f5;
+}
+
+.action-btn {
+  padding: 20upx 30upx;
+  .btn-add {
+    background-color: #09C567;
+    color: white;
+    padding: 10upx 20upx;
+    border-radius: 4upx;
+    border: none;
+    font-size: 20upx;
+  }
+}
+
+.material-list {
+  padding: 20upx 30upx;
+  
+  .material-item {
+    background-color: #f9f9f9;
+    padding: 20upx;
+    margin-bottom: 15upx;
+    border-radius: 4upx;
+    border: 1upx solid #e0e0e0;
+    
+    .material-info {
+      margin-bottom: 15upx;
+      
+      .info-row {
+        display: flex;
+        align-items: center;
+        flex-wrap: wrap;
+        gap: 8upx;
+        
+        .input-field {
+          width: 80upx;
+          height: 36upx;
+          padding: 0 8upx;
+          border: 1upx solid #ddd;
+          border-radius: 4upx;
+          font-size: 24upx;
+          text-align: center;
+          line-height: 36upx;
+        }
+      }
+    }
+    
+    .btn-delete {
+      background-color:#09C567;
+      color: white;
+      padding: 8upx 16upx;
+      border-radius: 4upx;
+      border: none;
+      font-size: 22upx;
+      width: 100%;
+    }
+  }
+}
+
+.warning-text {
+  color: #FF0000;
+  font-size: 30upx;
+  padding: 0 30upx 15upx;
+  font-weight: bold;
+}
+
+.input-row {
+  display: flex;
+  align-items: center;
+  gap: 8upx;
+}
+
+.input-field {
+  width: 100upx;
+  height: 44upx;
+  padding: 0 10upx;
+  border: 1upx solid #ddd;
+  border-radius: 4upx;
+  font-size: 24upx;
+  text-align: center;
+  line-height: 44upx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
 </style>