Selaa lähdekoodia

bug修复;代码优化;

Funny 2 vuotta sitten
vanhempi
commit
45f7c3bcfd

+ 7 - 0
src/api/tool.js

@@ -27,9 +27,16 @@ function deepClone(obj) {
   }
   return o
 }
+/**
+ * 验证手机格式
+ */
+function mobile(value) {
+  return /^1[23456789]\d{9}$/.test(value)
+}
 export default {
   isArray,
   deepClone,
+  mobile,
   /**
    * fun 需要防抖的方法
    * delay 最小抖动间隔

+ 6 - 6
src/components/accountCompoents/consumption.vue

@@ -11,7 +11,7 @@
           </div>
           <div class="sel_item">
             <span class="name">类型:</span>
-            <el-select size="small" class="item1" v-model="params.shopId" placeholder="请选择收入/支出">
+            <el-select size="small" class="item1" v-model="params.source" placeholder="请选择收入/支出">
               <el-option v-for="(v,i) in consumptionList" :key="i" :label="v.name" :value="v.consumptionId"></el-option>
             </el-select>
           </div>
@@ -64,27 +64,27 @@
 import { getAccountFlow } from "../../api/amount.js";
 import { getShopList } from "../../api/shop.js";
 export default {
-  name: "coupon",
+  name: "consumption",
   data() {
     return {
       flowList: [],
       shopList: [],
       consumptionList: [
         {
-          consumptionId: "0",
+          consumptionId: "",
           name: "全部",
         },
         {
-          consumptionId: "1",
+          consumptionId: 1,
           name: "收入",
         },
         {
-          consumptionId: "2",
+          consumptionId: 2,
           name: "支出",
         },
       ],
       params: {
-        source: 2,
+        source: "",
         pageNum: 1,
         pageSize: 10,
         shopId: "",

+ 6 - 3
src/components/accountCompoents/wallet.vue

@@ -2,7 +2,7 @@
   <div class="wallet">
     <el-col :span="24">
       <div class="head-account">
-        <div class="balance">
+        <div class="balance" @click="goDetail">
           <div class="balance_name">账户余额(元)</div>
           <div class="balance_price">{{amount}}</div>
           <div class="balance_sign"><img src="../../../static/image/1.png" alt="" srcset=""> 为了您能高效发单,请保持账户资金充足</div>
@@ -10,7 +10,7 @@
         <div class="balance coupon" @click="goCoupon">
           <div class="balance_name">优惠券(张)</div>
           <div class="balance_price">{{$store.state.userInfo.couponNum}}</div>
-          <div class="balance_sign">优惠券(张)</div>
+          <div class="balance_sign">可用优惠券</div>
         </div>
       </div>
     </el-col>
@@ -134,6 +134,9 @@ export default {
     this.getRechargeList();
   },
   methods: {
+    goDetail() {
+      this.$router.push({ name: "walletDetail" });
+    },
     goCoupon() {
       this.$router.push({ name: "coupon" });
     },
@@ -160,7 +163,7 @@ export default {
       getRechargeList().then((res) => {
         if (res.code === 200) {
           this.moneyList = res.data;
-          this.couponList = this.moneyList[this.curIdx].couponList;
+          this.couponList = this.moneyList[this.curIdx].couponList || [];
           this.giveValue = this.moneyList[this.curIdx].giveValue;
           this.money = this.moneyList[this.curIdx].value;
           this.id = this.moneyList[this.curIdx].id;

+ 1 - 1
src/components/orderComponents/orderDetail.vue

@@ -32,7 +32,7 @@
           <div class="title">贺卡内容:</div>
           <div class="cont cont1">{{initCardInfo(orderDetail.cardInfo)}}</div>
         </div>
-        <div class="card">
+        <div class="card" v-if="$store.state.userInfo.isOpenCardPrint">
           <div @click="showPrintCard" class="print-card">打印贺卡{{orderDetail.cardPrintNum ? `(${orderDetail.cardPrintNum})` : ''}}</div>
         </div>
         <div class="detail_ine"></div>

+ 15 - 2
src/components/platformAccount/index.vue

@@ -29,7 +29,7 @@
           <el-input clearable v-model="form.mobile" placeholder="请填写手机号"></el-input>
         </el-form-item>
         <el-form-item label="登录密码">
-          <el-input clearable v-model="password" :placeholder="passwordTips"></el-input>
+          <el-input clearable v-model="password" maxlength="11" :placeholder="passwordTips"></el-input>
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
@@ -56,7 +56,11 @@ export default {
       centerDialogVisible: false,
       accountList: [],
       shopList: [],
-      form: {},
+      form: {
+        shopId: "",
+        name: "",
+        mobile: "",
+      },
       password: "",
       passwordTips: "",
     };
@@ -68,6 +72,15 @@ export default {
   // 方法集合
   methods: {
     addAccount() {
+      if (!this.form.shopId) {
+        return this.$message.error(`请选择账号所属的门店!`);
+      }
+      if (!this.form.name) {
+        return this.$message.error(`请填写员工称呼!`);
+      }
+      if (!this.$tool.mobile(this.form.mobile)) {
+        return this.$message.error(`请填写正确的手机号!`);
+      }
       if (this.isEdit) {
         if (this.password) {
           this.form.password = this.password;

+ 1 - 1
src/components/settingComponents/print.vue

@@ -43,7 +43,7 @@ export default {
       tabList: [
         { name: "云打印", index: 0, activeName: "printerList" },
         { name: "有线打印", index: 1, activeName: "usbPrinter" },
-        { name: "A4打印", index: 2, activeName: "a4Printer" },
+        // { name: "A4打印", index: 2, activeName: "a4Printer" },
         { name: "贺卡打印", index: 3, activeName: "greetingCardPrinter" },
       ],
       tabNum: 0,

+ 27 - 2
src/components/settingComponents/print/greetingCardPrinter.vue

@@ -94,11 +94,11 @@
               </div>
               <div class="setting-params">
                 <div class="card-title">贺卡尺寸</div>
-                <el-input :disabled="[9,11].includes(params.sizeType)" v-model="params.cardWidth">
+                <el-input ref="cardWidth" :disabled="[9,11].includes(params.sizeType)" v-model="params.cardWidth" @change="checkCardWidth">
                   <template slot="prepend">宽</template>
                   <template slot="append">毫米</template>
                 </el-input>
-                <el-input :disabled="[9,11].includes(params.sizeType)" v-model="params.cardHeight">
+                <el-input ref="cardHeight" :disabled="[9,11].includes(params.sizeType)" v-model="params.cardHeight" @change="checkCardHeight">
                   <template slot="prepend">高</template>
                   <template slot="append">毫米</template>
                 </el-input>
@@ -179,6 +179,7 @@ import {
   cloudConfigAdd,
 } from "../../../api/shop";
 import { getConfig, updateConfig } from "../../../api/setting.js";
+import { mapState, mapMutations, mapGetters, mapActions } from "vuex";
 export default {
   name: "greetingCardPrinter",
   components: {},
@@ -378,7 +379,30 @@ export default {
   },
   // 方法集合
   methods: {
+    ...mapMutations(["SET_USERINFO"]),
+    checkCardWidth(e) {
+      if (e < 195) {
+        this.$message.error(`自定义纸张宽度不可小于195毫米!`);
+        this.$refs.cardWidth.focus();
+      }
+    },
+    checkCardHeight(e) {
+      if (e < 145) {
+        this.$message.error(`自定义纸张高度不可小于145毫米!`);
+        this.$refs.cardHeight.focus();
+      }
+    },
     saveCard() {
+      if (this.params.sizeType === 0) {
+        if (this.params.cardWidth < 195) {
+          this.$refs.cardWidth.focus();
+          return this.$message.error(`自定义纸张宽度不可小于195毫米!`);
+        }
+        if (this.params.cardWidth < 145) {
+          this.$refs.cardHeight.focus();
+          return this.$message.error(`自定义纸张高度不可小于145毫米!`);
+        }
+      }
       cloudConfigAdd(this.params).then((res) => {
         console.log("添加贺卡配置信息", res);
         if (res.code === 200) {
@@ -709,6 +733,7 @@ export default {
     getConfig() {
       getConfig().then((res) => {
         if (res.code === 200) {
+          this.SET_USERINFO(res.data);
           this.list = this.list.map((v) => {
             v.value = res.data[v.field];
             return v;

+ 8 - 8
src/views/login.vue

@@ -52,7 +52,7 @@
 </template>
 
 <script>
-import { mapState, mapMutations, mapGetters,mapActions } from "vuex";
+import { mapState, mapMutations, mapGetters, mapActions } from "vuex";
 import { getPhoneCode, loginPassword, loginVerification } from "../api/user.js";
 export default {
   data() {
@@ -81,7 +81,7 @@ export default {
     console.log("vuex", this.userInfo);
   },
   methods: {
-    // ...mapMutations(["SET_USERINFO"]),
+    ...mapMutations(["SET_USERINFO"]),
     ...mapActions(["getUserInfo"]),
     seachEnterFun(e) {
       var keyCode = window.event ? e.keyCode : e.which;
@@ -99,8 +99,8 @@ export default {
       loginVerification(params).then((res) => {
         if (res.code == 200) {
           localStorage.setItem("token", res.data.token);
-          // this.SET_USERINFO(res.data.member);
-          this.getUserInfo()
+          this.SET_USERINFO(res.data.member);
+          this.getUserInfo();
           this.$router.push("/");
         } else {
           return this.$message({
@@ -121,8 +121,8 @@ export default {
         if (res.code == 200) {
           this.errCount = 0;
           localStorage.setItem("token", res.data.token);
-          // this.SET_USERINFO(res.data.member);
-          this.getUserInfo()
+          this.SET_USERINFO(res.data.member);
+          this.getUserInfo();
           this.$store.dispatch("getUsbPrint");
           this.$router.push("/");
         } else {
@@ -164,8 +164,8 @@ export default {
       }
       if (!this.checked) {
         return this.$message({
-          message: "请先勾选同意后再充值!",
-          type: "info",
+          message: "请先勾选同意后再登录!",
+          type: "error",
         });
       }
       if (this.activeIndex == 1) {