Procházet zdrojové kódy

📖 code review:店铺装修逻辑

YunaiV před 1 rokem
rodič
revize
51c552fb72
30 změnil soubory, kde provedl 92 přidání a 93 odebrání
  1. 35 42
      App.vue
  2. 1 1
      pages/pay/recharge.vue
  3. 2 7
      pages/user/wallet/score.vue
  4. 0 13
      sheep/api/app.js
  5. 1 1
      sheep/components/s-coupon-block/s-coupon-block.vue
  6. 8 7
      sheep/components/s-coupon-card/s-coupon-card.vue
  7. 1 0
      sheep/components/s-custom-navbar/s-custom-navbar.vue
  8. 1 0
      sheep/components/s-float-menu/s-float-menu.vue
  9. 1 0
      sheep/components/s-goods-card/s-goods-card.vue
  10. 4 3
      sheep/components/s-goods-shelves/s-goods-shelves.vue
  11. 1 0
      sheep/components/s-hotzone-block/s-hotzone-block.vue
  12. 1 0
      sheep/components/s-image-banner/s-image-banner.vue
  13. 2 1
      sheep/components/s-image-block/s-image-block.vue
  14. 1 0
      sheep/components/s-image-cube/s-image-cube.vue
  15. 1 0
      sheep/components/s-line-block/s-line-block.vue
  16. 1 0
      sheep/components/s-menu-button/s-menu-button.vue
  17. 1 0
      sheep/components/s-menu-grid/s-menu-grid.vue
  18. 1 0
      sheep/components/s-menu-list/s-menu-list.vue
  19. 1 0
      sheep/components/s-order-card/s-order-card.vue
  20. 4 0
      sheep/components/s-richtext-block/s-richtext-block.vue
  21. 1 1
      sheep/components/s-title-block/s-title-block.vue
  22. 2 2
      sheep/components/s-user-card/s-user-card.vue
  23. 1 1
      sheep/components/s-video-block/s-video-block.vue
  24. 1 0
      sheep/components/s-wallet-card/s-wallet-card.vue
  25. 2 1
      sheep/index.js
  26. 13 13
      sheep/platform/pay.js
  27. 1 0
      sheep/ui/su-navbar/su-navbar.vue
  28. 1 0
      sheep/ui/su-notice-bar/su-notice-bar.vue
  29. 1 0
      sheep/ui/su-tabbar-item/su-tabbar-item.vue
  30. 1 0
      sheep/ui/su-tabbar/su-tabbar.vue

+ 35 - 42
App.vue

@@ -1,46 +1,39 @@
 <script setup>
-	import {
-		onLaunch,
-		onShow,
-		onError
-	} from '@dcloudio/uni-app';
-	import {
-		ShoproInit
-	} from './sheep';
-
-	onLaunch(() => {
-		// 隐藏原生导航栏 使用自定义底部导航
-		uni.hideTabBar();
-
-		// 加载Shopro底层依赖
-		ShoproInit();
-	});
-
-	onError((err) => {
-		console.log('AppOnError:', err);
-	});
-
-	onShow((options) => {
-		// #ifdef APP-PLUS 
-		// 获取urlSchemes参数
-		const args = plus.runtime.arguments;
-		if (args) {}
-
-		// 获取剪贴板 
-		uni.getClipboardData({
-			success: (res) => {},
-		});
-		// #endif
-
-		// #ifdef MP-WEIXIN
-		// 确认收货回调结果 
-		console.log(options, 'options');
-		// #endif
-
-
-	});
+  import { onLaunch, onShow, onError } from '@dcloudio/uni-app';
+  import { ShoproInit } from './sheep';
+
+  onLaunch(() => {
+    // 隐藏原生导航栏 使用自定义底部导航
+    uni.hideTabBar();
+
+    // 加载Shopro底层依赖
+    ShoproInit();
+  });
+
+  onError((err) => {
+    console.log('AppOnError:', err);
+  });
+
+  onShow((options) => {
+    // #ifdef APP-PLUS
+    // 获取urlSchemes参数
+    const args = plus.runtime.arguments;
+    if (args) {
+    }
+
+    // 获取剪贴板
+    uni.getClipboardData({
+      success: (res) => { },
+    });
+    // #endif
+
+    // #ifdef MP-WEIXIN
+    // 确认收货回调结果
+    console.log(options,'options');
+    // #endif
+  });
 </script>
 
 <style lang="scss">
-	@import '@/sheep/scss/index.scss';
-</style>
+  @import '@/sheep/scss/index.scss';
+</style>

