Browse Source

fix(merchant):优化商家认证

yizhiyang 1 year ago
parent
commit
6df05064f2
3 changed files with 65 additions and 58 deletions
  1. 15 0
      src/api/merchant/mine.js
  2. 16 0
      src/api/merchant/order.js
  3. 34 58
      src/pages/merchant/mine/index.vue

+ 15 - 0
src/api/merchant/mine.js

@@ -0,0 +1,15 @@
+import request from '@/utils/request';
+
+/**
+ * @description 商家接口 - 修改商家营业状态
+ * @param {*} data
+ * @returns
+ */
+
+export function updateBusinessStatus(id, data) {
+  return request({
+    url: `/maintain/merchant/updateBusinessStatus/${id}`,
+    method: 'PUT',
+    data: data,
+  });
+}

+ 16 - 0
src/api/merchant/order.js

@@ -31,3 +31,19 @@ export function getOrderQuantityApi(id) {
     },
   });
 }
+
+/**
+ * 预约接口 - 查询商家被预约列表
+ * @param {*} data
+ * @returns
+ */
+export function listMerchantReservations(data) {
+  return request({
+    url: `/maintain/listMerchantReservations`,
+    method: 'post',
+    data: data,
+    headers: {
+      'Content-Type': 'application/json',
+    },
+  });
+}

+ 34 - 58
src/pages/merchant/mine/index.vue

@@ -1,21 +1,14 @@
 <template>
   <view class="mine">
     <!-- 状态栏占位 -->
-    <!-- <view class="mine__nav" :style="{ height: statusBarHeight + 'px' }" /> -->
-    <view class="mine__nav" style="height: 80rpx" />
-
+    <view class="mine__nav" :style="{ height: 77 + 'px' }" />
     <view class="mine__person">
-      <!-- <view class="mine__person--icon">
-        <u-icon name="setting" color="#fff" size="22" @click="handlerSkipSetting"/>
-        <u-icon name="chat" color="#fffb" size="22" />
-      </view> -->
       <view class="mine__person--info">
-        <!-- 头像 -->
         <view>
           <image
-            :src="merchant.logo"
+            :src="merchantInfo.logo"
             style="width: 140rpx; height: 140rpx; border-radius: 50%"
-            v-if="merchant.logo"
+            v-if="merchantInfo.logo"
           />
           <image
             src="@/static/QR57a.jpg"
@@ -24,8 +17,18 @@
           />
         </view>
         <view class="userName">
-          <view v-if="merchant && merchant.name"> {{ merchant.name || '--' }}</view>
-          <text v-if="merchant && merchant.mobile"> +86 {{ merchant.mobile || '--' }}</text>
+          <view>
+            <view v-if="merchantInfo.storeName"> {{ merchantInfo.storeName }}</view>
+            <view v-else> 微信用户</view>
+          </view>
+          <view>
+            <view v-if="merchantInfo.mobileNumber" class="text">
+              +86 {{ merchantInfo.mobileNumber }}
+            </view>
+            <view v-else class="text">
+              <text style="color: #f6bf3f"> 您当前还未认证,</text>去认证>
+            </view>
+          </view>
         </view>
         <view
           class="status"
@@ -83,7 +86,6 @@
         </template>
       </view>
     </view>
-    <tabbar currentTab="merchantMine" />
 
     <!-- 营业状态选择弹框 -->
     <u-picker
@@ -105,15 +107,17 @@
       @confirm="confirmSwitch"
       @cancel="handelCancel"
     ></u-modal>
+
+    <tabbar currentTab="merchantMine" />
   </view>
 </template>
 
 <script>
 import { getMerchantAuthData } from '@/api/merchant/merchantAuth';
+
 export default {
   data() {
     return {
-      statusBarHeight: 0,
       state: 1,
       stateName: '营业中',
       show: false,
@@ -121,20 +125,16 @@ export default {
       title: '商家认证',
       content: '进入商家端前,我们需要一定的认证',
       merchantInfo: {},
-      merchant: {},
       columns: [
+        // 营业状态 0-营业中,1-休息中
         [
           {
             label: '营业中',
-            id: 1,
+            id: '0',
           },
           {
             label: '休息中',
-            id: 2,
-          },
-          {
-            label: '停业中',
-            id: 3,
+            id: '1',
           },
         ],
       ],
@@ -171,24 +171,15 @@ export default {
     };
   },
 
-  onLoad() {
-    // this.getHeight();
-    // 获取商家信息
-    this.merchantInfo = this.$store.state.data.merchantInfo;
-    let { merchant } = this.merchantInfo;
-    this.merchant = merchant;
-
-    // 判断是否存在商家id,是否需要认证
-    if (merchant.id) {
-      this.showAut = false;
-    } else {
-      this.showAut = true;
-    }
-    // this.showAut = true;
-  },
-
   onShow() {
     this.getMerchantAuth();
+    setTimeout(() => {
+      if (this.merchantInfo) {
+        this.showAut = false;
+      } else {
+        this.showAut = true;
+      }
+    }, 300);
   },
 
   methods: {
@@ -239,24 +230,12 @@ export default {
       });
     },
 
-    //计算导航栏总高度
-    getHeight() {
-      // 获取系统信息
-      const systemInfo = uni.getSystemInfoSync();
-      // 胶囊按钮位置信息
-      const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
-      // 导航栏高度 = 状态栏到胶囊的间距(胶囊距上距离-状态栏高度) * 2 + 胶囊高度 + 状态栏高度
-      this.statusBarHeight =
-        (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 +
-        menuButtonInfo.height +
-        systemInfo.statusBarHeight;
-    },
-
     // 获取商家信息
     async getMerchantAuth() {
       let res = await getMerchantAuthData();
       if (res.code === 'OK') {
         // 将数据存储到vuex中
+        this.merchantInfo = res.data;
         this.$store.commit('SET_MERCHANTINFO', res.data);
       }
     },
@@ -279,11 +258,6 @@ export default {
     background-color: $uni-bg-color-primary;
     position: relative;
 
-    &--icon {
-      display: flex;
-      justify-content: space-between;
-    }
-
     &--info {
       color: #fff;
       display: flex;
@@ -291,11 +265,13 @@ export default {
 
       .userName {
         width: 400rpx;
-        font-size: 34rpx;
+        font-size: 40rpx;
+        font-weight: bold;
         margin: 25rpx 0 0 16rpx;
 
-        > text {
-          font-size: 26rpx;
+        .text {
+          margin-top: 15rpx;
+          font-size: 30rpx;
         }
       }