mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:23:26 +08:00
【优化】(login模块):优化登录模块
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
platform: 3,
|
||||
});
|
||||
state.bannerList = positionList.data?.childs || [];
|
||||
state.bannerPosition = positionList.data.position || {};
|
||||
state.bannerPosition = positionList.data?.position || {};
|
||||
}
|
||||
|
||||
const handleClickImg = (item : any) => {
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
<uv-empty :mode="props.mode" :text="props.text" :textColor="props.textColor" :icon="computedSrc"></uv-empty>
|
||||
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { handleStaticResources } from '@/core/utils';
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { EmptyEnum } from '@/core/enum';
|
||||
import { cdnFilesUrl } from '@/core/consts';
|
||||
@@ -22,55 +21,55 @@
|
||||
let src = '';
|
||||
switch (props.mode) {
|
||||
case EmptyEnum.data:
|
||||
src = cdnFilesUrl + '/static/images/empty/data.png';
|
||||
src = '/static/images/empty/data.png';
|
||||
break;
|
||||
case EmptyEnum.address:
|
||||
src = cdnFilesUrl + '/static/images/empty/address.png';
|
||||
src = '/static/images/empty/address.png';
|
||||
break;
|
||||
case EmptyEnum.authority:
|
||||
src = cdnFilesUrl + '/static/images/empty/authority.png';
|
||||
src = '/static/images/empty/authority.png';
|
||||
break;
|
||||
case EmptyEnum.cart:
|
||||
src = cdnFilesUrl + '/static/images/empty/cart.png';
|
||||
src = '/static/images/empty/cart.png';
|
||||
break;
|
||||
case EmptyEnum.collect:
|
||||
src = cdnFilesUrl + '/static/images/empty/collect.png';
|
||||
src = '/static/images/empty/collect.png';
|
||||
break;
|
||||
case EmptyEnum.comment:
|
||||
src = cdnFilesUrl + '/static/images/empty/comment.png';
|
||||
src = '/static/images/empty/comment.png';
|
||||
break;
|
||||
case EmptyEnum.coupon:
|
||||
src = cdnFilesUrl + '/static/images/empty/coupon.png';
|
||||
src = '/static/images/empty/coupon.png';
|
||||
break;
|
||||
case EmptyEnum.history:
|
||||
src = cdnFilesUrl + '/static/images/empty/history.png';
|
||||
src = '/static/images/empty/history.png';
|
||||
break;
|
||||
case EmptyEnum.message:
|
||||
src = cdnFilesUrl + '/static/images/empty/message.png';
|
||||
src = '/static/images/empty/message.png';
|
||||
break;
|
||||
case EmptyEnum.messageList:
|
||||
src = cdnFilesUrl + '/static/images/empty/messageList.png';
|
||||
src = '/static/images/empty/messageList.png';
|
||||
break;
|
||||
case EmptyEnum.news:
|
||||
src = cdnFilesUrl + '/static/images/empty/news.png';
|
||||
src = '/static/images/empty/news.png';
|
||||
break;
|
||||
case EmptyEnum.order:
|
||||
src = cdnFilesUrl + '/static/images/empty/order.png';
|
||||
src = '/static/images/empty/order.png';
|
||||
break;
|
||||
case EmptyEnum.search:
|
||||
src = cdnFilesUrl + '/static/images/empty/search.png';
|
||||
src = '/static/images/empty/search.png';
|
||||
break;
|
||||
case EmptyEnum.wifi:
|
||||
src = cdnFilesUrl + '/static/images/empty/wifi.png';
|
||||
src = '/static/images/empty/wifi.png';
|
||||
break;
|
||||
case EmptyEnum.page:
|
||||
src = cdnFilesUrl + '/static/images/empty/page.png';
|
||||
src = '/static/images/empty/page.png';
|
||||
break;
|
||||
default:
|
||||
src = cdnFilesUrl + '/static/images/empty/data.png';
|
||||
src = '/static/images/empty/data.png';
|
||||
break;
|
||||
}
|
||||
return handleStaticResources(src);
|
||||
return cdnFilesUrl + src;
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -49,10 +49,10 @@
|
||||
import { queryLoginPhoneNumber, queryLogin, queryAliPayAppAuthTokenBYCode } from '@/core/api';
|
||||
import { loginGetCode, handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
|
||||
// 获取项目配置
|
||||
/** 获取项目配置 */
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
|
||||
// 获取 用户数据
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
|
||||
@@ -180,7 +180,9 @@
|
||||
showSku: false,
|
||||
goodsDetailData: {},
|
||||
});
|
||||
|
||||
|
||||
const emits = defineEmits(['handleShowLoginPopup']);
|
||||
|
||||
watch(() => props.data, (newVal : Array<CategoriesType>) => {
|
||||
if (newVal) {
|
||||
state.classifyData = newVal.map((item : CategoriesType) => {
|
||||
@@ -259,6 +261,10 @@
|
||||
|
||||
/** 添加购物车 */
|
||||
const handleAddCart = async ({ productId, nums } : any) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
const addCart : Response<number> = await queryAddCart({
|
||||
productId,
|
||||
nums,
|
||||
@@ -277,6 +283,10 @@
|
||||
|
||||
/** 立即购买 */
|
||||
const handleBuyNow = async ({ productId, nums } : any) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
const addCart : Response<number> = await queryAddCart({
|
||||
productId,
|
||||
nums,
|
||||
|
||||
@@ -117,7 +117,9 @@
|
||||
showSku: false,
|
||||
goodsDetailData: {},
|
||||
});
|
||||
|
||||
|
||||
const emits = defineEmits(['handleShowLoginPopup']);
|
||||
|
||||
watch(() => props.data, (newVal : Array<CategoriesType>) => {
|
||||
if (newVal) {
|
||||
state.classifyData = newVal.map((item : CategoriesType) => {
|
||||
@@ -182,6 +184,10 @@
|
||||
|
||||
/** 添加购物车 */
|
||||
const handleAddCart = async ({ productId, nums } : any) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
const addCart : Response<number> = await queryAddCart({
|
||||
productId,
|
||||
nums,
|
||||
@@ -200,6 +206,10 @@
|
||||
|
||||
/** 立即购买 */
|
||||
const handleBuyNow = async ({ productId, nums } : any) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
const addCart : Response<number> = await queryAddCart({
|
||||
productId,
|
||||
nums,
|
||||
|
||||
@@ -23,22 +23,26 @@
|
||||
<classifyThree v-else-if="shopConfigStore.config.cateStyle == GoodsListEnum.three"
|
||||
:data="state.categoriesList" :height="state.height"></classifyThree>
|
||||
<classifyFour v-else-if="shopConfigStore.config.cateStyle == GoodsListEnum.four"
|
||||
:data="state.categoriesList" :height="state.height"></classifyFour>
|
||||
:data="state.categoriesList" :height="state.height" @handleShowLoginPopup="handleShowLoginPopup">
|
||||
</classifyFour>
|
||||
<classifyFive v-else-if="shopConfigStore.config.cateStyle == GoodsListEnum.five"
|
||||
:data="state.categoriesList" :height="state.height" :statusBarHeight="statusBarHeight"></classifyFive>
|
||||
:data="state.categoriesList" :height="state.height" :statusBarHeight="statusBarHeight"
|
||||
@handleShowLoginPopup="handleShowLoginPopup"></classifyFive>
|
||||
</view>
|
||||
|
||||
<coreshop-login-modal></coreshop-login-modal>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, nextTick } from 'vue';
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
import { queryAllCategories } from '@/core/api';
|
||||
import { useShopConfigStore, useUserInfoStore } from '@/core/store';
|
||||
import { queryAllCategories, queryUserInfo } from '@/core/api';
|
||||
import { GoodsListEnum } from '@/core/enum';
|
||||
import { handleRouteNavigateTo, handleShowToast } from '@/core/utils';
|
||||
import type { Response, ShopConfigStoreType, CategoriesType } from '@/core/models';
|
||||
import type { Response, ShopConfigStoreType, CategoriesType, UserInfoType } from '@/core/models';
|
||||
import classifyOne from './classify-page/classify-one/classify-one.vue';
|
||||
import classifyTwo from './classify-page/classify-two/classify-two.vue';
|
||||
import classifyThree from './classify-page/classify-three/classify-three.vue';
|
||||
@@ -48,17 +52,23 @@
|
||||
|
||||
// 获取项目配置
|
||||
const shopConfigStore : ShopConfigStoreType = useShopConfigStore();
|
||||
|
||||
// 获取自定义导航栏高度
|
||||
const { statusBarHeight, systemInfo } = useSystemInfo();
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
const state = reactive<{
|
||||
categoriesList : Array<CategoriesType>,
|
||||
height : number,
|
||||
keyWord : string;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
categoriesList: [],
|
||||
height: 0,
|
||||
keyWord: "",
|
||||
showLoginModal: false,
|
||||
})
|
||||
const getAllCategories = async () => {
|
||||
const allCategories : Response<Array<CategoriesType>> = await queryAllCategories();
|
||||
@@ -81,6 +91,26 @@
|
||||
handleShowToast('请输入搜索内容');
|
||||
}
|
||||
}
|
||||
|
||||
/** 显示登录弹框 */
|
||||
const handleShowLoginPopup = () => {
|
||||
state.showLoginModal = true;
|
||||
}
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<text class="btn-tit" @click="receiveCoupon(item.id)">立即领取</text>
|
||||
<text class="btn-tit" @click="handleReceiveCoupon(item.id)">立即领取</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -33,19 +33,26 @@
|
||||
<script setup lang="ts">
|
||||
import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
|
||||
import { handleStaticResources, handleRouteNavigateTo, receiveCoupon } from '@/core/utils';
|
||||
|
||||
import { UserToken } from '@/core/consts';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
data : any,
|
||||
}>(), {
|
||||
data: {}
|
||||
});
|
||||
|
||||
|
||||
const emits = defineEmits(['handleShowLoginPopup']);
|
||||
|
||||
const hanldeClickViewMore = () => {
|
||||
handleRouteNavigateTo('/pages/subpackage/coupon/coupon');
|
||||
}
|
||||
|
||||
const handleReceive = () => {
|
||||
|
||||
const handleReceiveCoupon = (id:number) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return ;
|
||||
}
|
||||
receiveCoupon(id)
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
}
|
||||
|
||||
const hanldeClickTabNar = (item : PageConfigItemsImgSlideType) => {
|
||||
handleAdvertiseDetail(item.linkType, item.linkValue);
|
||||
handleAdvertiseDetail(Number(item.linkType), item.linkValue);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
}
|
||||
.pintuan-good-box {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<!-- 服务商品 -->
|
||||
<HomeServiceGood v-if="item.widgetCode === WidgetCodeEnum.service" :data="item.parameters"></HomeServiceGood>
|
||||
<!-- 优惠券 -->
|
||||
<HomeCoupon v-if="item.widgetCode === WidgetCodeEnum.coupon" :data="item.parameters"></HomeCoupon>
|
||||
<HomeCoupon v-if="item.widgetCode === WidgetCodeEnum.coupon" :data="item.parameters" @handleShowLoginPopup="handleShowLoginPopup"></HomeCoupon>
|
||||
<!-- 拼团 -->
|
||||
<HomePinTuan v-if="item.widgetCode === WidgetCodeEnum.pinTuan" :data="item.parameters"></HomePinTuan>
|
||||
<!-- 图组 -->
|
||||
@@ -79,6 +79,13 @@
|
||||
}>(), {
|
||||
coreshopData: () => []
|
||||
});
|
||||
|
||||
const emits = defineEmits(['handleShowLoginPopup']);
|
||||
|
||||
/** 显示登录弹框 */
|
||||
const handleShowLoginPopup = ()=>{
|
||||
emits('handleShowLoginPopup');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -1,10 +1,13 @@
|
||||
.layout-home-page {
|
||||
max-width: 750rpx;
|
||||
overflow: hidden;
|
||||
.home-bg {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 600rpx;
|
||||
left: 0;
|
||||
top: 0;
|
||||
max-width: 750rpx;
|
||||
}
|
||||
.search-box {
|
||||
position: relative;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</uv-navbar>
|
||||
|
||||
<view class="content-box p-25" :style="{ 'padding-top': `${statusBarHeight + 10}px` }">
|
||||
<CustomPage :coreshopData="state.coreshopData"></CustomPage>
|
||||
<CustomPage :coreshopData="state.coreshopData" @handleShowLoginPopup="handleShowLoginPopup"></CustomPage>
|
||||
</view>
|
||||
|
||||
<!-- 备案信息 -->
|
||||
@@ -20,7 +20,8 @@
|
||||
<HomeAdpop></HomeAdpop>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal></coreshop-login-modal>
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -48,14 +49,16 @@
|
||||
const state = reactive<{
|
||||
coreshopData : Array<PageConfigItemsType>;
|
||||
isScrollTop : boolean;
|
||||
showLoginModal:boolean;
|
||||
}>({
|
||||
coreshopData: [],
|
||||
isScrollTop: false,
|
||||
showLoginModal:false,
|
||||
})
|
||||
|
||||
const getPageConfig = async () => {
|
||||
const pageConfig : Response<PageConfigType> = await queryPageConfig({ code: 'mobile_home2024091618525466774' });
|
||||
state.coreshopData = pageConfig.data.items;
|
||||
const pageConfig : Response<PageConfigType> = await queryPageConfig({ code: 'mobile_home' });
|
||||
state.coreshopData = pageConfig.data?.items;
|
||||
}
|
||||
|
||||
onPageScroll((e : any) => {
|
||||
@@ -72,7 +75,17 @@
|
||||
getUserInfo();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 显示登录弹框*/
|
||||
const handleShowLoginPopup = ()=>{
|
||||
state.showLoginModal = true;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
|
||||
@@ -27,19 +27,19 @@
|
||||
</template>
|
||||
</view>
|
||||
<view class="user-info-num-box">
|
||||
<view class="item" @click="handleRouteNavigateTo('/pages/subpackage/member/footprint/footprint')">
|
||||
<view class="item" @click="handleJumpPage('/pages/subpackage/member/footprint/footprint')">
|
||||
<view class="num">{{ state.userInfo?.footPrintCount || 0 }}</view>
|
||||
<view class="tit">足迹</view>
|
||||
</view>
|
||||
<view class="item" @click="handleRouteNavigateTo('/pages/subpackage/member/coupon/coupon')">
|
||||
<view class="item" @click="handleJumpPage('/pages/subpackage/member/coupon/coupon')">
|
||||
<view class="num">{{ state.userInfo?.userCouponCount || 0 }}</view>
|
||||
<view class="tit">优惠券</view>
|
||||
</view>
|
||||
<view class="item" @click="handleRouteNavigateTo('/pages/subpackage/member/collection/collection')">
|
||||
<view class="item" @click="handleJumpPage('/pages/subpackage/member/collection/collection')">
|
||||
<view class="num">{{ state.userInfo?.collectionCount || 0 }}</view>
|
||||
<view class="tit">收藏</view>
|
||||
</view>
|
||||
<view class="item" @click="handleRouteNavigateTo('/pages/subpackage/member/afterSales/list/list')">
|
||||
<view class="item" @click="handleJumpPage('/pages/subpackage/member/afterSales/list/list')">
|
||||
<view class="num">{{ state?.afterSaleNums || 0 }}</view>
|
||||
<view class="tit">售后</view>
|
||||
</view>
|
||||
@@ -54,7 +54,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="view-detail"
|
||||
@click="handleRouteNavigateTo('/pages/subpackage/member/integral/integral')">
|
||||
@click="handleJumpPage('/pages/subpackage/member/integral/integral')">
|
||||
<text class="tit">查看详情</text>
|
||||
<uv-icon name="arrow-right" size="13" color="#292B2E"></uv-icon>
|
||||
</view>
|
||||
@@ -68,7 +68,7 @@
|
||||
<view class="title">我的订单</view>
|
||||
<view class="order-box p-b-20">
|
||||
<view class="item" v-for="item, index in state.orderList" :key="index"
|
||||
@click="handleRouteNavigateTo(`/pages/subpackage/member/order/list/list?type=${item.orderStatus}`)">
|
||||
@click="handleJumpPage(`/pages/subpackage/member/order/list/list?type=${item.orderStatus}`)">
|
||||
<image class="img" :src="handleStaticResources(item.img)"></image>
|
||||
<view class="name">{{ item.name }}</view>
|
||||
<view class="nums" v-if="item.nums && item.nums != 0">{{ item.nums }}</view>
|
||||
@@ -79,7 +79,7 @@
|
||||
<view class="view-box" v-if="shopConfigStore.config?.showInviter === ShowInviterEnum.yes">
|
||||
<view class="title">天天有钱</view>
|
||||
<view class="invitation-box"
|
||||
@click="handleRouteNavigateTo(`/pages/subpackage/member/invite/invite/invite`)">
|
||||
@click="handleJumpPage(`/pages/subpackage/member/invite/invite/invite`)">
|
||||
<view class="item">
|
||||
<image class="img" :src="handleStaticResources('/static/images/member/invitation-01.png')">
|
||||
</image>
|
||||
@@ -89,7 +89,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="item"
|
||||
@click="handleRouteNavigateTo(`/pages/subpackage/member/invite/invite/invite`)">
|
||||
@click="handleJumpPage(`/pages/subpackage/member/invite/invite/invite`)">
|
||||
<image class="img" :src="handleStaticResources('/static/images/member/invitation-02.png')">
|
||||
</image>
|
||||
<view class="tit-desc">
|
||||
@@ -110,7 +110,7 @@
|
||||
<view class="tit">商家管理</view>
|
||||
</view>
|
||||
<template v-for="item in navState.myServiceList" :key="item.name">
|
||||
<view class="item" v-if="item.isShow" @click="handleRouteNavigateTo(item.url)">
|
||||
<view class="item" v-if="item.isShow" @click="handleJumpPage(item.url)">
|
||||
<image class="img" :src="handleStaticResources(item.img)"></image>
|
||||
<view class="tit">{{ item.title }}</view>
|
||||
</view>
|
||||
@@ -122,7 +122,7 @@
|
||||
<view class="title">增值服务</view>
|
||||
<view class="service-box p-b-20">
|
||||
<template v-for="item in navState.incrementServiceList" :key="item.name">
|
||||
<view class="item" v-if="item.isShow" @click="handleRouteNavigateTo(item.url)">
|
||||
<view class="item" v-if="item.isShow" @click="handleClassifyServiceJumpPage(item)">
|
||||
<image class="img" :src="handleStaticResources(item.img)"></image>
|
||||
<view class="tit">{{ item.title }}</view>
|
||||
</view>
|
||||
@@ -134,7 +134,7 @@
|
||||
<view class="title">其它服务</view>
|
||||
<view class="service-box p-b-20">
|
||||
<template v-for="item in navState.otherServiceList" :key="item.name">
|
||||
<view class="item" v-if="item.isShow" @click="handleRouteNavigateTo(item.url)">
|
||||
<view class="item" v-if="item.isShow" @click="handleClassifyServiceJumpPage(item)">
|
||||
<image class="img" :src="handleStaticResources(item.img)"></image>
|
||||
<view class="tit">{{ item.title }}</view>
|
||||
</view>
|
||||
@@ -154,17 +154,14 @@
|
||||
import { onPageScroll, onShow } from '@dcloudio/uni-app';
|
||||
import { handleStaticResources, handleRouteNavigateTo, handleShowToast } from '@/core/utils';
|
||||
import { queryUserInfo, queryOrderStatusNum, queryUserIsClerk } from '@/core/api';
|
||||
import type { Response, MemberOrderType, UserInfoType, UserIsClerkType } from '@/core/models';
|
||||
import { useShopConfigStore, useUserInfoStore } from '@/core/store';
|
||||
import { ShowVasEnum, ShowInviterEnum, OrderTabStatusEnum } from '@/core/enum';
|
||||
import type { Response, MemberOrderType, UserInfoType, UserIsClerkType ,MemberServiceType} from '@/core/models';
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
import { ShowVasEnum, ShowInviterEnum, OrderTabStatusEnum ,MemberPageNameEnum} from '@/core/enum';
|
||||
import { useNavHook } from './use-nav-hook';
|
||||
import { UserToken } from '@/core/consts'
|
||||
|
||||
/** 获取项目配置 */
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
|
||||
/** 获取服务导航 */
|
||||
const { getNav, navState } = useNavHook();
|
||||
@@ -185,7 +182,15 @@
|
||||
showLoginModal: false,
|
||||
isScrollToTop: true,
|
||||
})
|
||||
|
||||
|
||||
onPageScroll((e : any) => {
|
||||
if (e.scrollTop > 10) {
|
||||
state.isScrollToTop = false;
|
||||
} else {
|
||||
state.isScrollToTop = true;
|
||||
}
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
getOrderStatusNum();
|
||||
@@ -204,14 +209,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
onPageScroll((e : any) => {
|
||||
if (e.scrollTop > 10) {
|
||||
state.isScrollToTop = false;
|
||||
} else {
|
||||
state.isScrollToTop = true;
|
||||
}
|
||||
})
|
||||
|
||||
/** 判断用户是否是门店人员 */
|
||||
const getUserIsClerk = async () => {
|
||||
const userIsClerk : Response<UserIsClerkType> = await queryUserIsClerk();
|
||||
@@ -246,6 +243,27 @@
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 跳转页面 */
|
||||
const handleJumpPage = (url:string)=>{
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return ;
|
||||
}
|
||||
handleRouteNavigateTo(url);
|
||||
}
|
||||
|
||||
/** 分类服务跳转页面 */
|
||||
const handleClassifyServiceJumpPage = (item:MemberServiceType)=>{
|
||||
/** 判断签到,系统设置 */
|
||||
if(item.name == MemberPageNameEnum.checkIn || item.name == MemberPageNameEnum.setting){
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
handleRouteNavigateTo(item.url);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
import { ShowcheckInEnum } from '@/core/enum';
|
||||
|
||||
// 获取项目配置
|
||||
/** 获取项目配置 */
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
|
||||
const state = reactive<{
|
||||
@@ -79,12 +79,13 @@
|
||||
SignUp : Array<any>;
|
||||
cur_year : number;
|
||||
cur_month : number;
|
||||
today : string;
|
||||
toMonth : string;
|
||||
toYear : string;
|
||||
today : number;
|
||||
toMonth : number;
|
||||
toYear : number;
|
||||
weeks_ch : Array<string>;
|
||||
dataSource : Array<any>;
|
||||
sumCount : number;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
days: [],
|
||||
SignUp: [],
|
||||
@@ -96,6 +97,7 @@
|
||||
weeks_ch: ['日', '一', '二', '三', '四', '五', '六'],
|
||||
dataSource: [], //已签到的数据源
|
||||
sumCount: 0,
|
||||
showLoginModal: false,
|
||||
});
|
||||
|
||||
onLoad(() => {
|
||||
@@ -185,7 +187,7 @@
|
||||
var year = current.getFullYear();
|
||||
var month = current.getMonth() + 1;
|
||||
var day = current.getDate();
|
||||
day = parseInt(day);
|
||||
day = parseInt(String(day));
|
||||
for (var j = 0; j < daysArr.length; j++) {
|
||||
//年月日相同则打卡成功
|
||||
if (year == state.cur_year && month == state.cur_month && daysArr[j].date == day) {
|
||||
@@ -198,8 +200,8 @@
|
||||
|
||||
/** 切换控制年月,上一个月,下一个月 */
|
||||
const handleCalendar = (type : number) => {
|
||||
const cur_year = parseInt(state.cur_year);
|
||||
const cur_month = parseInt(state.cur_month);
|
||||
const cur_year = parseInt(String(state.cur_year));
|
||||
const cur_month = parseInt(String(state.cur_month));
|
||||
let newMonth : any = '';
|
||||
let newYear = cur_year;
|
||||
if (type === 0) { //上个月
|
||||
@@ -237,7 +239,7 @@
|
||||
const userCheckIn : Response<any> = await queryUserCheckIn({
|
||||
date: postDate,
|
||||
})
|
||||
if (userCheckIn.status) {
|
||||
if (userCheckIn?.status) {
|
||||
handleShowToast('签到成功', 'success');
|
||||
state.dataSource.push(state.cur_year + "-" + state.cur_month + "-" + date);
|
||||
if (userCheckIn.data) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<view class="goods-detail">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:isCollection="state.isfav" :swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
|
||||
:swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
|
||||
:goodsDetailContent="state.goodsDetailContent" :isActivityGoods="true" :shareType="ShareEnum.group"
|
||||
@hanldeShowGoodSku="hanldeShowGoodSku">
|
||||
<template #tip>
|
||||
@@ -56,17 +56,21 @@
|
||||
<GoodsDetailSkuPopup :showSku="state.showSku" :goodsDetailData="state.goodsDetailData"
|
||||
:isShowAddCartBtn="false" btnBuyTitlt="立即团购" @handleChangePopup="handleChangePopup"
|
||||
@handleBuyNow="handleSeckillNow"></GoodsDetailSkuPopup>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryActivityDetial, queryCartNum, queryShare, queryAddCart } from '@/core/api';
|
||||
import { queryActivityDetial, queryCartNum, queryShare, queryAddCart, queryUserInfo } from '@/core/api';
|
||||
import { PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import type { Response } from '@/core/models';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useCartStore } from '@/core/store';
|
||||
import { useCartStore, useUserInfoStore } from '@/core/store';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
@@ -78,6 +82,9 @@
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const state = reactive<{
|
||||
@@ -89,6 +96,7 @@
|
||||
id : number;
|
||||
showTip : boolean;
|
||||
spesDesc : string;
|
||||
showLoginModal : boolean;
|
||||
timeData : {
|
||||
days : number,
|
||||
hours : number,
|
||||
@@ -104,6 +112,7 @@
|
||||
id: 0,
|
||||
showTip: true,
|
||||
spesDesc: "",
|
||||
showLoginModal: false,
|
||||
timeData: {
|
||||
days: 0,
|
||||
hours: 0,
|
||||
@@ -166,6 +175,10 @@
|
||||
|
||||
/** 立即购买,打开sku弹框 */
|
||||
const hanldeShowGoodSku = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.showSku = true;
|
||||
}
|
||||
|
||||
@@ -187,6 +200,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<view class="goods-detail">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:isCollection="state.isfav" :swiperBanner="state.swiperBanner" :shareType="ShareEnum.pinTuan"
|
||||
:swiperBanner="state.swiperBanner" :shareType="ShareEnum.pinTuan"
|
||||
:goodsDetailContent="state.goodsDetailContent" :isActivityGoods="true">
|
||||
<template #activityGoodsOtheService>
|
||||
<view class="pinTuan-record" v-if="state.goodsDetailData?.pinTuanRecord?.length > 0">
|
||||
@@ -66,16 +66,19 @@
|
||||
:btnBuyTitlt="state.btnBuyTitlt">
|
||||
</GoodsDetailSkuPopup>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { queryPinTuanGoodsDetail, queryCartNum, queryAddCart, queryOrderPinTuanTeamInfo } from '@/core/api';
|
||||
import type { Response } from '@/core/models';
|
||||
import { queryPinTuanGoodsDetail, queryUserInfo, queryCartNum, queryAddCart, queryOrderPinTuanTeamInfo } from '@/core/api';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import { UserToken } from '@/core/consts'
|
||||
import { useCartStore } from '@/core/store';
|
||||
import { useCartStore, useUserInfoStore } from '@/core/store';
|
||||
import { PaymentTypeEnum, ShareEnum } from '@/core/enum';
|
||||
import { handleRouteNavigateTo, handleShowToast } from '@/core/utils';
|
||||
import { deepClone } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
|
||||
@@ -90,6 +93,10 @@
|
||||
teamId ?: number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
/** 获取购物车数据 */
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const state = reactive<{
|
||||
@@ -105,6 +112,7 @@
|
||||
isSingleBuy : boolean;
|
||||
btnBuyTitlt : string;
|
||||
teamInfo : any;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
id: 0,
|
||||
goodsDetailData: {},
|
||||
@@ -118,6 +126,7 @@
|
||||
isSingleBuy: true,
|
||||
btnBuyTitlt: "发起拼团",
|
||||
teamInfo: {},
|
||||
showLoginModal: false,
|
||||
});
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -184,6 +193,10 @@
|
||||
|
||||
/** 单独购买 */
|
||||
const handleSingleBuy = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.teamId = 0;
|
||||
state.showSku = true;
|
||||
state.isSingleBuy = true;
|
||||
@@ -193,6 +206,10 @@
|
||||
|
||||
/** 拼团购买 */
|
||||
const handleMultipleBuy = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.teamId = 0;
|
||||
state.showSku = true;
|
||||
state.isSingleBuy = false;
|
||||
@@ -254,6 +271,21 @@
|
||||
} else {
|
||||
handleShowToast(addCart.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<view class="goods-detail">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:isCollection="state.isfav" :swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
|
||||
:swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
|
||||
:goodsDetailContent="state.goodsDetailContent" :isActivityGoods="true" :shareType="ShareEnum.seckill"
|
||||
@hanldeShowGoodSku="hanldeShowGoodSku">
|
||||
<template #tip>
|
||||
@@ -56,17 +56,21 @@
|
||||
<GoodsDetailSkuPopup :showSku="state.showSku" :goodsDetailData="state.goodsDetailData"
|
||||
:isShowAddCartBtn="false" btnBuyTitlt="立即秒杀" @handleChangePopup="handleChangePopup"
|
||||
@handleBuyNow="handleSeckillNow"></GoodsDetailSkuPopup>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryActivityDetial, queryCartNum, queryShare, queryAddCart } from '@/core/api';
|
||||
import { queryActivityDetial, queryCartNum, queryShare, queryAddCart, queryUserInfo } from '@/core/api';
|
||||
import { PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import type { Response, UserCartType, GoodsSkuListType } from '@/core/models';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useCartStore } from '@/core/store';
|
||||
import { useCartStore, useUserInfoStore } from '@/core/store';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
@@ -78,6 +82,9 @@
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const state = reactive<{
|
||||
@@ -89,6 +96,7 @@
|
||||
id : number;
|
||||
showTip : boolean;
|
||||
spesDesc : string;
|
||||
showLoginModal : boolean;
|
||||
timeData : {
|
||||
days : number,
|
||||
hours : number,
|
||||
@@ -104,6 +112,7 @@
|
||||
id: 0,
|
||||
showTip: true,
|
||||
spesDesc: "",
|
||||
showLoginModal: false,
|
||||
timeData: {
|
||||
days: 0,
|
||||
hours: 0,
|
||||
@@ -166,6 +175,10 @@
|
||||
|
||||
/** 立即购买,打开sku弹框 */
|
||||
const hanldeShowGoodSku = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.showSku = true;
|
||||
}
|
||||
|
||||
@@ -185,6 +198,21 @@
|
||||
} else {
|
||||
handleShowToast(addCart.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
|
||||
@@ -88,20 +88,25 @@
|
||||
<view class="buy" @click="handleBuyNow">立即结算</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分享弹框 -->
|
||||
<CoreshopShare :show="state.showShare" :shareType="ShareEnum.solitaire"
|
||||
:goodsDetailData="state.solitaireInfo" @handleClosePopup="handleToggleShowShare"></CoreshopShare>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { querySolitaireDetail, queryShare, queryAddCart, queryRemoveCart } from '@/core/api';
|
||||
import { querySolitaireDetail, queryShare, queryAddCart, queryRemoveCart, queryUserInfo } from '@/core/api';
|
||||
import { ShareClientEnum, ShareModelEnum, ShareEnum, EmptyEnum, PaymentTypeEnum, AddCartEnum } from '@/core/enum';
|
||||
import type { Response } from '@/core/models';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
import { useShopConfigStore, useUserInfoStore } from '@/core/store';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
|
||||
import CoreshopShare from '@/components/coreshop-share/coreshop-share.vue';
|
||||
@@ -111,6 +116,9 @@
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
// 获取项目配置
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
|
||||
@@ -122,6 +130,7 @@
|
||||
totalprice : number;
|
||||
shareUrl : string;
|
||||
showShare : boolean;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
id: 0,
|
||||
solitaireInfo: {},
|
||||
@@ -130,6 +139,7 @@
|
||||
totalprice: 0,
|
||||
shareUrl: "",
|
||||
showShare: false,
|
||||
showLoginModal: false,
|
||||
});
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -227,6 +237,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 显示登录弹框 */
|
||||
const handleShowLoginPopup = () => {
|
||||
state.showLoginModal = true;
|
||||
}
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
justify-content: space-between;
|
||||
|
||||
.back {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
font-size: 24rpx;
|
||||
width: 100rpx;
|
||||
text-align: center;
|
||||
line-height: 55rpx;
|
||||
height: 55rpx;
|
||||
line-height: 50rpx;
|
||||
height: 50rpx;
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
border-radius: 20px;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</image>
|
||||
|
||||
<uv-input shape="circle" :placeholder="state.pageTitle ? state.pageTitle :`请输入关键词`"
|
||||
prefixIcon="search" v-model="state.searchKey" :customStyle="{ 'background-color': '#fff' }"
|
||||
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>
|
||||
|
||||
@@ -52,28 +52,39 @@
|
||||
<view v-else class="layout-empty-box">
|
||||
<coreshop-empty :mode="EmptyEnum.coupon" text="暂无优惠券可领取"></coreshop-empty>
|
||||
</view>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, onMounted } from 'vue';
|
||||
import { queryCouponList, queryReceiveCoupon } from '@/core/api';
|
||||
import { queryCouponList, queryReceiveCoupon, queryUserInfo } from '@/core/api';
|
||||
import { onReachBottom } from '@dcloudio/uni-app';
|
||||
import type { Response } from '@/core/models';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
|
||||
import { handleStaticResources, handleShowToast } from '@/core/utils';
|
||||
import { EmptyEnum } from '@/core/enum';
|
||||
import { UserToken } from '@/core/consts'
|
||||
import { useUserInfoStore } from '@/core/store';
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
const state = reactive<{
|
||||
couponList : Array<any>;
|
||||
totalPages : number;
|
||||
page : number;
|
||||
limit : number;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
couponList: [],
|
||||
totalPages: 1,
|
||||
page: 1,
|
||||
limit: 10,
|
||||
showLoginModal: false,
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
@@ -108,6 +119,10 @@
|
||||
|
||||
/** 立即领取 */
|
||||
const handleReceiveCoupon = async (id : number) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
});
|
||||
@@ -131,6 +146,21 @@
|
||||
state.couponList[index].showRules = false;
|
||||
state.couponList[index].showDiscount = !state.couponList[index].showDiscount;
|
||||
}
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './coupon.scss';
|
||||
|
||||
@@ -131,16 +131,21 @@
|
||||
{{ state.formInfo?.buttonName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryFormDetial, queryUploadImages, queryAddSubmit, queryShare } from '@/core/api';
|
||||
import type { Response, CityAddressType } from '@/core/models';
|
||||
import { queryFormDetial, queryUploadImages, queryAddSubmit, queryShare ,queryUserInfo} from '@/core/api';
|
||||
import type { Response, CityAddressType ,UserInfoType} from '@/core/models';
|
||||
import { handleShowToast, handleStaticResources, handleRouteRedirectTo, handleRouteSwitchTab, chooseImage, getSetting } from '@/core/utils';
|
||||
import { queryAreas } from '@/core/api';
|
||||
import { useUserInfoStore } from '@/core/store';
|
||||
import { UserToken, shareUrl } from '@/core/consts';
|
||||
import { FormHeadEnum, ShareClientEnum, ShareEnum, ShareModelEnum, FormTypeEnum, PaymentTypeEnum } from '@/core/enum';
|
||||
import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
|
||||
@@ -149,7 +154,10 @@
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
}
|
||||
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
const datePicker = ref();
|
||||
const timePicker = ref();
|
||||
|
||||
@@ -163,6 +171,7 @@
|
||||
goodsDetailData : any;
|
||||
paymentType : number,
|
||||
shareUrl : string;
|
||||
showLoginModal:boolean;
|
||||
}>({
|
||||
formInfo: {},
|
||||
id: 0,
|
||||
@@ -173,6 +182,7 @@
|
||||
goodsDetailData: {},
|
||||
paymentType: 0,
|
||||
shareUrl: "",
|
||||
showLoginModal:false,
|
||||
})
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -244,7 +254,22 @@
|
||||
handleShowToast(formInfo.msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
@@ -379,6 +404,11 @@
|
||||
|
||||
/** 按钮提交 */
|
||||
const handleSubmit = async () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
|
||||
let data = state.formInfo.items.find((item : any) => item.required && !item.defaultValue);
|
||||
if (data) {
|
||||
handleShowToast(`${data.name}不能为空`); return;
|
||||
|
||||
@@ -15,11 +15,16 @@
|
||||
<!-- 商品sku弹框 -->
|
||||
<GoodsDetailSkuPopup :showSku="state.showSku" :goodsDetailData="state.goodsDetailData"
|
||||
@handleAddCart="handleAddCart" @handleChangeGoodSku="handleChangeGoodSku" :safeAreaInsetBottom="false"
|
||||
@handleChangePopup="handleChangePopup" @handleBuyNow="handleBuyNow"></GoodsDetailSkuPopup>
|
||||
@handleChangePopup="handleChangePopup" @handleBuyNow="handleBuyNow"
|
||||
@handleShowLoginPopup="handleShowLoginPopup"></GoodsDetailSkuPopup>
|
||||
|
||||
<!-- 底部导航按钮 -->
|
||||
<GoodsDetailBottomTabbar :price="state.skuPrice" @handleAddCart="hanldeShowGoodSku"
|
||||
@handleBuyNow="hanldeShowGoodSku"></GoodsDetailBottomTabbar>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
@@ -27,11 +32,11 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryGoodsDetail, queryCartNum, queryShare, queryGoodsDetailByToken, queryPromotionList, queryAddCart } from '@/core/api';
|
||||
import type { Response, GoodsAgentListType, GoodsPromotionType, GoodsSkuListType } from "@/core/models";
|
||||
import { queryGoodsDetail, queryCartNum, queryShare, queryGoodsDetailByToken, queryPromotionList, queryAddCart, queryUserInfo } from '@/core/api';
|
||||
import type { UserInfoType, Response, GoodsAgentListType, GoodsPromotionType, GoodsSkuListType } from "@/core/models";
|
||||
import { PromotionEnum, AddCartEnum, PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useCartStore } from '@/core/store';
|
||||
import { useCartStore, useUserInfoStore } from '@/core/store';
|
||||
import { handleRouteNavigateTo, handleShowToast } from '@/core/utils';
|
||||
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
@@ -43,6 +48,9 @@
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const state = reactive<{
|
||||
@@ -56,6 +64,7 @@
|
||||
showSku : boolean;
|
||||
skuPrice : Number;
|
||||
shareUrl : string;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
goodsDetailData: {},
|
||||
swiperBanner: [],
|
||||
@@ -67,6 +76,7 @@
|
||||
showSku: false,
|
||||
skuPrice: 0,
|
||||
shareUrl: "",
|
||||
showLoginModal: false,
|
||||
})
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -142,6 +152,10 @@
|
||||
|
||||
/** 立即购买,打开sku弹框 */
|
||||
const hanldeShowGoodSku = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.showSku = true;
|
||||
}
|
||||
|
||||
@@ -191,6 +205,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 显示登录弹框 */
|
||||
const handleShowLoginPopup = () => {
|
||||
state.showLoginModal = true;
|
||||
}
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async (goodsId : number) => {
|
||||
let data = {
|
||||
|
||||
@@ -77,16 +77,22 @@
|
||||
</view>
|
||||
</template>
|
||||
</GoodsDetailBottomTabbar>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import type { Response, ServiceGoodsType } from '@/core/models';
|
||||
import { queryServiceDetail, queryAddServiceOrder } from '@/core/api';
|
||||
import type { Response, ServiceGoodsType ,UserInfoType} from '@/core/models';
|
||||
import { queryServiceDetail, queryAddServiceOrder ,queryUserInfo} from '@/core/api';
|
||||
import { ServiceGoodsOpenEnum, ShareEnum, PaymentTypeEnum } from '@/core/enum';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
import { useUserInfoStore } from '@/core/store';
|
||||
import { UserToken } from '@/core/consts'
|
||||
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 GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
|
||||
@@ -94,17 +100,22 @@
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
}
|
||||
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
const state = reactive<{
|
||||
id : number;
|
||||
goodsDetailData : ServiceGoodsType,
|
||||
swiperBanner : Array<string>;
|
||||
goodsDetailContent : string;
|
||||
showLoginModal:boolean;
|
||||
}>({
|
||||
id: 0,
|
||||
goodsDetailData: {},
|
||||
swiperBanner: [],
|
||||
goodsDetailContent: "",
|
||||
showLoginModal:false,
|
||||
});
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -147,6 +158,11 @@
|
||||
|
||||
/** 立即购买 */
|
||||
const handleBuyNow = async () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const serviceOrder : Response<any> = await queryAddServiceOrder({ id: state.id });
|
||||
if (serviceOrder.status) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/order/pay/pay?orderId=${serviceOrder.data}&orderType=${PaymentTypeEnum.serviceOrder}&serviceId=${state.id}`);
|
||||
@@ -154,6 +170,22 @@
|
||||
handleShowToast(serviceOrder.msg)
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './detail.scss';
|
||||
|
||||
Reference in New Issue
Block a user