+ 1 - 1
pages/pay/recharge.vue

@@ -85,7 +85,7 @@
     // #endif
     sheep.$router.go('/pages/pay/index', {
       id: data.payOrderId,
-      type: 'recharge'
+      orderType: 'recharge'
     });
 	}
 

+ 2 - 7
pages/user/wallet/score.vue

@@ -8,12 +8,11 @@
         },
       ]">
 			<view class="header-bg">
-				<view class="bg"></view>
+				<view class="bg" />
 			</view>
 			<view class="score-box ss-flex-col ss-row-center ss-col-center">
 				<view class="ss-m-b-30">
 					<text class="all-title ss-m-r-8">当前积分</text>
-					<!-- <text class="cicon-help-o"></text> -->
 				</view>
 				<text class="all-num">{{ userInfo.point || 0 }}</text>
 			</view>
@@ -100,7 +99,6 @@
 			name: '全部',
 			value: 'all',
 		},
-
 		// {
 		// 	name: '收入',
 		// 	value: 'income',
@@ -147,6 +145,7 @@
 			// }
 		}
 	}
+
 	onLoad(async (options) => {
 		state.today = dayjs().format('YYYY-MM-DD');
 		state.date = [state.today, state.today];
@@ -166,10 +165,6 @@
 		getLogList();
 	}
 
-	function appendTimeHMS(arr) {
-		return [arr[0] + ' 00:00:00', arr[1] + ' 23:59:59'];
-	}
-
 	function onLoadMore() {
 		// if (state.loadStatus !== 'noMore') {
 		getLogList(pagination.current_page + 1);

+ 0 - 13
sheep/api/app.js

@@ -13,19 +13,6 @@ export default {
         showLoading: false,
       },
     }),
-  // 同步客户端页面到后端
-  pageSync: (pages) =>
-    request({
-      url: 'pageSync',
-      method: 'POST',
-      data: {
-        pages,
-      },
-      custom: {
-        showError: false,
-        showLoading: false,
-      },
-    }),
   // 自定义页面
   page: (id) =>
     request({

+ 1 - 1
sheep/components/s-coupon-block/s-coupon-block.vue

@@ -1,4 +1,4 @@
-<!-- 优惠券  -->
+<!-- 装修营销组件:优惠券  -->
 <template>
   <scroll-view class="scroll-box" scroll-x scroll-anchoring>
     <view class="coupon-box ss-flex">

+ 8 - 7
sheep/components/s-coupon-card/s-coupon-card.vue

@@ -1,3 +1,4 @@
+<!-- 装修用户组件:用户卡券 -->
 <template>
 	<view class="ss-coupon-menu-wrap ss-flex ss-col-center">
 		<view class="menu-item ss-flex-col ss-row-center ss-col-center" v-for="item in props.list" :key="item.title"
@@ -41,13 +42,13 @@
 						path: '/pages/coupon/list',
 						type: 'expired',
 					},
-					// {
-					//   title: '领券中心',
-					//   value: '0',
-					//   icon: '/static/img/shop/order/all_coupon.png',
-					//   path: '/pages/coupon/list',
-					//   type: 'all',
-					// },
+					{
+					  title: '领券中心',
+					  value: '0',
+					  icon: '/static/img/shop/order/all_coupon.png',
+					  path: '/pages/coupon/list',
+					  type: 'all',
+					},
 				];
 			},
 		},

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

@@ -1,3 +1,4 @@
+<!-- 顶部导航栏 -->
 <template>
   <navbar
     :alway="isAlway"

+ 1 - 0
sheep/components/s-float-menu/s-float-menu.vue

@@ -1,3 +1,4 @@
+<!-- 装修基础组件:悬浮按钮 -->
 <template>
   <!-- 模态背景:展开时显示,点击后折叠 -->
   <view class="modal-bg" v-if="fabRef?.isShow" @click="handleCollapseFab"></view>

+ 1 - 0
sheep/components/s-goods-card/s-goods-card.vue

@@ -1,3 +1,4 @@
+<!-- 装修商品组件:商品卡片 -->
 <template>
   <!-- 商品卡片 -->
   <view>

+ 4 - 3
sheep/components/s-goods-shelves/s-goods-shelves.vue

@@ -1,3 +1,4 @@
+<!-- 装修商品组件:商品栏 -->
 <template>
   <view>
     <!-- 布局1. 两列商品,图片左文案右 -->
@@ -27,7 +28,7 @@
           :bottomRadius="data.borderRadiusBottom"
           :titleWidth="(454 - marginRight * 2 - data.space * 2 - marginLeft * 2) / 2"
           @click="sheep.$router.go('/pages/goods/index', { id: item.id })"
