shish 8 месяцев назад
Родитель
Сommit
b5c06a5a99
1 измененных файлов с 226 добавлено и 3 удалено
  1. 226 3
      ghsApp/src/admin/shop/sk.vue

+ 226 - 3
ghsApp/src/admin/shop/sk.vue

@@ -67,10 +67,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: 80upx;" />
+            <text style="margin-left: 20upx;">公里内免费配送</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.minAmount" type="number" placeholder="0" />
+                  <text>扎,</text>
+                  <input class="input-field" v-model="item.price" type="digit" placeholder="0" />
+                  <text>元,</text>
+                  <input class="input-field" v-model="item.minDistance" type="digit" placeholder="0" />
+                  <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" />
+            <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" />
+              <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>
@@ -97,9 +148,18 @@ export default {
       zjGatheringItem:0,
       zjGatheringItemName:'',
       selectItemOk:0,
-      wxStoreId:''
+      wxStoreId:'',
+      // 花材批发和零售配置
+      flowerMaterials: [{minAmount:0,price:0,minDistance:0}],
+      // 花束配置
+      hsFreeKm: 0,
+      hsAddFee: 0,
+      hcFreeKm:0
     };
   },
+  onLoad() {
+    this.init()
+  },
   onShow() {
     let that = this
     if(that.form.customId != 0 && !this.$util.isEmpty(that.form.customId) && that.form.selectCustomOk == 1){
@@ -151,6 +211,20 @@ export default {
     goBack(){
       uni.navigateBack()
     },
+    commitSave(){
+      console.log(this.flowerMaterials)
+      return
+      modifyExt({
+        flowerMaterials: this.flowerMaterials,
+        hsFreeKm: this.hsFreeKm,
+        hsAddFee: this.hsAddFee,
+        hcFreeKm: this.hcFreeKm
+      }).then(res=>{
+        if(res.code == 1){
+          this.$msg(res.msg)
+        }
+      })
+    },
     init(){
       if(this.hasLoad){
         return false
@@ -174,11 +248,65 @@ export default {
           this.thirdSendFee = res.data.thirdSendFee
           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.hsFreeKm = res.data.hsFreeKm ? res.data.hsFreeKm : 0
+          this.hsAddFee = res.data.hsAddFee ? res.data.hsAddFee : 0
         }
       })
     },
     selectCustom(){
       this.$util.pageTo({ url: '/admin/custom/selectCustom',query: {style:2}})
+    },
+    // 花材批发和零售 - 添加
+    addFlowerMaterial() {
+      this.flowerMaterials.push({
+        minAmount: '',
+        price: '',
+        minDistance: ''
+      })
+    },
+    // 花材批发和零售 - 删除
+    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 || '保存失败')
+        }
+      })
     }
   },
 };
@@ -213,8 +341,103 @@ export default {
 .confirm-btn {
   width: calc(100% - 60upx);
   margin: 60upx 30upx 20upx;
+  display: flex;
+  gap: 20upx;
   .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: #3385FF;
+    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: #3385FF;
+      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>