Funny %!s(int64=3) %!d(string=hai) anos
pai
achega
731252d8d0

+ 29 - 4
src/components/manualCreate.vue

@@ -151,9 +151,9 @@
 import orderMap from "./orderComponents/orderAMap.vue";
 import addressManagement from "./addressManagement.vue";
 import { getProductList } from "../api/shop.js";
+import { getConfig } from "../api/setting.js";
 import { sendValuation, saveOrder, getAddressList } from "../api/order.js";
 import sendOrderPopup from "../components/orderComponents/sendOrderPopup.vue";
-import { send } from "process";
 export default {
   name: "manualCreate",
   data() {
@@ -320,9 +320,9 @@ export default {
             });
             console.log("sendAddress1", sendAddress);
             Object.keys(this.form.sendAddress).map((v) => {
-              this.form.sendAddress[v] = sendAddress ? sendAddress[v] : '';
+              this.form.sendAddress[v] = sendAddress ? sendAddress[v] : "";
             });
-            this.name = sendAddress ? sendAddress.name : '';
+            this.name = sendAddress ? sendAddress.name : "";
           }
           if (this.addressType === 2) {
             this.addressList = res.data.personal;
@@ -488,7 +488,32 @@ export default {
           });
         }
         this.form.saveFlag = 1;
