Funny 3 年 前
コミット
6f499a0bab

+ 2 - 1
src/common/sider.vue

@@ -2,7 +2,7 @@
     <el-aside style="width: 254px;">
       <div class="sidebar">
         <div class="side-logo">
-          <img src="/static/image/logo.png" class="logo" />
+          <img @click="$router.push({path:'/'})" src="/static/image/logo.png" class="logo" />
         </div>
         <el-menu class="sidebar-el-menu" :default-active="$route.path" :collapse="collapse" background-color="#00152A"
           text-color="#bfcbd9" active-text-color="#20a0ff" router>
@@ -133,6 +133,7 @@
     background-color: #fff;
     font-size: 0;
     padding-left: 32px;
+    cursor: pointer;
   }
   .logo {
     width: 204px;

+ 31 - 26
src/components/accountCompoents/wallet.vue

@@ -12,15 +12,18 @@
       <div class="recharge_title">充值金额</div>
       <div class="recharge_list">
         <div @click="chooseMoney(v,i)" :class="curIdx === i ? 'item item_ac' : 'item'" v-for="(v,i) in moneyList" :key="i">{{v.value}}元</div>
-        <div @click="open()" :class="curIdx === -1 ? 'item item_ac' : 'item'">其他金额{{curIdx === -1 && money ? `(${money})` : ''}}</div>
+        <el-input type='num' @focus="open" v-model="value" clearable :class="curIdx === -1 ? 'item item_ac' : 'item'" placeholder="其他金额" />
       </div>
       <div class="recharge_title">支付方式</div>
       <div class="recharge_list">
         <div @click="paymentType = 1" :class="paymentType === 1 ? 'item item_ac' : 'item'"><img src="../../../static/image/alipay.png" alt="" srcset=""> 支付宝支付</div>
         <div @click="paymentType = 2" :class="paymentType === 2 ? 'item item_ac' : 'item'"><img src="../../../static/image/we-chat.png" alt="" srcset="">微信支付</div>
       </div>
+      <div>
+        <el-checkbox v-model="checked">我已阅读并同意 <span @click="getExplain" class="agreement">《充值协议》</span> </el-checkbox>
+      </div>
       <el-button @click="recharge" class="recharge_color">去充值</el-button>
-      <div class="agreement">充值即同意 <span @click="getExplain">《充值协议》</span> </div>
+      <!-- <div class="agreement">充值即同意 <span @click="getExplain">《充值协议》</span> </div> -->
     </el-col>
     <!-- 支付二维码 -->
     <qr-code v-if="showCode" @paySuccess="paySuccess" @refreshCode="recharge" @closeCode="showCode = false" ref="code" :payAmount="payAmount" :link="link" :paymentType="paymentType" :orderSn="orderSn"></qr-code>
@@ -64,6 +67,8 @@ export default {
       payAmount: 0,
       centerDialogVisible: false,
       text: "",
+      value: "",
+      checked: false,
     };
   },
   components: {
@@ -119,47 +124,43 @@ export default {
       });
     },
     chooseMoney(v, i) {
+      this.value = "";
       this.curIdx = i;
       this.money = v.value;
       this.id = v.id;
     },
     open() {
       this.curIdx = -1;
-      this.$prompt("请输入充值金额(正整数)", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        inputPattern: /^[1-9]\d*$/,
-        inputErrorMessage: "输入金额格式不正确",
-      })
-        .then(({ value }) => {
-          this.money = Number(value);
-        })
-        .catch(() => {
-          this.$message({
-            type: "info",
-            message: "取消输入",
-          });
-        });
     },
     recharge() {
+      let params = {
+        money: this.value ? this.value : this.money,
+        paymentType: this.paymentType,
+        createType: 1,
+        id: this.value ? "" : this.id,
+      };
       if (!this.paymentType) {
         return this.$message({
           type: "info",
           message: "请先选择支付方式再充值!",
         });
       }
-      if (!this.money) {
+      let reg = new RegExp(
+        "^[1-9]{1}[0-9]*$|^0{1}.{1}[0-9]+$|^[1-9]{1}[0-9]*.{1}[0-9]+$"
+      );
+      if (!reg.test(Number(params.money))) {
         return this.$message({
           type: "info",
-          message: "请先输入充值金额再充值!",
+          message: "请先输入正确充值金额再充值!",
         });
       }
-      let params = {
-        money: this.money,
-        paymentType: this.paymentType,
-        createType: 1,
-        id: this.id,
-      };
+      if (!this.checked) {
+        return this.$message({
+          type: "info",
+          message: "请先勾选同意后再充值!",
+        });
+      }
+      
       recharge(params).then((res) => {
         if (res.code === 200) {
           this.link = res.data.data;
@@ -253,13 +254,17 @@ export default {
 .agreement {
   font-size: 12px;
   font-weight: 400;
-  color: #808080;
+  color: #fc7200;
   margin-top: 10px;
   span {
     color: #3662a1;
     cursor: pointer;
   }
 }
+.recharge_list /deep/ .el-input__inner {
+  border: none !important;
+  text-align: center;
+}
 .recharge_list {
   width: 100%;
   display: flex;

+ 15 - 3
src/components/orderComponents/orderAMap.vue

@@ -2,7 +2,7 @@
   <el-dialog width="80%" destroy-on-close :visible.sync="dialogTableVisible">
     <el-form v-if="showSearch" ref="ruleForm" class="demo-form-inline" :inline="true">
       <el-form-item class="search-box">
-        <el-input v-model="searchKey" type="search" id="search" style="width: 219px" placeholder="请输入关键字进行搜索" />
+        <el-input @keydown.enter.native="seachEnterFun" v-model="searchKey" type="search" id="search" style="width: 219px" placeholder="请输入关键字进行搜索" />
       </el-form-item>
       <el-form-item>
         <el-button type="primary" class="map-btn" @click="searchMap">搜索</el-button>
@@ -42,9 +42,9 @@ export default {
       dialogTableVisible: false,
       order: {},
       markers: [],
-      defaultCity: "苏州",
+      defaultCity: "北京",
       zoom: 18,
-      center: [121.329402, 31.228667],
+      center: [116.39747132275389, 39.908857325556404],
       promptList: [],
       address: "",
       addressDetail: {},
@@ -56,6 +56,12 @@ export default {
   },
   created() {},
   methods: {
+    seachEnterFun(e) {
+      var keyCode = window.event ? e.keyCode : e.which;
+      if (keyCode == 13) {
+        this.searchMap();
+      }
+    },
     getGeoCode(v) {
       this.showAddressList = false;
       let address = v.district + v.address + v.name;
@@ -84,6 +90,12 @@ export default {
       });
     },
     searchMap() {
+      if (!this.searchKey.trim()) {
+        return this.$message({
+          type: "error",
+          message: "请先输入关键字后再搜索!",
+        });
+      }
       getInputPrompt({ keywords: this.searchKey }).then((res) => {
         if (res.code === 200) {
           if (res.data.length) {

+ 51 - 2
src/components/shopCompoents/shopAdd.vue

@@ -48,7 +48,7 @@
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button class="btn" @click="save">保存</el-button>
+        <el-button :loading="loading" class="btn" @click="save">保存</el-button>
       </div>
     </el-dialog>
     <!-- 通过地图选择地理位置 -->
@@ -88,6 +88,7 @@ export default {
       },
       deliveries: [],
       revieweds: [],
+      loading: false,
     };
   },
   components: {
@@ -110,7 +111,14 @@ export default {
         });
       } else {
         this.title = "新增门店";
-        this.form = {};
+        this.form = {
+          address: "",
+          contactName: "",
+          mobile: "",
+          name: "",
+          street: "",
+          categoryId: "",
+        };
       }
       this.showVisible = true;
     },
@@ -127,6 +135,43 @@ export default {
       this.form.lat = lat;
     },
     save() {
+      if (!this.form.name.trim()) {
+        return this.$message({
+          type: "error",
+          message: "请输入门店名称!",
+        });
+      }
+      if (!String(this.form.categoryId).trim()) {
+        return this.$message({
+          type: "error",
+          message: "请选择主营类别!",
+        });
+      }
+      if (!this.form.address.trim()) {
+        return this.$message({
+          type: "error",
+          message: "请选择详细地址!",
+        });
+      }
+      if (!this.form.street.trim()) {
+        return this.$message({
+          type: "error",
+          message: "请输入门牌号!",
+        });
+      }
+      if (!this.form.contactName.trim()) {
+        return this.$message({
+          type: "error",
+          message: "请输入联系人姓名!",
+        });
+      }
+      if (!this.form.mobile.trim()) {
+        return this.$message({
+          type: "error",
+          message: "请输入联系人电话!",
+        });
+      }
+      this.loading = true;
       if (this.form.id) {
         shopEdit(this.form).then((res) => {
           if (res.code === 200) {
@@ -141,6 +186,8 @@ export default {
               message: res.msg,
             });
           }
+          this.showVisible = false;
+          this.loading = false;
         });
       } else {
         shopAdd(this.form).then((res) => {
@@ -156,6 +203,8 @@ export default {
               message: res.msg,
             });
           }
+          this.showVisible = false;
+          this.loading = false;
         });
       }
     },

+ 91 - 81
src/components/shopInfo.vue

@@ -3,8 +3,7 @@
     <el-row class="order_tab">
       <el-col :span="24">
         <div class="tab_list">
-          <div class="tab_item" @click="changeTabs(i)" :class="{'tab_item_ac':tab_ac==i?true:false}"
-               v-for="(item,i) in tab_list" :key="i">
+          <div class="tab_item" @click="changeTabs(i)" :class="{'tab_item_ac':tab_ac==i?true:false}" v-for="(item,i) in tab_list" :key="i">
             <span>{{item.name}}</span>
             <div class="tab_line"></div>
           </div>
@@ -21,106 +20,117 @@
 </template>
 
 <script>
-  import shopList from './shopCompoents/shopList';
-  import storeList from './shopCompoents/bindTakeOut.vue';
-  import deliveryList from './shopCompoents/bindDelivery.vue';
-  import printerList from './shopCompoents/bindPrinter.vue';
-  export default {
-    name: 'HelloWorld',
-    components: {
-      shopList,
-      storeList,
-      deliveryList,
-      printerList
-    },
+import shopList from "./shopCompoents/shopList";
+import storeList from "./shopCompoents/bindTakeOut.vue";
+import deliveryList from "./shopCompoents/bindDelivery.vue";
+import printerList from "./shopCompoents/bindPrinter.vue";
+import bus from "../common/bus.js";
+export default {
+  name: "HelloWorld",
+  components: {
+    shopList,
+    storeList,
+    deliveryList,
+    printerList,
+  },
 
-    data() {
-      return {
-        activeName: 'shopList',
-        tab_list: [
-          {name: '门店列表', index: 0},
-          {name: '绑定外卖平台', index: 1},
-          {name: '绑定配送平台', index: 2},
-          {name: '绑定打印机', index: 3}
-        ],
-        tab_ac: 0,
-      }
-    },
-    methods: {
-      changeTabs(i) {
-        this.tab_ac = i;
-        switch(i) {
-          case 0:
-            this.activeName = 'shopList';
+  data() {
+    return {
+      activeName: "shopList",
+      tab_list: [
+        { name: "门店列表", index: 0 },
+        { name: "绑定外卖平台", index: 1 },
+        { name: "绑定配送平台", index: 2 },
+        { name: "绑定打印机", index: 3 },
+      ],
+      tab_ac: 0,
+    };
+  },
+  created() {
+    bus.$on("goPrinter", () => {
+      this.changeTabs(3);
+    });
+    let i = this.$route.query.tab_ac;
+    if (i) {
+      this.changeTabs(Number(i));
+      // this.$route.query = {}
+    }
+  },
+  mounted() {},
+  methods: {
+    changeTabs(i) {
+      this.tab_ac = i;
+      switch (i) {
+        case 0:
+          this.activeName = "shopList";
           break;
-          case 1:
-            this.activeName = 'storeList';
+        case 1:
+          this.activeName = "storeList";
           break;
-          case 2:
-            this.activeName = 'deliveryList';
+        case 2:
+          this.activeName = "deliveryList";
           break;
-          case 3:
-            this.activeName = 'printerList';
+        case 3:
+          this.activeName = "printerList";
           break;
-          default:
-            this.activeName = 'shopList';
+        default:
+          this.activeName = "shopList";
           break;
-        }
-      },
+      }
     },
-    mounted() {
-    }
-  }
+  },
+  mounted() {},
+};
 </script>
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style scoped lang="scss">
-  .shopInfo {
-    .order_tab {
+.shopInfo {
+  .order_tab {
+    width: 100%;
+    height: 74px;
+    background: #fff;
+
+    .tab_list {
       width: 100%;
       height: 74px;
-      background: #FFF;
+      padding-top: 20px;
+      padding-left: 36px;
+      box-sizing: border-box;
+      display: flex;
 
-      .tab_list {
-        width: 100%;
-        height: 74px;
-        padding-top: 20px;
-        padding-left: 36px;
-        box-sizing: border-box;
-        display: flex;
+      .tab_item {
+        min-width: 58px;
+        margin-right: 56px;
+        font-size: 16px;
+        font-weight: 500;
+        color: #b1b1b1;
+        position: relative;
+        text-align: center;
+        cursor: pointer;
 
-        .tab_item {
-          min-width: 58px;
-          margin-right: 56px;
-          font-size: 16px;
-          font-weight: 500;
-          color: #B1B1B1;
-          position: relative;
-          text-align: center;
-          cursor: pointer;
-
-          .tab_line {
-            width: 58px;
-            height: 6px;
-            background: #FFF;
-            border-radius: 3px;
-            margin: 15px auto 0;
-          }
+        .tab_line {
+          width: 58px;
+          height: 6px;
+          background: #fff;
+          border-radius: 3px;
+          margin: 15px auto 0;
         }
+      }
 
-        .tab_item_ac {
-          color: #FC7200;
+      .tab_item_ac {
+        color: #fc7200;
 
-          .tab_line {
-            background: #FC7200;
-          }
+        .tab_line {
+          background: #fc7200;
         }
       }
     }
+  }
 
-    .content {
-      width: 100%;
-      margin-top: 10px;
-    }
+  .content {
+    width: 100%;
+    margin-top: 10px;
   }
+}
 </style>

+ 15 - 2
src/views/home.vue

@@ -3,8 +3,10 @@
     <sidebar></sidebar>
     <el-container>
       <el-header style="text-align: right;height: 80px;line-height: 80px;">
-        <span class="header-button">充值中心</span>
-        <span class="header-button">打印设置</span>
+        <span @click="$router.push({
+          path: '/shopInfo/shopAccount'
+        })" class="header-button">充值中心</span>
+        <span @click="goPrinter" class="header-button">打印设置</span>
         <el-dropdown trigger="click">
           <span class="el-dropdown-link">
             <span style="cursor: pointer;">{{ userInfo.nickname }}</span>
@@ -45,6 +47,17 @@ export default {
   },
 
   methods: {
+    goPrinter() {
+      this.$router.push({
+        path: "/shopInfo/shopInfos",
+        query: {
+          tab_ac: 3,
+        },
+      });
+      if(this.$route.name === 'shopInfos'){
+        bus.$emit('goPrinter')
+      }
+    },
     loginOut() {
       this.$confirm("此操作将退出当前登录用户, 是否继续?", "提示", {
         confirmButtonText: "确定",