Prechádzať zdrojové kódy

!128 【缺陷修复】
Merge pull request !128 from puhui999/dev

芋道源码 8 mesiacov pred
rodič
commit
dcd63dd54e

+ 12 - 8
pages/commission/order.vue

@@ -72,10 +72,9 @@
 
 <script setup>
   import sheep from '@/sheep';
-  import { onLoad, onReachBottom } from '@dcloudio/uni-app';
+  import { onLoad, onPageScroll, onReachBottom } from '@dcloudio/uni-app';
   import { reactive } from 'vue';
   import _ from 'lodash-es';
-  import { onPageScroll } from '@dcloudio/uni-app';
   import { resetPagination } from '@/sheep/util';
   import BrokerageApi from '@/sheep/api/trade/brokerage';
   import { fen2yuan } from '../../sheep/hooks/useGoods';
@@ -104,15 +103,15 @@
   const tabMaps = [
     {
       name: '全部',
-      value: 'all',
+      value: -1,
     },
     {
       name: '待结算',
-      value: '0', // 待结算
+      value: 0, // 待结算
     },
     {
       name: '已结算',
-      value: '1', // 已结算
+      value: 1, // 已结算
     },
   ];
 
@@ -126,12 +125,17 @@
   // 获取订单列表
   async function getOrderList() {
     state.loadStatus = 'loading';
-    let { code, data } = await BrokerageApi.getBrokerageRecordPage({
+    const tab = tabMaps[state.currentTab];
+    const queryParams = {
       pageSize: state.pagination.pageSize,
       pageNo: state.pagination.pageNo,
       bizType: 1, // 获得推广佣金
-      status: state.currentTab > 0 ? state.currentTab : undefined,
-    });
+      status: tab.value,
+    }
+    if (tab.value < 0) {
+      delete queryParams.status;
+    }
+    const { code, data } = await BrokerageApi.getBrokerageRecordPage(queryParams);
     if (code !== 0) {
       return;
     }

+ 1 - 0
sheep/components/s-custom-navbar/components/navbar-item.vue

@@ -6,6 +6,7 @@
       v-if="data.type === 'text'"
       class="nav-title inline"
       :style="[{ color: data.textColor, width: width }]"
+      @tap="sheep.$router.go(data.url)"
     >
       {{ data.text }}
     </view>

+ 27 - 34
sheep/components/s-title-block/s-title-block.vue

@@ -7,11 +7,31 @@
   >
     <view class="title-content">
       <!-- 主标题 -->
-      <view v-if="data.title" class="title-text" :style="[titleStyles]">{{ data.title }}</view>
+      <view
+        v-if="data.title"
+        :style="{
+          fontSize: `${data.titleSize}px`,
+          fontWeight: data.titleWeight,
+          color: data.titleColor,
+          textAlign: data.textAlign
+      }"
+        class="title-text"
+      >
+        {{ data.title }}
+      </view>
       <!-- 副标题 -->
-      <view v-if="data.description" :style="[descStyles]" class="sub-title-text">{{
-        data.description
-      }}</view>
+      <view
+        v-if="data.description"
+        :style="{
+          fontSize: `${data.descriptionSize}px`,
+          fontWeight: data.descriptionWeight,
+          color: data.descriptionColor,
+          textAlign: data.textAlign
+        }"
+        class="sub-title-text"
+      >
+        {{ data.description }}
+      </view>
     </view>
     <!-- 查看更多 -->
     <view
@@ -20,7 +40,7 @@
       @tap="sheep.$router.go(data.more.url)"
       :style="{ color: data.descriptionColor }"
     >
-      <view class="more-text" v-if="data.more.type !== 'icon'">{{ data.more.text }} </view>
+      <view v-if="data.more.type !== 'icon'" class="more-text">{{ data.more.text }}</view>
       <text class="_icon-forward" v-if="data.more.type !== 'text'"></text>
     </view>
   </view>
@@ -30,7 +50,7 @@
   /**
    * 标题栏
    */
-  import { reactive, computed } from 'vue';
+  import { computed, reactive } from 'vue';
   import sheep from '@/sheep';
 
   // 数据
@@ -64,40 +84,13 @@
       background: bgType === 'img' ? `url(${bgImg}) no-repeat top center / 100% 100%` : bgColor,
     };
   });
-
-  // 标题样式
-  const titleStyles = {
-    color: props.data.titleColor,
-    fontSize: `${props.data.titleSize}px`,
-    textAlign: props.data.textAlign,
-  };
-
-  // 副标题
-  const descStyles = {
-    color: props.data.descriptionColor,
-    textAlign: props.data.textAlign,
-    fontSize: `${props.data.descriptionSize}px`,
-    fontWeight: `${props.data.descriptionWeight}`,
-  };
 </script>
 
 <style lang="scss" scoped>
   .ss-title-wrap {
-    height: 80rpx;
+    min-height: 80rpx;
     position: relative;
 
-    .title-content {
-      .title-text {
-        font-size: 30rpx;
-        color: #333;
-      }
-
-      .sub-title-text {
-        font-size: 22rpx;
-        color: #999;
-      }
-    }
-
     .more-box {
       white-space: nowrap;
       font-size: 22rpx;

+ 9 - 6
sheep/platform/share.js

@@ -168,12 +168,11 @@ const decryptSpm = (spm) => {
   shareParams.platform = platformMap[shareParamsArray[3] - 1];
   shareParams.from = fromMap[shareParamsArray[4] - 1];
   if (shareParams.shareId !== 0) {
+    // 记录分享者编号
+    uni.setStorageSync('shareId', shareParams.shareId);
     // 已登录 绑定推广员
-    if (user.isLogin) {
+    if (!!user.isLogin) {
       bindBrokerageUser(shareParams.shareId);
-    } else {
-      // 记录分享者编号
-      uni.setStorageSync('shareId', shareParams.shareId);
     }
   }
 
@@ -190,8 +189,12 @@ const bindBrokerageUser = async (val = undefined) => {
     if (!shareId) {
       return;
     }
-    await BrokerageApi.bindBrokerageUser({ bindUserId: shareId });
-    uni.removeStorageSync('shareId');
+    const { data, msg } = await BrokerageApi.bindBrokerageUser({ bindUserId: shareId });
+    // 绑定成功后清除缓存
+    if (!!data || msg.includes('不能绑定自己')) {
+      uni.removeStorageSync('shareId');
+    }
+
   } catch (e) {
     console.error(e);
   }