-        ></s-goods-column>
+        />
       </view>
     </view>
     <!-- 布局. 三列商品:图片上文案下 -->
@@ -56,7 +57,7 @@
           :topRadius="data.borderRadiusTop"
           :bottomRadius="data.borderRadiusBottom"
           @click="sheep.$router.go('/pages/goods/index', { id: item.id })"
-        ></s-goods-column>
+        />
       </view>
     </view>
 
@@ -79,7 +80,7 @@
               :titleColor="data.fields.name?.color"
               :titleWidth="(750 - marginRight * 2 - data.space * 4 - marginLeft * 2) / 3"
               @click="sheep.$router.go('/pages/goods/index', { id: item.id })"
-            ></s-goods-column>
+            />
           </view>
         </view>
       </scroll-view>

+ 1 - 0
sheep/components/s-hotzone-block/s-hotzone-block.vue

@@ -1,3 +1,4 @@
+<!-- 装修图文组件:热区 -->
 <template>
   <view class="hotzone-wrap">
     <image :src="sheep.$url.cdn(data.imgUrl)" style="width: 100%" mode="widthFix"></image>

+ 1 - 0
sheep/components/s-image-banner/s-image-banner.vue

@@ -1,3 +1,4 @@
+<!-- 装修图文组件:图片轮播 -->
 <template>
   <su-swiper
     :list="imgList"

+ 2 - 1
sheep/components/s-image-block/s-image-block.vue

@@ -1,6 +1,7 @@
+<!-- 装修图文组件:图片展示 -->
 <template>
   <view @tap="sheep.$router.go(data?.url)">
-    <su-image :src="sheep.$url.cdn(data.imgUrl)" mode="widthFix"></su-image>
+    <su-image :src="sheep.$url.cdn(data.imgUrl)" mode="widthFix" />
   </view>
 </template>
 

+ 1 - 0
sheep/components/s-image-cube/s-image-cube.vue

@@ -1,3 +1,4 @@
+<!-- 装修图文组件:广告魔方 -->
 <template>
   <view class="ss-cube-wrap" :style="[parseAdWrap]">
     <view v-for="(item, index) in data.list" :key="index">

+ 1 - 0
sheep/components/s-line-block/s-line-block.vue

@@ -1,3 +1,4 @@
+<!-- 装修基础组件:分割线 -->
 <template>
   <su-subline v-bind="data"></su-subline>
 </template>

+ 1 - 0
sheep/components/s-menu-button/s-menu-button.vue

@@ -1,3 +1,4 @@
+<!-- 装修基础组件:菜单导航(金刚区) -->
 <template>
   <!-- 包裹层 -->
   <view

+ 1 - 0
sheep/components/s-menu-grid/s-menu-grid.vue

@@ -1,3 +1,4 @@
+<!-- 装修基础组件:宫格导航 -->
 <template>
   <uni-grid :showBorder="Boolean(data.border)" :column="data.column">
     <uni-grid-item

+ 1 - 0
sheep/components/s-menu-list/s-menu-list.vue

@@ -1,3 +1,4 @@
+<!-- 装修基础组件:列表导航 -->
 <template>
   <view class="menu-list-wrap">
     <uni-list :border="true">

+ 1 - 0
sheep/components/s-order-card/s-order-card.vue

@@ -1,3 +1,4 @@
+<!-- 装修用户组件:用户订单 -->
 <template>
   <view class="ss-order-menu-wrap ss-flex ss-col-center">
     <view

+ 4 - 0
sheep/components/s-richtext-block/s-richtext-block.vue

@@ -1,3 +1,4 @@
+<!-- 装修营销组件:营销文章 -->
 <template>
   <view
     :style="[
@@ -16,6 +17,7 @@
 <script setup>
   import { reactive, onMounted } from 'vue';
   import ArticleApi from '@/sheep/api/promotion/article';
+
   const props = defineProps({
     data: {
       type: Object,
@@ -26,9 +28,11 @@
       default() {},
     },
   });
+
   const state = reactive({
     content: '',
   });