-        this.saveOrder();
+        getConfig().then((res) => {
+          if (res.code === 200) {
+            let amount = res.data.amount;
+            if (amount < 100) {
+              this.$confirm("您的账户余额小于100元,请及时充值!", "提示", {
+                confirmButtonText: "去充值",
+                cancelButtonText: "知道了!",
+                center: true,
+                type: "warning",
+              })
+                .then(() => {
+                  this.$router.push({
+                    path: "/shopInfo/shopAccount",
+                  });
+                })
+                .catch(() => {
+                  this.saveOrder();
+                });
+            }
+          } else {
+            this.$message({
+              type: "error",
+              message: res.msg,
+            });
+          }
+        });
       } else {
         this.form.takeTime = this.$tool.getFormatDate(new Date());
         this.sendValuation();

+ 7 - 18
src/components/merchantAdd.vue

@@ -40,6 +40,7 @@
 <script>
 import orderMap from "../components/orderComponents/orderAMap.vue";
 import { merchantAdd, merchantDetail, merchantModify } from "../api/user.js";
+import { mapActions } from "vuex";
 import bus from "../common/bus.js";
 export default {
   props: {
@@ -77,6 +78,7 @@ export default {
     orderMap,
   },
   methods: {
+    ...mapActions(["getUserInfo"]),
     init(type) {
       if (type) {
         this.title = "修改资料";
@@ -165,22 +167,15 @@ export default {
           if (res.code === 200) {
             this.$message({
               type: "success",
-              message: `已经修改成功,即将跳出重新登录!`,
+              message: `已经修改成功!`,
             });
-
-            setTimeout(() => {
-              localStorage.clear();
-              bus.$emit("closeGetSoundMsg");
-              this.$router.push({
-                path: "/login",
-              });
-            }, 2000);
           } else {
             this.$message({
               type: "error",
               message: res.msg,
             });
           }
+          this.getUserInfo();
           this.showVisible = false;
           this.loading = false;
         });
@@ -189,22 +184,16 @@ export default {
           if (res.code === 200) {
             this.$message({
               type: "success",
-              message: `已经成为商家,即将跳出重新登录`,
+              message: `已经成为商家!`,
             });
-
-            setTimeout(() => {
-              localStorage.clear();
-              bus.$emit("closeGetSoundMsg");
-              this.$router.push({
-                path: "/login",
-              });
-            }, 2000);
           } else {
             this.$message({
               type: "error",
               message: res.msg,
             });
           }
+          this.getUserInfo();
+          this.showVisible = false;
           this.loading = false;
         });
       }

+ 32 - 18
src/components/shopCompoents/bindDelivery.vue

@@ -29,8 +29,6 @@
             }}</span>
             <el-button v-if="[0, 3].includes(v.bindStatus)" @click="goBind(v)" v-loading.fullscreen.lock="fullscreenLoading" element-loading-text="关闭窗口后再操作!" type="primary" size="small" class="right-btn">去绑定</el-button>
             <el-button v-if="[1].includes(v.bindStatus)" @click="release(v)" size="small">解&nbsp;&nbsp;&nbsp;绑</el-button>
-            <!-- <el-button v-if="v.bindStatus === 2" @click="release(v)" type="info" size="small">审核中</el-button> -->
-            <!-- <el-button v-if="v.bindStatus === 3" @click="release(v)" type="danger" size="small">已拒绝</el-button> -->
             <el-button v-if="[1, 4].includes(v.bindStatus) && [1, 9].includes(v.type)" @click="perfectData(v)" type="primary" size="small" class="right-btn">完善资料</el-button>
           </div>
         </div>
@@ -162,6 +160,7 @@ export default {
   // 9->达达优质
   // 10->快服务
   // 12->货拉拉
+  // 13-> 美图跑腿
   methods: {
     explainDelivery() {
       explainDelivery().then((res) => {
@@ -274,24 +273,38 @@ export default {
             return;
           });
       } else {
-        bindDelivery(params).then((res) => {
-          if (res.code === 200) {
-            if (res.data) {
-              this.jumpUrl = res.data;
-            } else {
-              this.$message({
-                type: "success",
-                message: "已成功绑定!",
-              });
-              this.getDeliveryList();
-            }
-          } else {
+        this.$confirm("此操作将绑定当前配送平台, 是否继续?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+          center: true,
+        })
+          .then(() => {
+            bindDelivery(params).then((res) => {
+              if (res.code === 200) {
+                if (res.data) {
+                  this.jumpUrl = res.data;
+                } else {
+                  this.$message({
+                    type: "success",
+                    message: "已成功绑定!",
+                  });
+                  this.getDeliveryList();
+                }
+              } else {
+                this.$message({
+                  type: "error",
+                  message: res.msg,
+                });
+              }
+            });
+          })
+          .catch(() => {
             this.$message({
-              type: "error",
-              message: res.msg,
+              type: "info",
+              message: "已取消绑定!",
             });
-          }
-        });
+          });
       }
     },
     bindUU() {
@@ -402,6 +415,7 @@ export default {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
+        center: true,
       })
         .then(() => {
           // 爱跑腿解除绑定

+ 19 - 5
src/store/index.js

@@ -1,16 +1,30 @@
 import Vue from 'vue';
 import Vuex from 'vuex';
-
+import { getConfig } from '../api/setting.js';
 Vue.use(Vuex);
 
 const state = {
-  userInfo: null || JSON.parse( localStorage.getItem('userInfo') )
+  userInfo: null || JSON.parse(localStorage.getItem('userInfo'))
 }
 
-const actions = {}
+const actions = {
+  getUserInfo(context) {
+    getConfig().then(res => {
+      if (res.code === 200) {
+        context.commit('SET_USERINFO', res.data)
+      } else {
+        this.$message({
+          type: 'error',
+          message: res.msg
+        })
+      }
+    })
+  }
+}
 
 const mutations = {
-  SET_USERINFO: ( state, userInfo ) => {
+  SET_USERINFO: (state, userInfo) => {
+    console.log('进来了', userInfo);
     state.userInfo = userInfo;
     // 防止页面刷新,导致Vuex重启
     localStorage.setItem('userInfo', JSON.stringify(userInfo));
@@ -18,7 +32,7 @@ const mutations = {
 }
 
 const getters = {
-  userInfo: ( state ) => {
+  userInfo: (state) => {
     return state.userInfo
   }
 }

+ 1 - 2
src/views/home.vue

@@ -3,7 +3,7 @@
     <sidebar></sidebar>
     <el-container>
       <el-header style="text-align: right;height: 80px;line-height: 80px;">
-        <span @click="showMerchant" v-if="memberType === 1" class="header-button">成为商户</span>
+        <span @click="showMerchant" v-if="$store.state.userInfo.memberType === 1" class="header-button">成为商户</span>
         <span @click="$router.push({
           path: '/shopInfo/shopAccount'
         })" class="header-button">充值中心</span>
@@ -38,7 +38,6 @@ export default {
     return {
       audio: null,
       productList: [],
-      memberType: this.$store.state.userInfo.memberType,
     };
   },
   computed: {