فهرست منبع

feat 成为商家

Funny 3 سال پیش
والد
کامیت
d720927af3
3فایلهای تغییر یافته به همراه32 افزوده شده و 13 حذف شده
  1. 25 11
      src/components/merchantAdd.vue
  2. 1 1
      src/components/shopCompoents/shopList.vue
  3. 6 1
      src/views/home.vue

+ 25 - 11
src/components/merchantAdd.vue

@@ -2,17 +2,17 @@
   <div class="shopAdd">
     <el-dialog width="600px" :title="title" destroy-on-close center :visible.sync="showVisible">
       <el-form :model="form">
-        <el-form-item label="门店名称" label-width="103px">
-          <el-input v-model="form.name" placeholder="请输入店铺名称" autocomplete="off" style="width: 100%"></el-input>
+        <el-form-item label="商家名称" label-width="103px">
+          <el-input v-model="form.merchantName" placeholder="请输入店铺名称" autocomplete="off" style="width: 100%"></el-input>
         </el-form-item>
-        <el-form-item label="主营类别" label-width="103px">
+        <el-form-item label="主营业务" label-width="103px">
           <div class="category_box">
             <div class="item" :class="form.categoryId == item.id ? 'active':''" v-for="(item,i) in products" :key="i" @click="$set(form,'categoryId',item.id)">
               {{item.name}}
             </div>
           </div>
         </el-form-item>
-        <el-form-item label="详细地址" label-width="103px">
+        <el-form-item label="商家地址" label-width="103px">
           <el-input v-model="form.address" placeholder="请点击地图选择具体地址" disabled autocomplete="off" style="width: 100%">
             <el-image @click="showMap" slot="append" class="map" src="../../../static/image/icon_map.png"></el-image>
           </el-input>
@@ -40,6 +40,7 @@
 <script>
 import orderMap from "../components/orderComponents/orderAMap.vue";
 import { merchantAdd, merchantDetail, merchantModify } from "../api/user.js";
+import bus from "../common/bus.js";
 export default {
   props: {
     products: {
@@ -63,7 +64,7 @@ export default {
         lat: "",
         lng: "",
         mobile: "",
-        name: "",
+        merchantName: "",
         street: "",
         categoryId: "",
       },
@@ -122,7 +123,7 @@ export default {
       this.form.lat = lat;
     },
     save() {
-      if (!this.form.name.trim()) {
+      if (!this.form.merchantName.trim()) {
         return this.$message({
           type: "error",
           message: "请输入门店名称!",
@@ -164,9 +165,16 @@ export default {
           if (res.code === 200) {
             this.$message({
               type: "success",
-              message: `保存成功!`,
+              message: `已经修改成功,即将跳出重新登录!`,
             });
-            this.$emit("getData");
+
+            setTimeout(() => {
+              localStorage.clear();
+              bus.$emit("closeGetSoundMsg");
+              this.$router.push({
+                path: "/login",
+              });
+            }, 2000);
           } else {
             this.$message({
               type: "error",
@@ -181,16 +189,22 @@ export default {
           if (res.code === 200) {
             this.$message({
               type: "success",
-              message: `新增成功!`,
+              message: `已经成为商家,即将跳出重新登录`,
             });
-            this.$emit("getData");
+
+            setTimeout(() => {
+              localStorage.clear();
+              bus.$emit("closeGetSoundMsg");
+              this.$router.push({
+                path: "/login",
+              });
+            }, 2000);
           } else {
             this.$message({
               type: "error",
               message: res.msg,
             });
           }
-          this.showVisible = false;
           this.loading = false;
         });
       }

+ 1 - 1
src/components/shopCompoents/shopList.vue

@@ -18,7 +18,7 @@
       <el-table-column prop="address" label="门店地址" width="321" align="center"></el-table-column>
       <el-table-column prop="contactName" label="联系人" width="164" align="center"></el-table-column>
       <el-table-column prop="mobile" label="联系电话" width="176" align="center"></el-table-column>
-      <el-table-column label="已获运力" align="center" width="320">
+      <el-table-column label="已获运力" align="center" width="350">
         <template slot-scope="scope">
           <div class="imgs">
             <img class="img" :src="item.logo" v-for="(item, i) in scope.row.deliveries" :key="i" alt="">

+ 6 - 1
src/views/home.vue

@@ -3,6 +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="$router.push({
           path: '/shopInfo/shopAccount'
         })" class="header-button">充值中心</span>
@@ -37,6 +38,7 @@ export default {
     return {
       audio: null,
       productList: [],
+      memberType: this.$store.state.userInfo.memberType
     };
   },
   computed: {
@@ -59,12 +61,15 @@ export default {
         center: true,
       })
         .then(() => {
-          this.$refs.merchantAdd.init('','成为商户');
+          this.$refs.merchantAdd.init(0);
         })
     }
   },
 
   methods: {
+    showMerchant(){
+      this.$refs.merchantAdd.init(0);
+    },
     getProductList() {
       getProductList().then((res) => {
         if (res.code === 200) {