Merge branch 'dev' into 'master'

uniapp【优化】: 分享海报以及头部问题

See merge request jianweie/coreshoppro!54
This commit is contained in:
花城
2024-10-24 04:16:19 +00:00
40 changed files with 441 additions and 293 deletions

View File

@@ -3,15 +3,18 @@
import { queryShopConfigV2, queryAppVersions } from '@/core/api';
import type { Response, ShopConfigType } from '@/core/models';
import { useShopConfigStore } from '@/core/store';
/** 获取项目配置 */
const shopConfigStore = useShopConfigStore();
onShow(() => {
console.log('App Show')
})
onHide(() => {
console.log('App Hide')
})
onLaunch(() => {
getShopConfigV2();
/** 版本设置 */
@@ -31,15 +34,11 @@
checkVersion()
// #endif
})
/** 获取项目配置 */
const shopConfigStore = useShopConfigStore();
const getShopConfigV2 = async () => {
const shopConfig : Response<ShopConfigType> = await queryShopConfigV2();
shopConfigStore.setConfig(shopConfig.data);
shopConfigStore.querySystemConfig();
}
const autoUpdate = () => {
/** 获取小程序更新机制兼容 */
if (wx.canIUse('getUpdateManager')) {

View File

@@ -97,7 +97,7 @@
// #endif
// #ifdef MP-ALIPAY
const login : Response<any> = await queryAliPayAppAuthTokenBYCode({ code, });
const login : Response<any> = await queryAliPayAppAuthTokenBYCode({id:code});
// #endif
if (login.status) {

View File

@@ -1,5 +1,6 @@
<template>
<uv-navbar :bgColor="props.bgColor" placeholder :height="menuButtonHeight+'px'">
<uv-navbar :bgColor="props.bgColor" :height="menuButtonHeight+'px'" :placeholder="props.placeholder">
<!-- #ifndef MP-ALIPAY -->
<template #left>
<view class="page-back">
<image v-if="props.isBack" @click="hanlderBack" class="back"
@@ -8,6 +9,7 @@
:style="{ 'color': props.titleColor }">{{ props.title }}</text>
</view>
</template>
<!-- #endif -->
<template v-if="props.mode === 'center'" #center>
<view class="title" :style="{ 'color': props.titleColor }">{{ props.title }}</view>
</template>
@@ -26,13 +28,15 @@
mode : string,
title : string,
handleCustomRouteJump : () => void | null,
placeholder : boolean;
}>(), {
isBack: true,
bgColor: '#EEF3F7',
bgColor: '#eef2f6',
titleColor: '#000',
mode: 'center',
title: '',
handleCustomRouteJump: null,
placeholder: true,
});
const hanlderBack = () => {

View File

@@ -1,23 +1,21 @@
<template>
<view class="layout-page-box page-bg" :style="props.customStyle">
<coreshop-navbar :isBack="props.isBack" :bgColor="props.bgColor" :mode="props.mode" :title="props.title"
:titleColor="props.titleColor" :handleCustomRouteJump="props.handleCustomRouteJump"></coreshop-navbar>
<view class="layout-page-content"
:style="{ ...props.contentStyle }">
<coreshop-navbar :isBack="props.isBack" :bgColor="props.bgColor" :placeholder="props.placeholder"
:mode="props.mode" :title="props.title" :titleColor="props.titleColor"
:handleCustomRouteJump="props.handleCustomRouteJump"></coreshop-navbar>
<view class="layout-page-content" :style="{ ...props.contentStyle }">
<slot></slot>
</view>
<template v-if="props.showLoginModalDom">
<coreshop-login-modal :show="_useLoginStore.showLoginModalTogglePop"
@handleChangePopup="handleChangeLoginPopup" @getUserInfo="_useLoginStore.getUserInfo()"></coreshop-login-modal>
@handleChangePopup="handleChangeLoginPopup"
@getUserInfo="_useLoginStore.getUserInfo()"></coreshop-login-modal>
</template>
</view>
</template>
<script setup lang="ts">
import { useSystemInfo } from '@/core/hooks';
import { useLoginStore } from '@/core/store';
// 获取自定义导航栏高度
const { statusBarHeight } = useSystemInfo();
const _useLoginStore = useLoginStore();
const props = withDefaults(defineProps<{
@@ -31,9 +29,10 @@
contentStyle : any;
handleCustomRouteJump : () => void | null,
showLoginModalDom : boolean;
placeholder : boolean;
}>(), {
isBack: true,
bgColor: '#EEF3F7',
bgColor: '#eef2f6',
titleColor: '#000',
mode: 'center',
title: '',
@@ -41,7 +40,8 @@
customStyle: {},
contentStyle: {},
handleCustomRouteJump: null,
showLoginModalDom: false
showLoginModalDom: false,
placeholder: true,
});
/** 打开获取关闭login弹框 */

View File

@@ -11,6 +11,10 @@
<coreshop-page-content v-bind="props">
<slot name="default" />
</coreshop-page-content>
<template v-if="props.needLoadingPage">
<uv-loading-page :loading="props.loadingPage" :loading-text="props.loadingText"
:font-size="props.loadingTextFontSize" :bgColor="props.loadingBgColor"></uv-loading-page>
</template>
</template>
</template>
<script setup lang="ts">
@@ -26,11 +30,17 @@
handleCustomRouteJump : () => void | null,
showLoginModalDom : boolean;
needSkeleton : boolean;
skeleton ?: Array<object>;
skeleton ?: Array<any>;
skeletonLoading : boolean;
placeholder : boolean;
loadingPage : boolean;
needLoadingPage : boolean;
loadingText : string;
loadingTextFontSize : string;
loadingBgColor : string;
}>(), {
isBack: true,
bgColor: '#D33123',
bgColor: '#eef2f6',
titleColor: '#000',
mode: 'center',
title: '',
@@ -46,7 +56,13 @@
gap: '20rpx',
style: ['width: 200rpx;marginBottom: 50rpx;', 'height: 100rpx;', 'width: 500rpx;'],
}],
skeletonLoading: false
skeletonLoading: false,
placeholder: true,
loadingPage: false,
needLoadingPage: false,
loadingText: '加载中...',
loadingTextFontSize: '24rpx',
loadingBgColor: 'rgba(255, 255, 255, 0.2)'
});
</script>
<style lang="scss" scoped>

View File

