📖 code review:店铺装修逻辑

pull/29/MERGE
YunaiV 2023-12-19 23:10:50 +08:00
parent f8ea20060f
commit 51c552fb72
30 changed files with 86 additions and 87 deletions

65
App.vue
View File

@ -1,46 +1,39 @@
<script setup>
import {
onLaunch,
onShow,
onError
} from '@dcloudio/uni-app';
import {
ShoproInit
} from './sheep';
import { onLaunch, onShow, onError } from '@dcloudio/uni-app';
import { ShoproInit } from './sheep';
onLaunch(() => {
// 使
uni.hideTabBar();
onLaunch(() => {
// 使
uni.hideTabBar();
// Shopro
ShoproInit();
});
// Shopro
ShoproInit();
});
onError((err) => {
console.log('AppOnError:', err);
});
onError((err) => {
console.log('AppOnError:', err);
});
onShow((options) => {
// #ifdef APP-PLUS
// urlSchemes
const args = plus.runtime.arguments;
if (args) {}
onShow((options) => {
// #ifdef APP-PLUS
// urlSchemes
const args = plus.runtime.arguments;
if (args) {
}
//
uni.getClipboardData({
success: (res) => {},
});
// #endif
//
uni.getClipboardData({
success: (res) => { },
});
// #endif
// #ifdef MP-WEIXIN
//
console.log(options, 'options');
// #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>

View File

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

View File

@ -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);

View File

@ -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({

View File

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

View File

@ -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',
},
];
},
},

View File

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

View File

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

View File

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

View File

@ -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>

View File

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

View File

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

View File

@ -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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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;

View File

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

View File

@ -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"

View File

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

View File

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

View File

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

View File

@ -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 芋艿:待接入

View File

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

View File

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

View File

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

View File

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