潘超林 3 mesi fa
parent
commit
0d4916221c
1 ha cambiato i file con 85 aggiunte e 0 eliminazioni
  1. 85 0
      src/views/manage/offline.vue

+ 85 - 0
src/views/manage/offline.vue

@@ -0,0 +1,85 @@
+<template>
+  <div style="padding: 20px">
+    <h3>线下收款折扣</h3>
+    <span style="color: orange">*最低不低于96%,最高不得高于70%</span>
+    <el-form
+      ref="form"
+      :rules="rules"
+      :model="shopInfo"
+      label-width="120px"
+      style="padding: 35px"
+    >
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="线下收款折扣:" prop="offlineRatio">
+            <el-input-number
+              v-model="shopInfo.offlineRatio"
+              @change="handleChange"
+              style="width: 150px"
+              :controls="false"
+              max="96"
+              min="70"
+              step="1"
+            ></el-input-number>
+            %
+          </el-form-item>
+        </el-col>
+        <el-col :span="24" style="margin-top: 30px; text-align: center">
+          <el-form-item>
+            <el-button type="primary" @click="submitForm">保存</el-button>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+  </div>
+</template>
+  
+  <script>
+import { getStoreInfo, modifyStoreInfo } from "@/api/common/index";
+export default {
+  data() {
+    return {
+      form: {},
+      rules: {
+        offlineRatio: [
+          { required: true, message: "请输入收款折扣", trigger: "blur" },
+        ],
+      },
+      shopInfo: {},
+    };
+  },
+  mounted() {
+    this.getInfo();
+  },
+  methods: {
+    submitForm() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          modifyStoreInfo(this.shopInfo).then((res) => {
+            if (res.code == 200) {
+              this.$message.success("保存成功!");
+              this.getInfo();
+            }
+          });
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+    resetForm(formName) {
+      this.$refs[formName].resetFields();
+    },
+    getInfo() {
+      getStoreInfo().then((res) => {
+        if (res.code == 200) {
+          this.shopInfo = res.data;
+        }
+      });
+    },
+  },
+};
+</script>
+  
+  <style></style>
+