@@ -1,6 +1,6 @@
import { defineStore } from 'pinia';
import type { ShopConfigStoreType, ShopConfigType } from '@/core/models';
import type { ShopConfigStoreType, ShopConfigType,Response } from '@/core/models';
import { queryShopConfigV2 } from '@/core/api';
export const useShopConfigStore = defineStore('shopConfig', {
state: () : ShopConfigStoreType => {
return {
@@ -11,6 +11,10 @@ export const useShopConfigStore = defineStore('shopConfig', {
getConfig: state => state.config,
},
actions: {
async querySystemConfig() {
const shopConfig : Response<ShopConfigType> = await queryShopConfigV2();
this.setConfig(shopConfig.data);
},
setConfig(data : ShopConfigType) {
this.config = data;
},

View File

@@ -79,6 +79,7 @@
}
},
"mp-alipay" : {
"appid" : "2021004107611929",
"usingComponents" : true
},
"mp-baidu" : {

View File

@@ -31,7 +31,8 @@
"pages-config/subpackage-storeMap.json",
"pages-config/subpackage-distribution.json",
"pages-config/subpackage-agency.json",
"pages-config/subpackage-merchant.json"
"pages-config/subpackage-merchant.json",
"pages-config/subpackage-custom.json"
],
"preloadRule": "pages-config/preloadRule.json",

View File

@@ -3,7 +3,7 @@
"path": "pages/home/home",
"style": {
"navigationBarTitleText": "首页",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -11,7 +11,7 @@
"path": "pages/cart/cart",
"style": {
"navigationBarTitleText": "购物车",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -19,7 +19,7 @@
"path": "pages/classify/classify",
"style": {
"navigationBarTitleText": "分类",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -35,7 +35,7 @@
"path": "pages/category/category",
"style": {
"navigationBarTitleText": "商品列表",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -43,7 +43,7 @@
"path": "pages/goods/detail",
"style": {
"navigationBarTitleText": "商品详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},

View File

@@ -13,7 +13,7 @@
"path": "pinTuan/detail/detail",
"style": {
"navigationBarTitleText": "拼团详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -29,7 +29,7 @@
"path": "seckill/detail/detail",
"style": {
"navigationBarTitleText": "秒杀详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -45,7 +45,7 @@
"path": "groupBuying/detail/detail",
"style": {
"navigationBarTitleText": "拼团详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -61,7 +61,7 @@
"path": "solitaire/detail/detail",
"style": {
"navigationBarTitleText": "接龙详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},

View File

@@ -0,0 +1,13 @@
{
"subPackages": [{
"root": "pages/subpackage/custom",
"pages": [{
"path": "custom",
"style": {
"navigationBarTitleText": "自定义首页",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}]
}]
}

View File

@@ -45,7 +45,7 @@
"path": "pages/home/home",
"style": {
"navigationBarTitleText": "首页",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -53,7 +53,7 @@
"path": "pages/cart/cart",
"style": {
"navigationBarTitleText": "购物车",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -61,7 +61,7 @@
"path": "pages/classify/classify",
"style": {
"navigationBarTitleText": "分类",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -77,7 +77,7 @@
"path": "pages/category/category",
"style": {
"navigationBarTitleText": "商品列表",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -85,7 +85,7 @@
"path": "pages/goods/detail",
"style": {
"navigationBarTitleText": "商品详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -501,7 +501,7 @@
"path": "pinTuan/detail/detail",
"style": {
"navigationBarTitleText": "拼团详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -517,7 +517,7 @@
"path": "seckill/detail/detail",
"style": {
"navigationBarTitleText": "秒杀详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -533,7 +533,7 @@
"path": "groupBuying/detail/detail",
"style": {
"navigationBarTitleText": "拼团详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -549,7 +549,7 @@
"path": "solitaire/detail/detail",
"style": {
"navigationBarTitleText": "接龙详情",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
@@ -785,10 +785,30 @@
"navigationStyle": "custom"
}
}]
},{
"root": "pages/subpackage/custom",
"pages": [{
"path": "custom",
"style": {
"navigationBarTitleText": "自定义首页",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}]
}],
"preloadRule": {
"pages/member/member": {
"network": "all",
"packages": ["pages/subpackage/member"]
}
},
"condition" : { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [
{
"name": "", //模式名称
"path": "", //启动页面,必选
"query": "" //启动参数在页面的onLoad函数里面得到
}
]
}}

View File

@@ -1,6 +1,7 @@
<template>
<!-- #ifndef MP-ALIPAY -->
<coreshop-navbar :isBack="false" mode="left" title="购物车"> </coreshop-navbar>
<!-- #endif -->
<view class="content-box p-25 page-bg">
<view class="cart-box" v-if="state.cartList.length > 0">
<view class="all-select" :style="{ 'top': `${statusBarHeight}px` }">
@@ -101,12 +102,14 @@
</view>
</view>
</view>
<uv-loading-page :loading="loading" loading-text="加载中..." font-size="24rpx"
bgColor="rgba(255, 255, 255, 0.2)"></uv-loading-page>
</view>
</template>
<script setup lang="ts">
import { reactive, nextTick, computed } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { reactive, nextTick, computed, ref } from 'vue';
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app';
import { handleStaticResources, hanldeShowModal, handleRouteSwitchTab, handleRouteNavigateTo, handleShowToast } from '@/core/utils';
import { queryCartList, deleteGoodsSingle, deleteGoodsSome } from '@/core/api';
import type { Response, CartListType, ShopConfigStoreType } from '@/core/models';
@@ -115,14 +118,14 @@
OpenPointEnum, PointExchangeModelEnum, ShowPointExchangePriceEnum, RouteSwitchTabEnum,
PointsGiveModeEnum, ShowPointsGiveMsgEnum,
} from '@/core/enum';
import { useSystemInfo } from '@/core/hooks';
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
import { UserToken } from '@/core/consts'
// 获取项目配置
const shopConfigStore : ShopConfigStoreType = useShopConfigStore();
// 获取自定义导航栏高度
const { statusBarHeight } = useSystemInfo();
const loading = ref(true);
const state = reactive<{
isManage : boolean,
isAllSelect : boolean,
@@ -139,6 +142,9 @@
pointShowText: "",
})
const handleuGetCartList = useLoadingFn(getCartList, loading);
/** 是否显示积分兑换价格 */
const isShowPointRedemptionPrice = computed(() => {
return shopConfigStore.config.pointSwitch == OpenPointEnum.yes &&
@@ -154,14 +160,24 @@
})
onShow(() => {
state.isManage = true;
if (uni.getStorageSync(UserToken)) {
getCartList();
}
getCart();
})
onPullDownRefresh(async () => {
await getCart();
uni.stopPullDownRefresh();
});
async function getCart() {
state.isManage = true;
if (uni.getStorageSync(UserToken)) {
handleuGetCartList();
}
}
/** 获取购物车数据 */
const getCartList = async () => {
async function getCartList() {
const cartList : Response<any> = await queryCartList({
display: "all",
ids: ""
@@ -310,8 +326,8 @@
/** 去购买 */
const handleGoToBuy = () => {
const ids : Array<number>= state.cartList.filter(x=>x.select).map(x=>x.id);
const ids : Array<number> = state.cartList.filter(x => x.select).map(x => x.id);
if (ids.length > 0) {
handleRouteNavigateTo(`/pages/order/submit/submit?cartIds=${ids.join(',')}`)
} else {

View File

@@ -1,14 +1,15 @@
<template>
<view class="layout-classify-page">
<uv-navbar bgColor="#fff">
<uv-navbar bgColor="#fff" :height="`${menuButtonHeight}px`">
<template #left>
<view class="search-box">
<image @click="hanlderBack" class="back" :src="handleStaticResources('/static/images/back.png')">
</image>
<uv-input shape="circle" :placeholder="state.pageTitle ? state.pageTitle :`请输入关键词`"
prefixIcon="search" v-model="state.searchKey" :customStyle="{ 'background-color': '#fff','padding':'3px 9px' }"
@confirm="handleSearch" prefixIconStyle="font-size: 22px;color: #909399">
prefixIcon="search" v-model="state.searchKey"
:customStyle="{ 'background-color': '#fff','padding':'3px 9px' }" @confirm="handleSearch"
prefixIconStyle="font-size: 22px;color: #909399">
<template #suffix>
<view class="search-tit" @click="handleSearch">搜索</view>
</template>
@@ -114,12 +115,14 @@
</view>
</view>
</view>
<uv-loading-page :loading="loading" loading-text="加载中..." font-size="24rpx"
bgColor="rgba(255, 255, 255, 0.2)"></uv-loading-page>
</view>
</template>
<script setup lang="ts">
import { reactive } from 'vue';
import { useSystemInfo } from '@/core/hooks';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue';
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import { handleStaticResources, handleShowToast, splitArrayByStep } from '@/core/utils';
import type { Response, GoodsType, GoodsListType } from '@/core/models';
import { queryGoodsPageList } from '@/core/api';
@@ -143,8 +146,8 @@
}
// 获取自定义导航栏高度
const { statusBarHeight } = useSystemInfo();
const { statusBarHeight, menuButtonHeight } = useSystemInfo();
const loading = ref(true);
const state = reactive<{
searchKey : string;
page : number;
@@ -216,6 +219,10 @@
pageTitle: "",
})
let queryParams : QueryParams
const handleuQueryProduct = useLoadingFn(handleQueryData, loading);
onReachBottom(() => {
if (state.totalPages > state.page) {
state.page++;
@@ -225,12 +232,20 @@
onLoad((query : QueryParams) => {
queryParams = query;
/** 处理 query 然后获取商品列表 */
handleQueryData(query);
handleuQueryProduct(query);
});
onPullDownRefresh(async () => {
state.page = 1;
state.totalPages = 1;
await handleuQueryProduct(queryParams);
uni.stopPullDownRefresh();
});
/** 处理 options */
const handleQueryData = (options : QueryParams) => {
async function handleQueryData(options : QueryParams) {
let where : any = {};
if (options?.id) {
where.catId = options?.id;
@@ -263,15 +278,11 @@
where.labelId = options.labelId;
}
state.where = where;
getGoodsPageList();
await getGoodsPageList();
}
/** 获取商品列表数据 */
const getGoodsPageList = async () => {
uni.showLoading({
title: '加载中'
});
let order : Array<string> = [];
if (state.sortVal) {
order.push(`sort ${state.sortVal}`)
@@ -306,7 +317,6 @@
let list = splitArrayByStep(goodsPageList.data.list, 2);
state.goodsList[0] = state.goodsList[0].concat(list[0]);
state.goodsList[1] = state.goodsList[1].concat(list[1]);
uni.hideLoading();
}
/** 点击筛选 */

View File

@@ -1,7 +1,6 @@
.layout-classify {
position: relative;
}
.big-classify {
display: flex;
align-items: center;

View File

@@ -225,19 +225,16 @@
})
nextTick(async () => {
state.bigClassifyH = ((await getDomInfo('.big-classify', instance.proxy)) as { height : number }).height;
state.bigClassifyH = ((await getDomInfo('.big-classify', instance.proxy)) as { height : number }).height;
setTimeout(async () => {
state.rightTabH = ((await getDomInfo('.right-tab-box', instance.proxy)) as { height : number }).height;
state.rightTabH = ((await getDomInfo('.right-tab-box', instance.proxy)) as { height : number }).height;
}, 100)
})
})
// 获取商品列表数据
const getGoodsPageList = async () => {
uni.showLoading({
title: '加载中'
});
const goodsPageList : Response<GoodsListType> = await queryGoodsPageList({
page: state.page,
limit: 10,
@@ -247,7 +244,6 @@
state.totalPages = goodsPageList.data?.totalPages;
state.goodsList = state.goodsList.concat(goodsPageList.data?.list);
}
uni.hideLoading();
}
/** 获取购物车数量和价格 */

View File

@@ -1,7 +1,7 @@
.classify-box {
max-width: 750rpx;
position: relative;
display: flex;
display: flex;
justify-content: space-between;
.classify-left {
@@ -60,8 +60,13 @@
width: 550rpx;
padding: 20rpx 0;
}
.right-data-list{
position: relative;
flex: 1;
}
.scroll-view {
position: absolute;
height: 100%;
padding: 0 20rpx 0;
width: calc(100% - 40rpx);

View File

@@ -13,43 +13,43 @@
<view class="right-tab-box">
<coreshop-tabs :list="state.rightTabList" @hanldeClickTab="hanldeChangeRightTab"></coreshop-tabs>
</view>
<scroll-view class="scroll-view" :style="{ 'height': `${props.height - 50}px` }" :scroll-y="true"
@scrolltolower="handleScrolltolower">
<view class="advert-box radius-15">
<coreshop-advert :code="advertPosition.goodsClassifyBanner"></coreshop-advert>
</view>
<view class="data-box" v-if="state.goodsList.length > 0">
<view class="item-box" v-for="item in state.goodsList" :key="item.id">
<coreshop-goods-card imgWidth="150rpx" imgHeight="150rpx"
:goodsData="hanldeCombinationGoodsData(item)" @hanldeClickGoods="hanldeClickGoods">
<template #goodPrice>
<view class="price-msg">
<view class="price-box">
<view class="price">
<text class="symbol"></text>
<text class="num">{{ item.price }}</text>
<view class="right-data-list">
<scroll-view class="scroll-view" :scroll-y="true" @scrolltolower="handleScrolltolower">
<view class="advert-box radius-15">
<coreshop-advert :code="advertPosition.goodsClassifyBanner"></coreshop-advert>
</view>
<view class="data-box" v-if="state.goodsList.length > 0">
<view class="item-box" v-for="item in state.goodsList" :key="item.id">
<coreshop-goods-card imgWidth="150rpx" imgHeight="150rpx"
:goodsData="hanldeCombinationGoodsData(item)" @hanldeClickGoods="hanldeClickGoods">
<template #goodPrice>
<view class="price-msg">
<view class="price-box">
<view class="price">
<text class="symbol"></text>
<text class="num">{{ item.price }}</text>
</view>
<view class="underlin-price">{{ item.mktprice }}</view>
</view>
<view class="btn" @click="handleSelectSku(item.id)">
<image class="img" :src="handleStaticResources('/static/images/cart.png')">
</image>
</view>
<view class="underlin-price">{{ item.mktprice }}</view>
</view>
<view class="btn" @click="handleSelectSku(item.id)">
<image class="img" :src="handleStaticResources('/static/images/cart.png')">
</image>
</view>
</view>
</template>
</coreshop-goods-card>
</template>
</coreshop-goods-card>
</view>
<view class="no-more">
<uv-divider :dashed="true"
:text="state.totalPages > state.page ? '下滑加载更多' : '没有更多了'"></uv-divider>
</view>
</view>
<view class="no-more">
<uv-divider :dashed="true"
:text="state.totalPages > state.page ? '下滑加载更多' : '没有更多了'"></uv-divider>
<view v-else>
<coreshop-empty></coreshop-empty>
</view>
</view>
<view v-else>
<coreshop-empty></coreshop-empty>
</view>
</scroll-view>
</scroll-view>
</view>
</view>
<view class="shopping-box">
<view class="shopping-Bag">
<view class="bag-box">
@@ -75,8 +75,7 @@
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { onMounted, reactive, ref, watch, nextTick } from 'vue';
import { UserToken, advertPosition, onClassifyPageHide } from '@/core/consts';
import { queryGoodsPageList, queryCartNumAndMoney, queryGoodsDetailByToken, queryGoodsDetail, queryAddCart } from '@/core/api';
import type { CategoriesType, Response, GoodsListType, GoodsType } from '@/core/models';
@@ -147,7 +146,7 @@
}
})
onShow(() => {
onMounted(() => {
if (uni.getStorageSync(UserToken)) {
getCartNumAndMoney();
}
@@ -159,9 +158,7 @@
/** 获取商品列表数据 */
const getGoodsPageList = async () => {
uni.showLoading({
title: '加载中'
});
const goodsPageList : Response<GoodsListType> = await queryGoodsPageList({
page: state.page,
limit: 10,
@@ -171,7 +168,6 @@
state.totalPages = goodsPageList.data?.totalPages;
state.goodsList = state.goodsList.concat(goodsPageList.data?.list);
}
uni.hideLoading();
}
/** 获取购物车数量和价格 */

View File

@@ -4,6 +4,7 @@
display: flex;
align-items: center;
justify-content: space-between;
max-width: 500rpx;
.page-name {
font-size: 32rpx;
margin-right: 20rpx;

View File

@@ -1,7 +1,9 @@
<template>
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom
needLoadingPage :loadingPage="loading">
<view class="layout-classify-page">
<uv-navbar bgColor="#EEF3F7">
<!-- #ifndef MP-ALIPAY -->
<uv-navbar bgColor="#EEF3F7" :height="menuButtonHeight+'px'">
<template #left>
<view class="search-box">
<view class="page-name">分类</view>
@@ -15,7 +17,7 @@
</view>
</template>
</uv-navbar>
<!-- #endif -->
<view class="content-box" :style="{'height': `${state.height}px` }">
<classifyOne v-if="shopConfigStore.config.cateStyle == GoodsListEnum.one" :data="state.categoriesList">
</classifyOne>
@@ -36,8 +38,8 @@
</template>
<script setup lang="ts">
import { onMounted, reactive, nextTick } from 'vue';
import { onHide } from '@dcloudio/uni-app';
import { onMounted, reactive, nextTick, watchEffect, ref } from 'vue';
import { onHide, onPullDownRefresh } from '@dcloudio/uni-app';
import { useShopConfigStore } from '@/core/store';
import { queryAllCategories } from '@/core/api';
import { GoodsListEnum } from '@/core/enum';
@@ -49,13 +51,14 @@
import classifyThree from './classify-page/classify-three/classify-three.vue';
import classifyFour from './classify-page/classify-four/classify-four.vue';
import classifyFive from './classify-page/classify-five/classify-five.vue';
import { useSystemInfo } from '@/core/hooks';
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
// 获取项目配置
const shopConfigStore : ShopConfigStoreType = useShopConfigStore();
// 获取自定义导航栏高度
const { statusBarHeight, systemInfo } = useSystemInfo();
const { statusBarHeight, systemInfo, menuButtonHeight } = useSystemInfo();
const loading = ref(true);
const state = reactive<{
categoriesList : Array<CategoriesType>,
@@ -67,12 +70,15 @@
keyWord: "",
})
const handleuAllCategories = useLoadingFn(getAllCategories, loading);
onMounted(async () => {
getAllCategories();
nextTick(() => {
// 屏幕总高度 - 顶部tab栏高度 - 顶部安全高度 - 底部安全高度 - 底部tabBar的默认高度50如果修改了配置高度这里也要同步修改
state.height = systemInfo.value.screenHeight - systemInfo.value.statusBarHeight - (systemInfo.value.system?.includes('iOS') ? 44 : 48) - systemInfo.value.safeAreaInsets?.bottom - 50;
})
handleuAllCategories();
})
watchEffect(() => {
state.height = systemInfo.value.screenHeight - statusBarHeight.value - systemInfo.value.safeAreaInsets?.bottom - 50;
})
onHide(() => {
@@ -80,8 +86,14 @@
uni.$emit(onClassifyPageHide);
});
onPullDownRefresh(async () => {
await handleuAllCategories()
uni.stopPullDownRefresh();
});
/** 获取购物车数量价格 */
const getAllCategories = async () => {
async function getAllCategories() {
const allCategories : Response<Array<CategoriesType>> = await queryAllCategories();
state.categoriesList = allCategories.data || [];
}

View File

@@ -8,7 +8,7 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
import { handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,

View File

@@ -1,11 +1,12 @@
<template>
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
<view class=" goods-detail" :style="{ 'margin-top': `-${statusBarHeight}px` }">
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" :placeholder="false" showLoginModalDom
needLoadingPage :loadingPage="loading">
<view class="goods-detail">
<!-- 商品详情 -->
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
:swiperBanner="state.swiperBanner" :goodsDetailContent="state.goodsDetailContent"
:userAgentGrade="state.userAgentGrade" :agentProductsList="state.agentProductsList"
:goodsPromotionList="state.goodsPromotionList" :spesDesc="state.spesDesc"
:goodsPromotionList="state.goodsPromotionList" :spesDesc="state.spesDesc" :shareType="ShareEnum.goods"
@hanldeShowGoodSku="hanldeShowGoodSku">
</GoodsDetail>
@@ -25,8 +26,8 @@
</template>
<script setup lang="ts">
import { reactive } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline, onPullDownRefresh } from '@dcloudio/uni-app';
import { queryGoodsDetail, queryCartNum, queryGoodsDetailByToken, queryPromotionList, queryAddCart } from '@/core/api';
import type { Response, GoodsAgentListType, GoodsPromotionType, GoodsSkuListType } from "@/core/models";
import { PromotionEnum, AddCartEnum, PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
@@ -38,7 +39,7 @@
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
import { useLoginStore } from '@/core/store';
import { useSystemInfo } from '@/core/hooks';
import { useLoadingFn } from '@/core/hooks';
interface QueryParams {
id : number;
@@ -50,8 +51,6 @@
/** 购物车store */
const _useCartStore = useCartStore();
const { statusBarHeight } = useSystemInfo();
const state = reactive<{
goodsDetailData : any;
swiperBanner : Array<string>;
@@ -74,17 +73,32 @@
showSku: false,
skuPrice: 0,
shareUrl: "",
})
});
const loading = ref(true);
let productId : number;
const handleuGetGoodsDetail = useLoadingFn(getGoodsDetail, loading);
onLoad((query : QueryParams) => {
productId = Number(query.id);
getGoodsDetailWithPromotionList();
});
onPullDownRefresh(async () => {
await getGoodsDetailWithPromotionList();
uni.stopPullDownRefresh();
});
async function getGoodsDetailWithPromotionList() {
/** 获取商品详情 */
getGoodsDetail(Number(query.id));
handleuGetGoodsDetail(productId);
/** 获取商品促销列表 */
getPromotionList();
})
}
/** 获取商品详情 */
const getGoodsDetail = async (id : number) => {
async function getGoodsDetail(id : number) {
let goodsDetail : any = null;
if (uni.getStorageSync(UserToken)) {
goodsDetail = await queryGoodsDetailByToken({
@@ -123,19 +137,19 @@
return item;
});
}
/** 获取分享url */
state.shareUrl = await getShareUrl({
client: ShareClientEnum.wxMiNiProgram,
url: shareUrl,
type: ShareModelEnum.url,
page: ShareEnum.goods,
params: { goodsId: goodsDetail.data.id, }
params: { goodsId: goodsDetail.data.id, }
})
/** 如果用户登录,获取购物车数量 */
if (uni.getStorageSync(UserToken)) {
getCartNum();
await getCartNum();
}
}

View File

@@ -1,17 +1,20 @@
<template>
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom
needLoadingPage :loadingPage="loading">
<view class="layout-home-page page-bg">
<image class="home-bg" :src="handleStaticResources('/static/images/home-bg.jpg')"></image>
<uv-navbar :title="shopConfigStore.config?.shopName"
:bg-color="state.isScrollTop ? handleStaticResources('/static/images/home-bg.jpg') : 'rgba(0,0,0,0)'"
imgMode="aspectFill" :titleStyle="{'color':'#fff','font-size':'32rpx'}">
<!-- #ifndef MP-ALIPAY -->
<template #left>
<uv-icon name="search" size="22" color="#fff" @click="handleSearch"></uv-icon>
</template>
<!-- #endif -->
</uv-navbar>
<view class="content-box p-25">
<CustomPage ref="homePage" :coreshopData="state.coreshopData"></CustomPage>
<CustomPage :coreshopData="state.coreshopData"></CustomPage>
</view>
<!-- 备案信息 -->
@@ -25,13 +28,13 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue';
import { onPageScroll, onShow, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { onPageScroll, onShow, onShareAppMessage, onShareTimeline, onPullDownRefresh } from '@dcloudio/uni-app';
import { queryPageConfig, queryUserInfo } from '@/core/api';
import type { Response, PageConfigType, PageConfigItemsType, UserInfoType } from '@/core/models';
import CustomPage from '@/pages/components/custom-page/index.vue';
import HomeAdpop from '@/pages/components/custom-page/components/home-adpop/home-adpop.vue';
import { handleStaticResources, handleRouteNavigateTo, getShareUrl, getDefaultShareData } from '@/core/utils';
import { useSystemInfo, useLoadingFn } from '@/core/hooks';
import { useLoadingFn } from '@/core/hooks';
import { UserToken, onHomePageShow, shareUrl } from '@/core/consts';
import { useUserInfoStore, useShopConfigStore } from '@/core/store';
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
@@ -39,9 +42,6 @@
/** 获取项目配置 */
const shopConfigStore = useShopConfigStore();
/** 获取自定义导航栏高度 */
const { statusBarHeight } = useSystemInfo();
/** 获取 用户数据 */
const userInfoStore = useUserInfoStore();
@@ -65,8 +65,16 @@
/** 触发自定义onshow事件让后代组件监听页面是都进入 */
uni.$emit(onHomePageShow);
})
onPullDownRefresh(async () => {
await queryHomePageConfig();
uni.stopPullDownRefresh();
});
onMounted(async () => {
queryHomePageConfig();
})
const queryHomePageConfig = async () => {
handleuQueryPageConfig()
if (uni.getStorageSync(UserToken)) {
getUserInfo();
@@ -77,8 +85,9 @@
url: shareUrl,
type: ShareModelEnum.url,
page: ShareEnum.index,
})
})
});
shopConfigStore.querySystemConfig();
}
async function getPageConfig() {
const pageConfig : Response<PageConfigType> = await queryPageConfig({ code: 'mobile_home' });

View File

@@ -1,17 +1,17 @@
.member-head{
.member-head {
position: relative;
.memeber-bg{
.memeber-bg {
display: block;
width: 100%;
height: 400rpx;
width: 100%;
height: 600rpx;
}
}
.head-box {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
position: absolute;
bottom: 12rpx;
left: 0;
width: 100%;
.user-info {
display: flex;
align-items: center;
@@ -82,9 +82,9 @@
}
}
}
.member-box {
.member-content {
width: 88%;
.member-box {
.member-content {
width: 88%;
margin: auto;
display: flex;
align-items: center;

View File

@@ -1,7 +1,7 @@
<template>
<coreshop-page :title=" userInfoStore.userInfo?.nickName || ''" titleColor="#fff"
mode="left" bgColor="#d33123" :isShowStatusBarHeight="false"
:isBack="false" showLoginModalDom>
<coreshop-page :title="state.isScrollToTop ? '' :userInfoStore.userInfo?.nickName" :placeholder="false"
titleColor="#fff" mode="left" bgColor="#d33123" :isShowStatusBarHeight="false" :isBack="false"
showLoginModalDom>
<view class="layout-member-page">
<view class="member-head">
<image class="memeber-bg" src="/static/images/member/bg.png"></image>
@@ -164,8 +164,8 @@
<script setup lang="ts">
import { reactive } from 'vue';
import { onPageScroll, onShow ,onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { handleStaticResources, handleRouteNavigateTo, handleShowToast, handleRouteSwitchTab, hanldeShowModal ,getDefaultShareData} from '@/core/utils';
import { onPageScroll, onShow, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { handleStaticResources, handleRouteNavigateTo, handleShowToast, handleRouteSwitchTab, hanldeShowModal, getDefaultShareData } from '@/core/utils';
import { queryUserInfo, queryOrderStatusNum, queryUserIsClerk, queryDistributionInfo, queryAgentInfo, queryShopConfigV2 } from '@/core/api';
import type { Response, MemberOrderType, UserInfoType, UserIsClerkType, MemberServiceType, ShopConfigType } from '@/core/models';
import { useShopConfigStore, useUserInfoStore, useLoginStore } from '@/core/store';
@@ -322,7 +322,7 @@
handleRouteSwitchTab(RouteSwitchTabEnum.home)
}, 1000)
})
}
}
}
/** 注销登录 */
@@ -335,9 +335,9 @@
userInfoStore.setUserInfo({});
handleRouteSwitchTab(RouteSwitchTabEnum.home)
}
})
})
}
/** 分享 */
onShareAppMessage(() => {
return {

View File

@@ -49,7 +49,11 @@
break;
/** 店铺邀请*/
case ShareEnum.inv:
/** 有待补充 */
if (shareData.data?.params?.store) {
handleRouteRedirectTo(`/pages/subpackage/distribution/store/index?store=${shareData.data?.params?.store}`)
} else {
handleRouteSwitchTab();
}
break;
/** 文章页面 */
case ShareEnum.article:
@@ -101,7 +105,11 @@
break;
/** 代理商*/
case ShareEnum.agent:
/** 有待补充 */
if (shareData.data?.params?.store) {
handleRouteRedirectTo(`/pages/subpackage/agency/store/index?store=${shareData.data?.params?.store}`)
} else {
handleRouteSwitchTab();
}
break;
/** 接龙*/
case ShareEnum.solitaire:

View File

@@ -42,3 +42,9 @@
font-size: 28rpx;
}
}
.tip-box{
padding: 20rpx 50rpx;
font-size: 24rpx;
color: #aaa;
}

View File

@@ -53,7 +53,9 @@
</lpainterView>
</lpainterView>
</LPainter>
<view class="tip-box" v-if="state.imgSrc">
如果您下载失败或者以前拒绝过弹出的授权相册提醒请点击右上角三个点进入设置页面开启添加到相册功能
</view>
<view class="btn-box">
<view class="btn">
<view class="back" @click="handlenNavigateBack">返回上一页</view>
@@ -345,28 +347,19 @@
})
// #endif
// #ifdef MP
// #ifdef MP
uni.authorize({
scope: 'scope.writePhotosAlbum',
success() {
// 先下载到本地
uni.downloadFile({
url: state.imgSrc,
success(res : any) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success() {
handleShowToast('保存成功', 'success');
},
fail() {
handleShowToast('图片保存失败', 'error');
}
});
uni.saveImageToPhotosAlbum({
filePath: state.imgSrc,
success() {
handleShowToast('保存成功', 'success');
},
fail() {
handleShowToast('下载失败', 'error');
handleShowToast('图片保存失败', 'error');
}
})
});
}
})
// #endif

View File

@@ -1,6 +1,7 @@
<template>
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
<view class="goods-detail" :style="{ 'margin-top': `-${statusBarHeight}px` }">
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" :placeholder="false" showLoginModalDom
needLoadingPage :loadingPage="loadingPage">
<view class="goods-detail">
<!-- 商品详情 -->
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
:swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
@@ -62,7 +63,7 @@
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { onLoad, onShareAppMessage, onShareTimeline, onPullDownRefresh } from '@dcloudio/uni-app';
import { queryActivityDetial, queryCartNum, queryAddCart } from '@/core/api';
import { PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
import type { Response } from '@/core/models';
@@ -73,7 +74,7 @@
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
import GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
import { useLoadingFn } from '@/core/hooks';
interface QueryParams {
id : number;
}
@@ -84,8 +85,6 @@
/** 购物车store */
const cartStore = useCartStore();
const { statusBarHeight } = useSystemInfo();
const state = reactive<{
goodsDetailData : any,
swiperBanner : Array<string>;
@@ -119,15 +118,22 @@
});
const loading = ref(false);
const handleBuyNow = useLoadingFn(onBuyNow, loading)
const loadingPage = ref(true);
const handleBuyNow = useLoadingFn(onBuyNow, loading);
const handleGetGoodsDetail = useLoadingFn(getGoodsDetail, loadingPage);
onLoad((query : QueryParams) => {
state.id = Number(query.id);
/** 获取商品详情 */
getGoodsDetail();
})
handleGetGoodsDetail();
});
const getGoodsDetail = async () => {
onPullDownRefresh(async () => {
await handleGetGoodsDetail();
uni.stopPullDownRefresh();
});
async function getGoodsDetail() {
let data = {
id: state.id,
type: PaymentTypeEnum.group,

View File

@@ -1,6 +1,7 @@
<template>
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
<view class="goods-detail" :style="{ 'margin-top': `-${statusBarHeight}px` }">
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" :placeholder="false" showLoginModalDom
needLoadingPage :loadingPage="loadingPage">
<view class="goods-detail">
<!-- 商品详情 -->
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
:swiperBanner="state.swiperBanner" :shareType="ShareEnum.pinTuan"
@@ -62,28 +63,28 @@
<!-- 商品sku弹框 -->
<GoodsDetailSkuPopup :showSku="state.showSku" :goodsDetailData="state.goodsDetailData"
:isShowAddCartBtn="false" :buyNowNowloading="loading" @handleChangePopup="handleChangePopup" @handleBuyNow="handleBuyNow"
:btnBuyTitlt="state.btnBuyTitlt">
:isShowAddCartBtn="false" :buyNowNowloading="loading" @handleChangePopup="handleChangePopup"
@handleBuyNow="handleBuyNow" :btnBuyTitlt="state.btnBuyTitlt">
</GoodsDetailSkuPopup>
</view>
</coreshop-page>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { onLoad ,onShareAppMessage,onShareTimeline} from '@dcloudio/uni-app';
import { onLoad, onShareAppMessage, onShareTimeline, onPullDownRefresh } from '@dcloudio/uni-app';
import { queryPinTuanGoodsDetail, queryCartNum, queryAddCart, queryOrderPinTuanTeamInfo } from '@/core/api';
import type { Response } from '@/core/models';
import { UserToken,shareUrl } from '@/core/consts'
import { UserToken, shareUrl } from '@/core/consts'
import { useCartStore, useLoginStore } from '@/core/store';
import { PaymentTypeEnum, ShareEnum,ShareClientEnum,ShareModelEnum } from '@/core/enum';
import { handleRouteNavigateTo, handleShowToast ,getShareUrl} from '@/core/utils';
import { PaymentTypeEnum, ShareEnum, ShareClientEnum, ShareModelEnum } from '@/core/enum';
import { handleRouteNavigateTo, handleShowToast, getShareUrl } from '@/core/utils';
import { deepClone } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
import GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
import { useLoadingFn,useSystemInfo } from '@/core/hooks';
import { useLoadingFn } from '@/core/hooks';
interface QueryParams {
id : number;
@@ -95,8 +96,6 @@
/** 获取购物车数据 */
const cartStore = useCartStore();
const { statusBarHeight } = useSystemInfo();
const state = reactive<{
id : number;
@@ -111,7 +110,7 @@
isSingleBuy : boolean;
btnBuyTitlt : string;
teamInfo : any;
shareUrl:string;
shareUrl : string;
}>({
id: 0,
goodsDetailData: {},
@@ -125,11 +124,13 @@
isSingleBuy: true,
btnBuyTitlt: "发起拼团",
teamInfo: {},
shareUrl:"",
shareUrl: "",
});
const loading = ref(false);
const handleBuyNow = useLoadingFn(onBuyNow, loading)
const loadingPage = ref(true);
const handleBuyNow = useLoadingFn(onBuyNow, loading);
const handleGetGoodsDetail = useLoadingFn(getGoodsDetail, loadingPage);
onLoad((query : QueryParams) => {
if (query?.teamId) {
@@ -141,10 +142,15 @@
}
/** 获取商品详情 */
state.id = Number(query.id);
getGoodsDetail();
})
handleGetGoodsDetail();
});
const getGoodsDetail = async () => {
onPullDownRefresh(async () => {
await handleGetGoodsDetail();
uni.stopPullDownRefresh();
});
async function getGoodsDetail() {
let data = {
id: state.id,
data: true,
@@ -177,7 +183,6 @@
if (uni.getStorageSync(UserToken)) {
getCartNum();
}
state.shareUrl = await getShareUrl({
client: ShareClientEnum.wxMiNiProgram,
url: shareUrl,

View File

@@ -1,6 +1,7 @@
<template>
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
<view class="goods-detail" :style="{ 'margin-top': `-${statusBarHeight}px` }">
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" :placeholder="false" showLoginModalDom
needLoadingPage :loadingPage="loadingPage">
<view class="goods-detail">
<!-- 商品详情 -->
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
:swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
@@ -61,8 +62,8 @@
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { queryActivityDetial, queryCartNum, queryShare, queryAddCart } from '@/core/api';
import { onLoad, onShareAppMessage, onShareTimeline, onPullDownRefresh } from '@dcloudio/uni-app';
import { queryActivityDetial, queryCartNum, queryAddCart } from '@/core/api';
import { PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
import type { Response } from '@/core/models';
import { UserToken, shareUrl } from '@/core/consts'
@@ -73,7 +74,7 @@
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
import GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
import { useLoadingFn } from '@/core/hooks';
interface QueryParams {
id : number;
@@ -83,8 +84,6 @@
const _useLoginStore = useLoginStore();
const cartStore = useCartStore();
const { statusBarHeight } = useSystemInfo();
const state = reactive<{
goodsDetailData : any,
@@ -119,15 +118,22 @@
});
const loading = ref(false);
const handleSeckillNow = useLoadingFn(onSeckillNow, loading)
const loadingPage = ref(true);
const handleSeckillNow = useLoadingFn(onSeckillNow, loading);
const handleGetGoodsDetail = useLoadingFn(getGoodsDetail, loadingPage);
onLoad((query : QueryParams) => {
state.id = Number(query.id);
/** 获取商品详情 */
getGoodsDetail();
})
handleGetGoodsDetail();
});
const getGoodsDetail = async () => {
onPullDownRefresh(async () => {
await handleGetGoodsDetail();
uni.stopPullDownRefresh();
});
async function getGoodsDetail() {
let data = {
id: state.id,
type: PaymentTypeEnum.seckill,
@@ -152,7 +158,7 @@
state.spesDesc = goodsDetail?.data?.product?.spesDesc;
/** 如果用户登录,获取购物车数量 */
if (uni.getStorageSync(UserToken)) {
getCartNum();
await getCartNum();
}
state.shareUrl = await getShareUrl({

View File

@@ -9,7 +9,7 @@
display: flex;
align-items: center;
justify-content: space-between;
z-index: 99;
.item {
position: relative;
width: 33.33%;

View File

@@ -1,5 +1,6 @@
<template>
<coreshop-page title="接龙详情" mode="left" bgColor="#D33123" titleColor="#fff" showLoginModalDom>
<coreshop-page title="接龙详情" mode="left" bgColor="#D33123" titleColor="#fff" showLoginModalDom needLoadingPage
:loadingPage="loadingPage">
<view class="layout-solitaire-box">
<view class="config-box">
<image class="img" :src="shopConfigStore?.config?.shopLogo"></image>
@@ -96,8 +97,8 @@
</coreshop-page>
</template>
<script setup lang="ts">
import { reactive } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline, onPullDownRefresh } from '@dcloudio/uni-app';
import { querySolitaireDetail, queryShare, queryAddCart, queryRemoveCart } from '@/core/api';
import { ShareClientEnum, ShareModelEnum, ShareEnum, EmptyEnum, PaymentTypeEnum, AddCartEnum } from '@/core/enum';
import type { Response } from '@/core/models';
@@ -106,6 +107,7 @@
import { handleShowToast, handleRouteNavigateTo, getShareUrl } from '@/core/utils';
import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
import CoreshopShare from '@/components/coreshop-share/coreshop-share.vue';
import { useLoadingFn } from '@/core/hooks';
interface QueryParams {
id : number;
@@ -135,13 +137,21 @@
showShare: false,
});
const loadingPage = ref(true);
const handleGetGoodsDetail = useLoadingFn(getGoodsDetail, loadingPage);
onLoad((query : QueryParams) => {
state.id = Number(query.id);
/** 获取商品详情 */
getGoodsDetail();
})
handleGetGoodsDetail();
});
const getGoodsDetail = async () => {
onPullDownRefresh(async () => {
await handleGetGoodsDetail();
uni.stopPullDownRefresh();
});
async function getGoodsDetail() {
const solitaireData : Response<any> = await querySolitaireDetail({ id: state.id });
if (solitaireData.status) {
state.solitaireInfo = solitaireData.data.model;

View File

@@ -1,46 +1,46 @@
<template>
<view class="layout-home-page page-bg">
<image class="home-bg" :src="handleStaticResources('/static/images/home-bg.jpg')"></image>
<uv-navbar :bg-color="state.isScrollTop ? handleStaticResources('/static/images/home-bg.jpg') : 'rgba(0,0,0,0)'"
imgMode="aspectFill">
<template #left>
<view class="search-box">
<image class="logo" :src="handleStaticResources('/static/images/home-logo.png')"></image>
<uv-input shape="circle" placeholder="请输入关键词" prefixIcon="search"
:customStyle="{ 'background-color': '#fff' }" prefixIconStyle="font-size: 22px;color: #909399">
<template #suffix>
<view class="search-tit">搜索</view>
</template>
</uv-input>
</view>
</template>
</uv-navbar>
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
<view class="layout-home-page page-bg">
<image class="home-bg" :src="handleStaticResources('/static/images/home-bg.jpg')"></image>
<uv-navbar
:bg-color="state.isScrollTop ? handleStaticResources('/static/images/home-bg.jpg') : 'rgba(0,0,0,0)'"
imgMode="aspectFill">
<template #left>
<view class="search-box">
<image class="logo" :src="handleStaticResources('/static/images/home-logo.png')"></image>
<uv-input shape="circle" placeholder="请输入关键词" prefixIcon="search"
:customStyle="{ 'background-color': '#fff' }"
prefixIconStyle="font-size: 22px;color: #909399">
<template #suffix>
<view class="search-tit">搜索</view>
</template>
</uv-input>
</view>
</template>
</uv-navbar>
<view class="content-box p-25" :style="{ 'padding-top': `${statusBarHeight + 10}px` }">
<CustomPage :coreshopData="state.coreshopData"></CustomPage>
<view class="content-box p-25">
<CustomPage :coreshopData="state.coreshopData"></CustomPage>
</view>
<!-- 备案信息 -->
<coreshop-copyright></coreshop-copyright>
<!-- 弹框广告 -->
<HomeAdpop></HomeAdpop>
</view>
<!-- 备案信息 -->
<coreshop-copyright></coreshop-copyright>
<!-- 弹框广告 -->
<HomeAdpop></HomeAdpop>
<!-- 登录弹框 -->
<coreshop-login-modal></coreshop-login-modal>
</view>
</coreshop-page>
</template>
<script setup lang="ts">
import { onPageScroll, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { onShow, onPageScroll, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { reactive } from 'vue';
import { queryPageConfig, queryUserInfo } from '@/core/api';
import type { Response, PageConfigType, PageConfigItemsType, UserInfoType } from '@/core/models';
import CustomPage from '@/pages/components/custom-page/index.vue';
import HomeAdpop from '@/pages/components/custom-page/components/home-adpop/home-adpop.vue';
import { handleStaticResources, getDefaultShareData, getShareUrl } from '@/core/utils';
import { useSystemInfo } from '@/core/hooks';
import { UserToken, shareUrl } from '@/core/consts';
import { UserToken, shareUrl, onHomePageShow } from '@/core/consts';
import { useUserInfoStore } from '@/core/store';
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
@@ -48,8 +48,6 @@
code : string;
}
/** 获取自定义导航栏高度 */
const { statusBarHeight } = useSystemInfo();
/** 获取 用户数据 */
const userInfoStore = useUserInfoStore();
@@ -63,12 +61,13 @@
shareUrl: "",
})
onShow(() => {
/** 触发自定义onshow事件让后代组件监听页面是都进入 */
uni.$emit(onHomePageShow);
})
onPageScroll((e : any) => {
if (e.scrollTop > 10) {
state.isScrollTop = true;
} else {
state.isScrollTop = false;
}
state.isScrollTop = e.scrollTop > 10;
})
onLoad(async (query : QueryParams) => {

View File

@@ -78,7 +78,7 @@
import { reactive } from 'vue';
import { onLoad, onReachBottom, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { queryDistributionStoreInfo, queryShare, queryGoodsPageList } from '@/core/api';
import { handleStaticResources, splitArrayByStep, handleShowToast, handleRouteNavigateTo } from '@/core/utils';
import { handleStaticResources, splitArrayByStep, handleShowToast, handleRouteNavigateTo, getShareUrl } from '@/core/utils';
import type { Response, GoodsType } from '@/core/models';
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
import { shareUrl, UserToken } from '@/core/consts';

View File

@@ -64,7 +64,8 @@
import { useShopConfigStore } from '@/core/store';
import { handleShowToast } from '@/core/utils';
import { useLoadingFn } from '@/core/hooks';
import { mobile } from '@/uni_modules/uv-ui-tools/libs/function/test.js';
interface QueryParams {
type : string;
id : string | number;
@@ -294,7 +295,7 @@
if (!state.form.mobile) {
handleShowToast('请输入收货人手机号'); return;
}
if (state.form.mobile.length !== 11) {
if (!mobile(state.form.mobile)) {
handleShowToast('收货人手机号格式不正确'); return;
}
if (state.form.areaId <= 0) {

View File

@@ -11,7 +11,6 @@
display: flex;
align-items: center;
justify-content: space-between;
z-index: 99;
.collection {
display: flex;
align-items: center;

View File

@@ -10,8 +10,7 @@
bottom: 0;
display: flex;
align-items: center;
justify-content: space-between;
z-index: 99;
justify-content: space-between;
.collection,
.delete {
display: flex;

View File

@@ -1,5 +1,5 @@
<template>
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" :placeholder="false" showLoginModalDom>
<view class="layout-goods-detail">
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
:swiperBanner="state.swiperBanner" :goodsDetailContent="state.goodsDetailContent"

View File

@@ -1,5 +1,5 @@
<template>
<coreshop-page title="门店列表" mode="left" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false">
<coreshop-page title="门店列表" mode="left" bgColor="rgba(0,0,0,0)" :placeholder="false" :isShowStatusBarHeight="false">
<view class="layout-store-box">
<view class="map-box">
<map style="width: 100%;height: 100%;" id="map" :scale="11" :enable-3D="true" :show-compass="true"