+
   onMounted(async () => {
     const { data } = await ArticleApi.getArticle(props.data.id);
     state.content = data.content;

+ 1 - 1
sheep/components/s-title-block/s-title-block.vue

@@ -1,4 +1,4 @@
-<!-- 页面 -->
+<!-- 装修商品组件:标题栏 -->
 <template>
   <view
     class="ss-title-wrap ss-flex ss-col-center"

+ 2 - 2
sheep/components/s-user-card/s-user-card.vue

@@ -1,4 +1,4 @@
-<!-- 页面 -->
+<!-- 装修用户组件:用户卡片 -->
 <template>
 	<view class="ss-user-info-wrap ss-p-t-50">
 		<view class="ss-flex ss-col-center ss-row-between ss-m-b-20">
@@ -23,7 +23,7 @@
 			</view>
 		</view>
 
-
+    <!-- TODO @芋艿:用户接入 -->
 		<!-- 提示绑定手机号 先隐藏 yudao 需要再修改 -->
 		<!--    <view
       class="bind-mobile-box ss-flex ss-row-between ss-col-center"

+ 1 - 1
sheep/components/s-video-block/s-video-block.vue

@@ -1,4 +1,4 @@
-<!--  -->
+<!-- 装修图文组件:视频播放 -->
 <template>
   <su-video
     class="sss"

+ 1 - 0
sheep/components/s-wallet-card/s-wallet-card.vue

@@ -1,3 +1,4 @@
+<!-- 装修用户组件:用户资产 -->
 <template>
   <!-- TODO @惠智造:代码合并有问题,可以看看 -->
 	<view class="ss-wallet-menu-wrap ss-flex ss-col-center">

+ 2 - 1
sheep/index.js

@@ -46,8 +46,9 @@ function ShoproDebug() {
   // });
   // #endif
 
+  // TODO 芋艿:可以打印路由
   // 同步前端页面到后端
-  $api.app.pageSync(ROUTES);
+  // console.log(ROUTES)
 }
 
 export default sheep;

+ 13 - 13
sheep/platform/pay.js

@@ -8,7 +8,7 @@ import PayOrderApi from '@/sheep/api/pay/order';
 /**
  * 支付
  *
- * @param {String} payment = ['wechat','alipay','wallet','offline']  	- 支付方式
+ * @param {String} payment = ['wechat','alipay','wallet','mock']  	- 支付方式
  * @param {String} orderType = ['goods','recharge','groupon']  	- 订单类型
  * @param {String} id					- 订单号
  */
@@ -33,8 +33,8 @@ export default class SheepPay {
         wallet: () => {
           this.walletPay();
         },
-        offline: () => {
-          this.offlinePay();
+        mock: () => {
+          this.mockPay();
         }
       },
       WechatMiniProgram: {
@@ -47,8 +47,8 @@ export default class SheepPay {
         wallet: () => {
           this.walletPay();
         },
-        offline: () => {
-          this.offlinePay();
+        mock: () => {
+          this.mockPay();
         }
       },
       App: {
@@ -61,8 +61,8 @@ export default class SheepPay {
         wallet: () => {
           this.walletPay();
         },
-        offline: () => {
-          this.offlinePay();
+        mock: () => {
+          this.mockPay();
         }
       },
       H5: {
@@ -75,8 +75,8 @@ export default class SheepPay {
         wallet: () => {
           this.walletPay();
         },
-        offline: () => {
-          this.offlinePay();
+        mock: () => {
+          this.mockPay();
         }
       },
     };
@@ -182,10 +182,10 @@ export default class SheepPay {
     code === 0 && this.payResult('success');
   }
 
-  // 货到付款  TODO 芋艿:待接入
-  async offlinePay() {
-    const { error } = await this.prepay();
-    error === 0 && this.payResult('success');
+  // 模拟支付
+  async mockPay() {
+    const { code } = await this.prepay('mock');
+    code === 0 && this.payResult('success');
   }
 
   // 支付宝复制链接支付  TODO 芋艿:待接入

+ 1 - 0
sheep/ui/su-navbar/su-navbar.vue

@@ -1,3 +1,4 @@
+<!-- 自定义导航栏 -->
 <template>
   <view class="uni-navbar" :class="{ 'uni-dark': dark }">
     <view

+ 1 - 0
sheep/ui/su-notice-bar/su-notice-bar.vue

@@ -1,3 +1,4 @@
+<!-- 公告栏组件 -->
 <template>
   <view
     v-if="show"

+ 1 - 0
sheep/ui/su-tabbar-item/su-tabbar-item.vue

@@ -1,3 +1,4 @@
+<!-- 自定义底部导航项 -->
 <template>
   <view class="u-tabbar-item" :style="[addStyle(customStyle)]">
     <view v-if="isCenter" class="tabbar-center-item">

+ 1 - 0
sheep/ui/su-tabbar/su-tabbar.vue

@@ -1,3 +1,4 @@
+<!-- 底部导航栏 -->
 <template>
   <view class="u-tabbar">
     <view