Bladeren bron

商家段营业状态完善 去调用户端社区 去调商家端推广

宋飞扬 1 jaar geleden
bovenliggende
commit
786666245a
3 gewijzigde bestanden met toevoegingen van 140 en 89 verwijderingen
  1. 27 26
      src/components/tabbar/index.vue
  2. 89 35
      src/pages/merchant/tabBar/mine/index.vue
  3. 24 28
      src/pages/merchant/tabBar/store/index.vue

+ 27 - 26
src/components/tabbar/index.vue

@@ -1,5 +1,6 @@
 <template>
   <view>
+    <!-- 用户端 -->
     <view v-if="isShow">
       <u-tabbar :value="currentTab" activeColor="#2D73F0" inactiveColor="#333" :border="true">
         <u-tabbar-item
@@ -14,6 +15,8 @@
         </u-tabbar-item>
       </u-tabbar>
     </view>
+
+    <!-- 商家端 -->
     <view v-if="!isShow">
       <u-tabbar :value="currentTab" activeColor="#2D73F0" inactiveColor="#333" :border="true">
         <u-tabbar-item
@@ -32,7 +35,6 @@
 </template>
 
 <script>
-// TODO: 商家端自定义tabbar待处理
 export default {
   name: 'TabBar',
   props: {
@@ -53,13 +55,13 @@ export default {
           iconPath: '/static/images/home.png',
           selectedIconPath: '/static/images/home-select.png',
         },
-        {
-          text: '社区',
-          name: 'clientCommunity',
-          pagePath: '/pages/client/tabBar/community/index',
-          iconPath: '/static/images/community.png',
-          selectedIconPath: '/static/images/community-select.png',
-        },
+        // {
+        //   text: '社区',
+        //   name: 'clientCommunity',
+        //   pagePath: '/pages/client/tabBar/community/index',
+        //   iconPath: '/static/images/community.png',
+        //   selectedIconPath: '/static/images/community-select.png',
+        // },
         {
           text: '消息',
           name: 'clientMessage',
@@ -90,13 +92,13 @@ export default {
           iconPath: '/static/images/community.png',
           selectedIconPath: '/static/images/community-select.png',
         },
-        {
-          text: '推广',
-          name: 'merchantExtend',
-          pagePath: 'pages/merchant/tabBar/extend/index',
-          iconPath: '/static/images/community.png',
-          selectedIconPath: '/static/images/community-select.png',
-        },
+        // {
+        //   text: '推广',
+        //   name: 'merchantExtend',
+        //   pagePath: 'pages/merchant/tabBar/extend/index',
+        //   iconPath: '/static/images/community.png',
+        //   selectedIconPath: '/static/images/community-select.png',
+        // },
         {
           text: '店铺',
           name: 'merchantStore',
@@ -115,28 +117,27 @@ export default {
     };
   },
   mounted() {
-    this.isShow = uni.getStorageSync('tabbar_type')
-	// if(!this.isShow){
-	// 	this.isShow = true
-	// }
+    this.isShow = uni.getStorageSync('tabbar_type');
+    // if(!this.isShow){
+    // 	this.isShow = true
+    // }
   },
-  watch:{
-    isShow(newValue){
-      console.log('@@@isShownewValue',newValue);
-    }
+  watch: {
+    isShow(newValue) {
+      console.log('@@@isShownewValue', newValue);
+    },
   },
   methods: {
     handTab(row) {
-      if(this.isShow){
+      if (this.isShow) {
         uni.switchTab({
           url: row.pagePath,
         });
-      }else{
+      } else {
         uni.redirectTo({
           url: row.pagePath,
         });
       }
-
     },
   },
 };

+ 89 - 35
src/pages/merchant/tabBar/mine/index.vue

@@ -7,25 +7,26 @@
   <view class="mine">
     <!-- 状态栏占位 -->
     <!-- <view class="mine__nav" :style="{ height: statusBarHeight + 'px' }" /> -->
-    <view class="mine__nav" style="height: 80rpx;" />
+    <!-- <view class="mine__nav" style="height: 80rpx" /> -->
 
     <view class="mine__person">
-      <view class="mine__person--icon">
+      <!-- <view class="mine__person--icon">
         <u-icon name="setting" color="#fff" size="22" @click="handlerSkipSetting"/>
-        <u-icon name="chat" color="#fff" size="22" />
-      </view>
+        <u-icon name="chat" color="#fffb" size="22" />
+      </view> -->
       <view class="mine__person--info">
-        <image
-          src="@/static/QR57a.jpg"
-          style="width: 140rpx; height: 140rpx; border-radius: 50%"
-        />
+        <image src="@/static/QR57a.jpg" style="width: 140rpx; height: 140rpx; border-radius: 50%" />
 
         <view class="userName">
           <view> yizhiyang的鲜花店(云岩区店)</view>
           <text> +8618285564342</text>
         </view>
-        <view class="status">
-          <view style="margin-right: 6rpx">营业状态</view>
+        <view
+          class="status"
+          :style="{ 'background-color': getStatusColor(state) }"
+          @click="changeStatust(state)"
+        >
+          <view style="margin-right: 6rpx">{{ stateName }}</view>
           <u-icon name="play-right-fill" color="#fff" size="12" />
         </view>
       </view>
@@ -60,30 +61,31 @@
         </view>
       </view>
       <view class="mine__main--setting">
-        <template v-for="item in list1" >
+        <template v-for="item in list1">
           <u-cell size="large" :border="false" :title="item.name" isLink :url="item.url">
-            <image
-              slot="icon"
-              src="@/static/tools.jpg"
-              style="width: 60rpx; height: 60rpx"
-            />
+            <image slot="icon" src="@/static/tools.jpg" style="width: 60rpx; height: 60rpx" />
           </u-cell>
         </template>
       </view>
 
-     <view class="mine__main--setting">
-        <template v-for="item in list2" >
-          <u-cell size="large" :border="false" :title="item.name" isLink :url="item.url">
-            <image
-              slot="icon"
-              src="@/static/tools.jpg"
-              style="width: 60rpx; height: 60rpx"
-            />
+      <view class="mine__main--setting">
+        <template v-for="item in list2" @click="tap(item)">
+          <u-cell size="large" :border="false" @tap="" :title="item.name" isLink :url="item.url">
+            <image slot="icon" src="@/static/tools.jpg" style="width: 60rpx; height: 60rpx" />
           </u-cell>
         </template>
       </view>
     </view>
-	<tabbar currentTab="merchantMine" />
+    <tabbar currentTab="merchantMine" />
+
+    <!-- 营业状态选择弹框 -->
+    <u-picker
+      :show="show"
+      :columns="columns"
+      @cancel="cancel"
+      @confirm="confirm"
+      keyName="label"
+    ></u-picker>
   </view>
 </template>
 
@@ -92,6 +94,26 @@ export default {
   data() {
     return {
       statusBarHeight: 0,
+      state: 1,
+      stateName: '营业中',
+      show: false,
+      columns: [
+        [
+          {
+            label: '营业中',
+            id: 1,
+          },
+          {
+            label: '维护中',
+            id: 2,
+          },
+          {
+            label: '停业中',
+            id: 3,
+          },
+        ],
+      ],
+
       list1: [
         {
           id: '1',
@@ -124,19 +146,55 @@ export default {
       ],
     };
   },
+
+  onLoad() {
+    this.getHeight();
+  },
+
   methods: {
+    tap(item) {
+      console.log('item', item);
+    },
+
+    changeStatust() {
+      this.show = true;
+    },
+
+    cancel() {
+      this.show = false;
+    },
+
+    confirm(val) {
+      this.state = val.value[0].id;
+      this.stateName = val.value[0].label;
+      this.show = false;
+    },
+
+    getStatusColor(state) {
+      if (state === 1) {
+        return '#19be6b';
+      } else if (state === 2) {
+        return '#ff9900';
+      } else if (state === 3) {
+        return '#909399';
+      } else {
+        return '';
+      }
+    },
+
     // 点击跳转到设置
-    handlerSkipSetting(){
+    handlerSkipSetting() {
       uni.navigateTo({
-        url:'/pages/tabbar/mine/setting/index'
-      })
+        url: '/pages/tabbar/mine/setting/index',
+      });
     },
+
     //计算导航栏总高度
     getHeight() {
       // 获取系统信息
-      const systemInfo = wx.getSystemInfoSync();
+      const systemInfo = uni.getSystemInfoSync();
       // 胶囊按钮位置信息
-      const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
+      const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
       // 导航栏高度 = 状态栏到胶囊的间距(胶囊距上距离-状态栏高度) * 2 + 胶囊高度 + 状态栏高度
       this.statusBarHeight =
         (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 +
@@ -144,10 +202,6 @@ export default {
         systemInfo.statusBarHeight;
     },
   },
-
-  onLoad() {
-    this.getHeight();
-  },
 };
 </script>
 
@@ -161,7 +215,7 @@ export default {
   }
 
   &__person {
-    height: 230rpx;
+    height: 200rpx;
     padding: $uni-bg-padding-sm;
     background-color: $uni-bg-color-primary;
     position: relative;

+ 24 - 28
src/pages/merchant/tabBar/store/index.vue

@@ -29,7 +29,11 @@
 
     <view class="shop__tools">
       <u-grid :border="false" col="5">
-        <u-grid-item v-for="(listItem, listIndex) in list" :key="listIndex" @click="handlerSkip(listItem,listIndex)">
+        <u-grid-item
+          v-for="(listItem, listIndex) in list"
+          :key="listIndex"
+          @click="handlerSkip(listItem, listIndex)"
+        >
           <image src="@/static/tools.jpg" />
           <text class="grid-text">{{ listItem.title }}</text>
         </u-grid-item>
@@ -38,13 +42,7 @@
 
     <view class="shop__note" style="background-color: #fff">
       <u-cell-group>
-        <u-cell
-          size="large"
-          :border="false"
-          title="规制中心"
-          isLink
-          url=""
-        ></u-cell>
+        <u-cell size="large" :border="false" title="规制中心" isLink url=""></u-cell>
       </u-cell-group>
     </view>
 
@@ -69,11 +67,9 @@
         itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"
       ></u-tabs>
 
-      <view style="background-color: #fff; height: 400rpx; margin-top: 20rpx">
-        1111111111
-      </view>
+      <view style="background-color: #fff; height: 400rpx; margin-top: 20rpx"> 1111111111 </view>
     </view>
-	<tabbar currentTab="merchantStore" />
+    <tabbar currentTab="merchantStore" />
   </view>
 </template>
 
@@ -130,29 +126,29 @@ export default {
       ],
     };
   },
-  methods:{
+  methods: {
     // 点击跳转
-    handlerSkip(item,index){
-      console.log('index',index);
-      switch(index){
+    handlerSkip(item, index) {
+      console.log('index', index);
+      switch (index) {
         case 0:
           uni.navigateTo({
-            url:'/pages/tabbar/store/shopManage'
-          })
-        break;
+            url: '/pages/tabbar/store/shopManage',
+          });
+          break;
         case 1:
           uni.navigateTo({
-            url:'/pages/tabbar/store/evaluateManagement'
-          })
-        break;
+            url: '/pages/tabbar/store/evaluateManagement',
+          });
+          break;
         case 5:
           uni.navigateTo({
-            url:'/pages/tabbar/store/myTeam'
-          })
-        break;
+            url: '/pages/tabbar/store/myTeam',
+          });
+          break;
       }
-    }
-  }
+    },
+  },
 };
 </script>
 
@@ -172,7 +168,7 @@ export default {
 .shop {
   min-height: calc(100vh - 80rpx);
   background-color: $uni-bg-color-page;
-  padding-top: 80rpx;  
+  padding-top: 80rpx;
   &__data {
     display: flex;
     text-align: center;