mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 16:23:26 +08:00
Merge branch 'dev' of http://git.coreshop.cn/jianweie/coreshoppro into dev
This commit is contained in:
@@ -6,12 +6,19 @@
|
||||
:style="{ 'padding-top': `${props.isShowStatusBarHeight ? statusBarHeight : 0}px`, ...props.contentStyle }">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<template v-if="props.showLoginModalDom">
|
||||
<coreshop-login-modal :show="_useLoginStore.showLoginModalTogglePop"
|
||||
@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<{
|
||||
isBack : boolean,
|
||||
@@ -23,6 +30,7 @@
|
||||
customStyle : any;
|
||||
contentStyle : any;
|
||||
handleCustomRouteJump : () => void | null,
|
||||
showLoginModalDom : boolean;
|
||||
}>(), {
|
||||
isBack: true,
|
||||
bgColor: '#EEF3F7',
|
||||
@@ -33,7 +41,13 @@
|
||||
customStyle: {},
|
||||
contentStyle: {},
|
||||
handleCustomRouteJump: null,
|
||||
showLoginModalDom: false
|
||||
});
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
_useLoginStore.setShowLoginModalTogglePop(isShow);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
// 不同的环境变量配置
|
||||
const development = {
|
||||
requestBaseUrl: 'https://api.pro.demo.corecms.cn',
|
||||
requestBaseUrl: 'https://api.test.pro.coreshop.cn',
|
||||
appid: '',
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** 系统配置 */
|
||||
export * from './systemInfo';
|
||||
export * from './systemInfo';
|
||||
|
||||
@@ -11,4 +11,8 @@ export interface UserInfoStoreType {
|
||||
|
||||
export interface UserCartType {
|
||||
cartNum ?: number
|
||||
}
|
||||
|
||||
export interface UserLoginStoreType {
|
||||
showLoginModalTogglePop ?: boolean
|
||||
}
|
||||
@@ -3,4 +3,8 @@ export * from './config';
|
||||
/** 用户信息 */
|
||||
export * from './userInfo';
|
||||
/** 购物车 */
|
||||
export * from './cart';
|
||||
export * from './cart';
|
||||
/** 登录 */
|
||||
export * from './login';
|
||||
|
||||
|
||||
|
||||
38
CoreCms.Net.Uni-App/CoreShop/core/store/login.ts
Normal file
38
CoreCms.Net.Uni-App/CoreShop/core/store/login.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { UserToken } from '@/core/consts';
|
||||
import { handleShowToast } from '@/core/utils';
|
||||
import { queryUserInfo } from '@/core/api';
|
||||
import type { UserLoginStoreType, Response, UserInfoType } from '@/core/models';
|
||||
import { useUserInfoStore } from './userInfo';
|
||||
|
||||
export const useLoginStore = defineStore('useLoginStore', {
|
||||
state: () : UserLoginStoreType => {
|
||||
return {
|
||||
showLoginModalTogglePop: false
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
/** 检查是否登录 */
|
||||
checkLogin(callBack : () => void) {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
this.setShowLoginModalTogglePop(true);
|
||||
} else {
|
||||
callBack();
|
||||
}
|
||||
},
|
||||
/** 获取用户数据 */
|
||||
async getUserInfo() {
|
||||
const userInfoStore = useUserInfoStore();
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
}
|
||||
},
|
||||
/** 设置登录弹框打开或者关闭 */
|
||||
setShowLoginModalTogglePop(showLoginModalTogglePop : boolean) {
|
||||
this.showLoginModalTogglePop = showLoginModalTogglePop;
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -168,6 +168,18 @@ export const authorize = (options : UniNamespace.AuthorizeOptions) : Promise<any
|
||||
});
|
||||
}
|
||||
|
||||
export const showToast = (options : UniNamespace.ShowToastOptions) : Promise<any> => {
|
||||
return new Promise((success, fail) => {
|
||||
uni.showToast({
|
||||
...options,
|
||||
success,
|
||||
fail
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
request,
|
||||
login,
|
||||
@@ -184,5 +196,6 @@ export default {
|
||||
getLocation,
|
||||
getSetting,
|
||||
openSetting,
|
||||
authorize
|
||||
authorize,
|
||||
showToast
|
||||
}
|
||||
@@ -126,6 +126,7 @@
|
||||
import { reactive, watch, ref, onMounted, getCurrentInstance, nextTick } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import { advertPosition, UserToken } from '@/core/consts';
|
||||
import { useLoginStore } from '@/core/store';
|
||||
import { queryGoodsPageList, queryCartNumAndMoney, queryGoodsDetailByToken, queryGoodsDetail, queryAddCart } from '@/core/api';
|
||||
import type { CategoriesType, Response, GoodsListType, GoodsType } from '@/core/models';
|
||||
import { getDomInfo, handleStaticResources, handleRouteNavigateTo, handleShowToast, handleRouteSwitchTab } from '@/core/utils';
|
||||
@@ -134,6 +135,9 @@
|
||||
|
||||
const instance = getCurrentInstance();
|
||||
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
data : Array<CategoriesType>,
|
||||
height : number,
|
||||
@@ -182,8 +186,6 @@
|
||||
goodsDetailData: {},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['handleShowLoginPopup']);
|
||||
|
||||
watch(() => props.data, (newVal : Array<CategoriesType>) => {
|
||||
if (newVal) {
|
||||
state.classifyData = newVal.map((item : CategoriesType) => {
|
||||
@@ -202,7 +204,7 @@
|
||||
state.rightTabList = state.classifyData[0]?.child[0]?.child;
|
||||
|
||||
state.catId = state.classifyData[0].child[0]?.id;
|
||||
getGoodsPageList();
|
||||
getGoodsPageList();
|
||||
}
|
||||
})
|
||||
|
||||
@@ -215,13 +217,13 @@
|
||||
}, 100)
|
||||
})
|
||||
})
|
||||
|
||||
onShow(()=>{
|
||||
|
||||
onShow(() => {
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
getCartNumAndMoney();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 获取商品列表数据
|
||||
const getGoodsPageList = async () => {
|
||||
uni.showLoading({
|
||||
@@ -232,8 +234,10 @@
|
||||
limit: 10,
|
||||
where: `{"catId":${state.catId}}`
|
||||
});
|
||||
state.totalPages = goodsPageList.data.totalPages;
|
||||
state.goodsList = state.goodsList.concat(goodsPageList.data.list);
|
||||
if(goodsPageList.status){
|
||||
state.totalPages = goodsPageList.data?.totalPages;
|
||||
state.goodsList = state.goodsList.concat(goodsPageList.data?.list);
|
||||
}
|
||||
uni.hideLoading();
|
||||
}
|
||||
|
||||
@@ -245,38 +249,34 @@
|
||||
}
|
||||
|
||||
/** 选择sku */
|
||||
const handleSelectSku = async (id : number) => {
|
||||
let goodsDetail : any = null;
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
goodsDetail = await queryGoodsDetailByToken({
|
||||
id: id,
|
||||
data: true,
|
||||
})
|
||||
} else {
|
||||
goodsDetail = await queryGoodsDetail({
|
||||
id: id,
|
||||
data: true,
|
||||
})
|
||||
}
|
||||
state.goodsDetailData = goodsDetail.data;
|
||||
state.showSku = true;
|
||||
const handleSelectSku = (id : number) => {
|
||||
_useLoginStore.checkLogin(async () => {
|
||||
let goodsDetail : any = null;
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
goodsDetail = await queryGoodsDetailByToken({
|
||||
id: id,
|
||||
data: true,
|
||||
})
|
||||
} else {
|
||||
goodsDetail = await queryGoodsDetail({
|
||||
id: id,
|
||||
data: true,
|
||||
})
|
||||
}
|
||||
state.goodsDetailData = goodsDetail.data;
|
||||
state.showSku = true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** 底部按钮去结算 */
|
||||
const handleGoPay = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
handleRouteSwitchTab(RouteSwitchTabEnum.cart);
|
||||
_useLoginStore.checkLogin(() => {
|
||||
handleRouteSwitchTab(RouteSwitchTabEnum.cart);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** 添加购物车 */
|
||||
const handleAddCart = async ({ productId, nums } : any) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
const addCart : Response<number> = await queryAddCart({
|
||||
productId,
|
||||
nums,
|
||||
@@ -295,10 +295,6 @@
|
||||
|
||||
/** 立即购买 */
|
||||
const handleBuyNow = async ({ productId, nums } : any) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
const addCart : Response<number> = await queryAddCart({
|
||||
productId,
|
||||
nums,
|
||||
@@ -314,13 +310,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** sku弹框显示隐藏 */
|
||||
const handleChangePopup = (show : boolean) => {
|
||||
state.showSku = show;
|
||||
}
|
||||
|
||||
// 切换顶部tab
|
||||
/** 切换顶部tab */
|
||||
const hanldeChangeTopTab = (item : CategoriesType, index : number) => {
|
||||
if (state.leftTabId != item.id) {
|
||||
state.topTabId = item.id;
|
||||
@@ -335,16 +330,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 显示顶部大分类弹框
|
||||
/** 显示顶部大分类弹框 */
|
||||
const hanldeShowBigClassifyPop = () => {
|
||||
bigClassifyPop.value.open();
|
||||
}
|
||||
// 隐藏顶部大分类弹框
|
||||
/** 隐藏顶部大分类弹框 */
|
||||
const hanlderHidebigClassifyPop = () => {
|
||||
bigClassifyPop.value.close();
|
||||
}
|
||||
|
||||
//计算顶部tab移动的距离
|
||||
/** 计算顶部tab移动的距离 */
|
||||
const calculationTopMovingDistance = (index : number) => {
|
||||
let topScrollLeft = 0;
|
||||
for (let i = 0; i < index - 1; i++) {
|
||||
@@ -353,7 +348,7 @@
|
||||
state.topScrollLeft = topScrollLeft
|
||||
}
|
||||
|
||||
// 切换左侧tab
|
||||
/** 切换左侧tab */
|
||||
const hanldeChangeLeftTab = (item : CategoriesType) => {
|
||||
if (state.leftTabId != item.id) {
|
||||
state.leftTabId = item.id;
|
||||
@@ -363,13 +358,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
//切换右侧tab
|
||||
/** 切换右侧tab */
|
||||
const hanldeChangeRightTab = (item : CategoriesType) => {
|
||||
state.catId = item.id;
|
||||
handleResetGoodsList();
|
||||
}
|
||||
|
||||
// 组合商品数据传入组件
|
||||
/** 组合商品数据传入组件 */
|
||||
const hanldeCombinationGoodsData = (item : GoodsType) => {
|
||||
return {
|
||||
id: item.id,
|
||||
@@ -389,7 +384,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 加载下一页数据
|
||||
/** 加载下一页数据 */
|
||||
const handleScrolltolower = () => {
|
||||
if (state.totalPages > state.page) {
|
||||
state.page++;
|
||||
@@ -397,7 +392,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 重置商品列表数据
|
||||
/** 重置商品列表数据 */
|
||||
const handleResetGoodsList = () => {
|
||||
state.page = 1;
|
||||
state.goodsList = [];
|
||||
|
||||
@@ -77,14 +77,17 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, watch } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import { advertPosition } from '@/core/consts';
|
||||
import { UserToken, advertPosition } from '@/core/consts';
|
||||
import { queryGoodsPageList, queryCartNumAndMoney, queryGoodsDetailByToken, queryGoodsDetail, queryAddCart } from '@/core/api';
|
||||
import type { CategoriesType, Response, GoodsListType, GoodsType } from '@/core/models';
|
||||
import { handleStaticResources, handleRouteNavigateTo, handleShowToast, handleRouteSwitchTab } from '@/core/utils';
|
||||
import { UserToken } from '@/core/consts'
|
||||
import { useLoginStore } from '@/core/store'
|
||||
import { AddCartEnum, PaymentTypeEnum, RouteSwitchTabEnum } from '@/core/enum';
|
||||
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
|
||||
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
data : Array<CategoriesType>,
|
||||
height : number,
|
||||
@@ -119,8 +122,6 @@
|
||||
goodsDetailData: {},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['handleShowLoginPopup']);
|
||||
|
||||
watch(() => props.data, (newVal : Array<CategoriesType>) => {
|
||||
if (newVal) {
|
||||
state.classifyData = newVal.map((item : CategoriesType) => {
|
||||
@@ -155,8 +156,10 @@
|
||||
limit: 10,
|
||||
where: `{"catId":${state.catId}}`
|
||||
});
|
||||
state.totalPages = goodsPageList.data.totalPages;
|
||||
state.goodsList = state.goodsList.concat(goodsPageList.data.list);
|
||||
if(goodsPageList.status){
|
||||
state.totalPages = goodsPageList.data?.totalPages;
|
||||
state.goodsList = state.goodsList.concat(goodsPageList.data?.list);
|
||||
}
|
||||
uni.hideLoading();
|
||||
}
|
||||
|
||||
@@ -168,38 +171,34 @@
|
||||
}
|
||||
|
||||
/** 选择sku */
|
||||
const handleSelectSku = async (id : number) => {
|
||||
let goodsDetail : any = null;
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
goodsDetail = await queryGoodsDetailByToken({
|
||||
id: id,
|
||||
data: true,
|
||||
})
|
||||
} else {
|
||||
goodsDetail = await queryGoodsDetail({
|
||||
id: id,
|
||||
data: true,
|
||||
})
|
||||
}
|
||||
state.goodsDetailData = goodsDetail.data;
|
||||
state.showSku = true;
|
||||
const handleSelectSku = (id : number) => {
|
||||
_useLoginStore.checkLogin(async () => {
|
||||
let goodsDetail : any = null;
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
goodsDetail = await queryGoodsDetailByToken({
|
||||
id: id,
|
||||
data: true,
|
||||
})
|
||||
} else {
|
||||
goodsDetail = await queryGoodsDetail({
|
||||
id: id,
|
||||
data: true,
|
||||
})
|
||||
}
|
||||
state.goodsDetailData = goodsDetail.data;
|
||||
state.showSku = true;
|
||||
})
|
||||
}
|
||||
|
||||
/** 底部按钮去结算 */
|
||||
const handleGoPay = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
handleRouteSwitchTab(RouteSwitchTabEnum.cart);
|
||||
_useLoginStore.checkLogin(() => {
|
||||
handleRouteSwitchTab(RouteSwitchTabEnum.cart);
|
||||
});
|
||||
}
|
||||
|
||||
/** 添加购物车 */
|
||||
const handleAddCart = async ({ productId, nums } : any) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
const addCart : Response<number> = await queryAddCart({
|
||||
productId,
|
||||
nums,
|
||||
@@ -218,10 +217,6 @@
|
||||
|
||||
/** 立即购买 */
|
||||
const handleBuyNow = async ({ productId, nums } : any) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
const addCart : Response<number> = await queryAddCart({
|
||||
productId,
|
||||
nums,
|
||||
|
||||
@@ -1,48 +1,46 @@
|
||||
<template>
|
||||
<view class="layout-classify-page">
|
||||
<uv-navbar bgColor="#EEF3F7">
|
||||
<template #left>
|
||||
<view class="search-box">
|
||||
<view class="page-name">分类</view>
|
||||
<uv-input v-model="state.keyWord" @confirm="handleSearch" shape="circle" placeholder="请输入关键词"
|
||||
prefixIcon="search" :customStyle="{ 'background-color': '#fff' ,'padding':'3px 9px'}"
|
||||
prefixIconStyle="font-size: 22px;color: #909399">
|
||||
<template #suffix>
|
||||
<view class="search-tit" @click.stop="handleSearch">搜索</view>
|
||||
</template>
|
||||
</uv-input>
|
||||
</view>
|
||||
</template>
|
||||
</uv-navbar>
|
||||
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class="layout-classify-page">
|
||||
<uv-navbar bgColor="#EEF3F7">
|
||||
<template #left>
|
||||
<view class="search-box">
|
||||
<view class="page-name">分类</view>
|
||||
<uv-input v-model="state.keyWord" @confirm="handleSearch" shape="circle" placeholder="请输入关键词"
|
||||
prefixIcon="search" :customStyle="{ 'background-color': '#fff' ,'padding':'3px 9px'}"
|
||||
prefixIconStyle="font-size: 22px;color: #909399">
|
||||
<template #suffix>
|
||||
<view class="search-tit" @click.stop="handleSearch">搜索</view>
|
||||
</template>
|
||||
</uv-input>
|
||||
</view>
|
||||
</template>
|
||||
</uv-navbar>
|
||||
|
||||
<view class="content-box" :style="{ 'padding-top': `${statusBarHeight}px`, 'height': `${state.height}px` }">
|
||||
<classifyOne v-if="shopConfigStore.config.cateStyle == GoodsListEnum.one" :data="state.categoriesList">
|
||||
</classifyOne>
|
||||
<classifyTwo v-else-if="shopConfigStore.config.cateStyle == GoodsListEnum.two" :data="state.categoriesList">
|
||||
</classifyTwo>
|
||||
<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" @handleShowLoginPopup="handleShowLoginPopup">
|
||||
</classifyFour>
|
||||
<classifyFive v-else-if="shopConfigStore.config.cateStyle == GoodsListEnum.five"
|
||||
:data="state.categoriesList" :height="state.height" :statusBarHeight="statusBarHeight"
|
||||
@handleShowLoginPopup="handleShowLoginPopup"></classifyFive>
|
||||
<view class="content-box" :style="{ 'padding-top': `${statusBarHeight}px`, 'height': `${state.height}px` }">
|
||||
<classifyOne v-if="shopConfigStore.config.cateStyle == GoodsListEnum.one" :data="state.categoriesList">
|
||||
</classifyOne>
|
||||
<classifyTwo v-else-if="shopConfigStore.config.cateStyle == GoodsListEnum.two"
|
||||
:data="state.categoriesList">
|
||||
</classifyTwo>
|
||||
<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>
|
||||
<classifyFive v-else-if="shopConfigStore.config.cateStyle == GoodsListEnum.five"
|
||||
:data="state.categoriesList" :height="state.height" :statusBarHeight="statusBarHeight"></classifyFive>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, nextTick } from 'vue';
|
||||
import { useShopConfigStore, useUserInfoStore } from '@/core/store';
|
||||
import { queryAllCategories, queryUserInfo } from '@/core/api';
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
import { queryAllCategories } from '@/core/api';
|
||||
import { GoodsListEnum } from '@/core/enum';
|
||||
import { handleRouteNavigateTo, handleShowToast } from '@/core/utils';
|
||||
import type { Response, ShopConfigStoreType, CategoriesType, UserInfoType } from '@/core/models';
|
||||
import { handleRouteNavigateTo } from '@/core/utils';
|
||||
import type { Response, ShopConfigStoreType, CategoriesType } 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';
|
||||
@@ -54,61 +52,36 @@
|
||||
const shopConfigStore : ShopConfigStoreType = useShopConfigStore();
|
||||
|
||||
// 获取自定义导航栏高度
|
||||
const { statusBarHeight, systemInfo } = useSystemInfo();
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
const { statusBarHeight, systemInfo } = useSystemInfo();
|
||||
|
||||
const state = reactive<{
|
||||
categoriesList : Array<CategoriesType>,
|
||||
height : number,
|
||||
keyWord : string;
|
||||
showLoginModal : boolean;
|
||||
keyWord : string;
|
||||
}>({
|
||||
categoriesList: [],
|
||||
height: 0,
|
||||
keyWord: "",
|
||||
showLoginModal: false,
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
keyWord: "",
|
||||
})
|
||||
|
||||
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;
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
/** 获取购物车数量价格 */
|
||||
const getAllCategories = async () => {
|
||||
const allCategories : Response<Array<CategoriesType>> = await queryAllCategories();
|
||||
state.categoriesList = allCategories.data || [];
|
||||
}
|
||||
|
||||
|
||||
/** 搜索 */
|
||||
const handleSearch = () => {
|
||||
handleRouteNavigateTo(`/pages/subpackage/category/category?key=${state.keyWord}`);
|
||||
}
|
||||
|
||||
/** 显示登录弹框 */
|
||||
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>
|
||||
|
||||
@@ -33,26 +33,25 @@
|
||||
<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';
|
||||
|
||||
import { useLoginStore } from '@/core/store';
|
||||
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
data : any,
|
||||
}>(), {
|
||||
data: {}
|
||||
});
|
||||
|
||||
const emits = defineEmits(['handleShowLoginPopup']);
|
||||
|
||||
|
||||
const hanldeClickViewMore = () => {
|
||||
handleRouteNavigateTo('/pages/subpackage/coupon/coupon');
|
||||
}
|
||||
|
||||
const handleReceiveCoupon = (id:number) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return ;
|
||||
}
|
||||
receiveCoupon(id)
|
||||
const handleReceiveCoupon = (id : number) => {
|
||||
_useLoginStore.checkLogin(() => {
|
||||
receiveCoupon(id)
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
type: 'home',
|
||||
value: 0,
|
||||
});
|
||||
if(record.status){
|
||||
if(record.status && record.data){
|
||||
state.recordObj = record?.data;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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" @handleShowLoginPopup="handleShowLoginPopup"></HomeCoupon>
|
||||
<HomeCoupon v-if="item.widgetCode === WidgetCodeEnum.coupon" :data="item.parameters"></HomeCoupon>
|
||||
<!-- 拼团 -->
|
||||
<HomePinTuan v-if="item.widgetCode === WidgetCodeEnum.pinTuan" :data="item.parameters"></HomePinTuan>
|
||||
<!-- 图组 -->
|
||||
@@ -78,14 +78,7 @@
|
||||
coreshopData : Array<PageConfigItemsType>,
|
||||
}>(), {
|
||||
coreshopData: () => []
|
||||
});
|
||||
|
||||
const emits = defineEmits(['handleShowLoginPopup']);
|
||||
|
||||
/** 显示登录弹框 */
|
||||
const handleShowLoginPopup = ()=>{
|
||||
emits('handleShowLoginPopup');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -80,9 +80,12 @@
|
||||
import { ShareEnum } from '@/core/enum';
|
||||
import Point from '@/pages/components/custom-page/components/home-goods/point.vue';
|
||||
import { handleShowToast } from '@/core/utils';
|
||||
import CoreshopShare from '@/components/coreshop-share/coreshop-share.vue';
|
||||
import { UserToken } from '@/core/consts'
|
||||
|
||||
import CoreshopShare from '@/components/coreshop-share/coreshop-share.vue';
|
||||
import { useLoginStore } from '@/core/store';
|
||||
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
goodsDetailData : any,
|
||||
isActivityGoods : boolean,
|
||||
@@ -99,38 +102,31 @@
|
||||
}>({
|
||||
isFav: false,
|
||||
showShare: false,
|
||||
});
|
||||
|
||||
const emits = defineEmits(['handleShowLoginPopup']);
|
||||
|
||||
});
|
||||
|
||||
watch(() => props.goodsDetailData, (newVla : any) => {
|
||||
if (newVla) {
|
||||
state.isFav = newVla.isFav;
|
||||
}
|
||||
});
|
||||
|
||||
const handleToggleGoodsCollection = async () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
|
||||
const goodsCollection = await queryGoodsCollection({ id: props.goodsDetailData.id });
|
||||
if (goodsCollection.status) {
|
||||
state.isFav = !state.isFav;
|
||||
handleShowToast(goodsCollection.msg, 'success');
|
||||
} else {
|
||||
handleShowToast(goodsCollection.msg);
|
||||
}
|
||||
const handleToggleGoodsCollection = () => {
|
||||
_useLoginStore.checkLogin(async () => {
|
||||
const goodsCollection = await queryGoodsCollection({ id: props.goodsDetailData.id });
|
||||
if (goodsCollection.status) {
|
||||
state.isFav = !state.isFav;
|
||||
handleShowToast(goodsCollection.msg, 'success');
|
||||
} else {
|
||||
handleShowToast(goodsCollection.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 分享弹框显示与否 */
|
||||
const handleToggleShowShare = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
emits('handleShowLoginPopup');
|
||||
return;
|
||||
}
|
||||
state.showShare = !state.showShare;
|
||||
_useLoginStore.checkLogin(() => {
|
||||
state.showShare = !state.showShare;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<slot name="tip"></slot>
|
||||
|
||||
<!-- 商品信息 价格名字之类的 -->
|
||||
<GoodsDetailInfo :goodsDetailData="props.goodsDetailData" :shareType="props.shareType" @handleShowLoginPopup="handleShowLoginPopup"
|
||||
<GoodsDetailInfo :goodsDetailData="props.goodsDetailData" :shareType="props.shareType"
|
||||
:isActivityGoods="props.isActivityGoods" @handleToggleGoodsCollection="handleToggleGoodsCollection">
|
||||
<template #countDown>
|
||||
<slot name="countDown"></slot>
|
||||
@@ -93,7 +93,7 @@
|
||||
shareType: ShareEnum.index, /** 分享类型 - 默认分享首页 */
|
||||
});
|
||||
|
||||
const emits = defineEmits(['hanldeShowGoodSku', 'handleToggleGoodsCollection','handleShowLoginPopup']);
|
||||
const emits = defineEmits(['hanldeShowGoodSku', 'handleToggleGoodsCollection']);
|
||||
|
||||
const state = reactive<{
|
||||
commonQuestion : Array<CommonQuestionServiceType>;
|
||||
@@ -169,12 +169,7 @@
|
||||
/** 商品收藏 */
|
||||
const handleToggleGoodsCollection = () => {
|
||||
emits('handleToggleGoodsCollection')
|
||||
}
|
||||
|
||||
/** 显示登录弹框 */
|
||||
const handleShowLoginPopup = ()=>{
|
||||
emits('handleShowLoginPopup')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,28 +1,27 @@
|
||||
<template>
|
||||
<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'}">
|
||||
<template #left>
|
||||
<uv-icon name="search" size="22" color="#fff" @click="handleSearch"></uv-icon>
|
||||
</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 :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'}">
|
||||
<template #left>
|
||||
<uv-icon name="search" size="22" color="#fff" @click="handleSearch"></uv-icon>
|
||||
</template>
|
||||
</uv-navbar>
|
||||
|
||||
<view class="content-box p-25" :style="{ 'padding-top': `${statusBarHeight + 10}px` }">
|
||||
<CustomPage :coreshopData="state.coreshopData" @handleShowLoginPopup="handleShowLoginPopup"></CustomPage>
|
||||
<view class="content-box p-25" :style="{ 'padding-top': `${statusBarHeight + 10}px` }">
|
||||
<CustomPage :coreshopData="state.coreshopData">
|
||||
</CustomPage>
|
||||
</view>
|
||||
|
||||
<!-- 备案信息 -->
|
||||
<coreshop-copyright></coreshop-copyright>
|
||||
|
||||
<!-- 弹框广告 -->
|
||||
<HomeAdpop></HomeAdpop>
|
||||
</view>
|
||||
|
||||
<!-- 备案信息 -->
|
||||
<coreshop-copyright></coreshop-copyright>
|
||||
|
||||
<!-- 弹框广告 -->
|
||||
<HomeAdpop></HomeAdpop>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -37,7 +36,7 @@
|
||||
import { UserToken } from '@/core/consts';
|
||||
import { useUserInfoStore, useShopConfigStore } from '@/core/store';
|
||||
|
||||
// 获取项目配置
|
||||
/** 获取项目配置 */
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
|
||||
/** 获取自定义导航栏高度 */
|
||||
@@ -49,11 +48,9 @@
|
||||
const state = reactive<{
|
||||
coreshopData : Array<PageConfigItemsType>;
|
||||
isScrollTop : boolean;
|
||||
showLoginModal:boolean;
|
||||
}>({
|
||||
coreshopData: [],
|
||||
isScrollTop: false,
|
||||
showLoginModal:false,
|
||||
})
|
||||
|
||||
const getPageConfig = async () => {
|
||||
@@ -75,17 +72,7 @@
|
||||
getUserInfo();
|
||||
}
|
||||
})
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 显示登录弹框*/
|
||||
const handleShowLoginPopup = ()=>{
|
||||
state.showLoginModal = true;
|
||||
}
|
||||
|
||||
|
||||
/** 获取用户信息 */
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
:deep(.layout-page-content) {
|
||||
&::before {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -50px;
|
||||
.member-head{
|
||||
position: relative;
|
||||
.memeber-bg{
|
||||
display: block;
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 685rpx;
|
||||
background: #d33123 url(/static/images/member/bg.png);
|
||||
background-size: cover;
|
||||
width: 750rpx;
|
||||
height: 600rpx;
|
||||
}
|
||||
}
|
||||
.head-box {
|
||||
position: relative;
|
||||
margin-top: -20rpx;
|
||||
|
||||
.head-box {
|
||||
position: absolute;
|
||||
bottom: 13rpx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -85,25 +82,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.member-box {
|
||||
position: relative;
|
||||
|
||||
.bg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.member-content {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 44%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 88%;
|
||||
.member-box {
|
||||
.member-content {
|
||||
width: 88%;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -1,67 +1,70 @@
|
||||
<template>
|
||||
<coreshop-page :title="state.isScrollToTop ? '' : state.userInfo?.nickName || ''" titleColor="#fff" mode="left"
|
||||
:bgColor=" state.isScrollToTop ? 'rgba(0,0,0,0)':'#d33123'" :isBack="false">
|
||||
<view class="layout-member-page">
|
||||
<view class="head-box m-b-10">
|
||||
<view class="user-info">
|
||||
<view class="img-box">
|
||||
<image class="img"
|
||||
:src="handleStaticResources(state.userInfo?.avatarImage || '/static/images/common/empty.png')">
|
||||
</image>
|
||||
</view>
|
||||
<template v-if="Object.keys(state.userInfo).length > 0">
|
||||
<view class="info-box">
|
||||
<view class="name">{{ state.userInfo?.nickName }}</view>
|
||||
<view class="price">我的余额:¥{{ state.userInfo?.balance || 0 }}</view>
|
||||
</view>
|
||||
<view class="icon-box"
|
||||
@click="handleRouteNavigateTo(`/pages/subpackage/member/set/userInfo/userInfo`)">
|
||||
<image class="icon" :src="handleStaticResources('/static/images/member/icon-right.png')">
|
||||
<coreshop-page :title="state.isScrollToTop ? '' : userInfoStore.userInfo?.nickName || ''" titleColor="#fff"
|
||||
mode="left" :bgColor=" state.isScrollToTop ? 'rgba(0,0,0,0)':'#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>
|
||||
<view class="head-box m-b-10">
|
||||
<view class="user-info">
|
||||
<view class="img-box">
|
||||
<image class="img"
|
||||
:src="handleStaticResources(userInfoStore.userInfo?.avatarImage || '/static/images/common/empty.png')">
|
||||
</image>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="info-box">
|
||||
<view class="login" @click="handleLogin">立即登录</view>
|
||||
<template v-if="Object.keys(userInfoStore.userInfo).length > 0">
|
||||
<view class="info-box">
|
||||
<view class="name">{{ userInfoStore.userInfo?.nickName }}</view>
|
||||
<view class="price">我的余额:¥{{ userInfoStore.userInfo?.balance || 0 }}</view>
|
||||
</view>
|
||||
<view class="icon-box"
|
||||
@click="handleRouteNavigateTo(`/pages/subpackage/member/set/userInfo/userInfo`)">
|
||||
<image class="icon"
|
||||
:src="handleStaticResources('/static/images/member/icon-right.png')">
|
||||
</image>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="info-box">
|
||||
<view class="login" @click="handleLogin">立即登录</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="user-info-num-box">
|
||||
<view class="item" @click="handleJumpPage('/pages/subpackage/member/footprint/footprint')">
|
||||
<view class="num">{{ userInfoStore.userInfo?.footPrintCount || 0 }}</view>
|
||||
<view class="tit">足迹</view>
|
||||
</view>
|
||||
<view class="item" @click="handleJumpPage('/pages/subpackage/member/coupon/coupon')">
|
||||
<view class="num">{{ userInfoStore.userInfo?.userCouponCount || 0 }}</view>
|
||||
<view class="tit">优惠券</view>
|
||||
</view>
|
||||
<view class="item" @click="handleJumpPage('/pages/subpackage/member/collection/collection')">
|
||||
<view class="num">{{ userInfoStore.userInfo?.collectionCount || 0 }}</view>
|
||||
<view class="tit">收藏</view>
|
||||
</view>
|
||||
<view class="item" @click="handleJumpPage('/pages/subpackage/member/afterSales/list/list')">
|
||||
<view class="num">{{ state?.afterSaleNums || 0 }}</view>
|
||||
<view class="tit">售后</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="user-info-num-box">
|
||||
<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="handleJumpPage('/pages/subpackage/member/coupon/coupon')">
|
||||
<view class="num">{{ state.userInfo?.userCouponCount || 0 }}</view>
|
||||
<view class="tit">优惠券</view>
|
||||
</view>
|
||||
<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="handleJumpPage('/pages/subpackage/member/afterSales/list/list')">
|
||||
<view class="num">{{ state?.afterSaleNums || 0 }}</view>
|
||||
<view class="tit">售后</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="member-box">
|
||||
<image class="bg" :src="handleStaticResources('/static/images/member/member-bg.png')"></image>
|
||||
<view class="member-content">
|
||||
<view class="content">
|
||||
<view class="grade">{{ state.userInfo?.gradeName || '普通会员' }}</view>
|
||||
<view class="integral">
|
||||
我的{{ shopConfigStore?.config?.pointShowName || '积分' }}:{{ state.userInfo?.point || 0 }}
|
||||
<view class="member-box">
|
||||
<view class="member-content">
|
||||
<view class="content">
|
||||
<view class="grade">{{ userInfoStore.userInfo?.gradeName || '普通会员' }}</view>
|
||||
<view class="integral">
|
||||
我的{{ shopConfigStore?.config?.pointShowName || '积分' }}:{{ userInfoStore.userInfo?.point || 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="view-detail"
|
||||
@click="handleJumpPage('/pages/subpackage/member/integral/integral')">
|
||||
<text class="tit">查看详情</text>
|
||||
<uv-icon name="arrow-right" size="13" color="#292B2E"></uv-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="view-detail"
|
||||
@click="handleJumpPage('/pages/subpackage/member/integral/integral')">
|
||||
<text class="tit">查看详情</text>
|
||||
<uv-icon name="arrow-right" size="13" color="#292B2E"></uv-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="p-20">
|
||||
<!-- 我的订单 -->
|
||||
<view class="view-box">
|
||||
@@ -88,8 +91,7 @@
|
||||
<view class="desc">最高提现20元</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item"
|
||||
@click="handleJumpPage(`/pages/subpackage/member/invite/invite/invite`)">
|
||||
<view class="item" @click="handleJumpPage(`/pages/subpackage/member/invite/invite/invite`)">
|
||||
<image class="img" :src="handleStaticResources('/static/images/member/invitation-02.png')">
|
||||
</image>
|
||||
<view class="tit-desc">
|
||||
@@ -142,9 +144,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
@@ -154,14 +153,20 @@
|
||||
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 ,MemberServiceType} from '@/core/models';
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
import { ShowVasEnum, ShowInviterEnum, OrderTabStatusEnum ,MemberPageNameEnum} from '@/core/enum';
|
||||
import type { Response, MemberOrderType, UserInfoType, UserIsClerkType, MemberServiceType } from '@/core/models';
|
||||
import { useShopConfigStore, useUserInfoStore, useLoginStore } 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 shopConfigStore = useShopConfigStore();
|
||||
|
||||
/** 用户数据store */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
/** 获取服务导航 */
|
||||
const { getNav, navState } = useNavHook();
|
||||
@@ -170,19 +175,15 @@
|
||||
const state = reactive<{
|
||||
orderList : Array<MemberOrderType>;
|
||||
afterSaleNums : number;
|
||||
userInfo : UserInfoType,
|
||||
userIsClerk : UserIsClerkType,
|
||||
showLoginModal : boolean;
|
||||
isScrollToTop : boolean,
|
||||
}>({
|
||||
orderList: navState.orderList,
|
||||
afterSaleNums: 0,
|
||||
userInfo: {},
|
||||
userIsClerk: {},
|
||||
showLoginModal: false,
|
||||
isScrollToTop: true,
|
||||
})
|
||||
|
||||
|
||||
onPageScroll((e : any) => {
|
||||
if (e.scrollTop > 10) {
|
||||
state.isScrollToTop = false;
|
||||
@@ -190,7 +191,7 @@
|
||||
state.isScrollToTop = true;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
onShow(() => {
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
getOrderStatusNum();
|
||||
@@ -202,7 +203,7 @@
|
||||
const getUserInfo = async () => {
|
||||
const userInfo : Response<UserInfoType> = await queryUserInfo();
|
||||
if (userInfo.status) {
|
||||
state.userInfo = userInfo?.data;
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
getUserIsClerk();
|
||||
} else {
|
||||
handleShowToast(userInfo.msg)
|
||||
@@ -231,7 +232,7 @@
|
||||
/** 去登录 */
|
||||
const handleLogin = () => {
|
||||
// #ifdef MP-ALIPAY || MP-WEIXIN
|
||||
state.showLoginModal = !state.showLoginModal;
|
||||
_useLoginStore.setShowLoginModalTogglePop(true);
|
||||
// #endif
|
||||
|
||||
// #ifndef MP-WEIXIN || MP-ALIPAY
|
||||
@@ -239,30 +240,23 @@
|
||||
// #endif
|
||||
}
|
||||
|
||||
/** 打开获取关闭login弹框 */
|
||||
const handleChangeLoginPopup = (isShow : boolean) => {
|
||||
state.showLoginModal = isShow;
|
||||
}
|
||||
|
||||
/** 跳转页面 */
|
||||
const handleJumpPage = (url:string)=>{
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return ;
|
||||
}
|
||||
handleRouteNavigateTo(url);
|
||||
const handleJumpPage = (url : string) => {
|
||||
_useLoginStore.checkLogin(() => {
|
||||
handleRouteNavigateTo(url);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** 分类服务跳转页面 */
|
||||
const handleClassifyServiceJumpPage = (item:MemberServiceType)=>{
|
||||
const handleClassifyServiceJumpPage = (item : MemberServiceType) => {
|
||||
/** 判断签到,系统设置 */
|
||||
if(item.name == MemberPageNameEnum.checkIn || item.name == MemberPageNameEnum.setting){
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return ;
|
||||
}
|
||||
if (item.name == MemberPageNameEnum.checkIn || item.name == MemberPageNameEnum.setting) {
|
||||
_useLoginStore.checkLogin(() => {
|
||||
handleRouteNavigateTo(item.url);
|
||||
})
|
||||
} else {
|
||||
handleRouteNavigateTo(item.url);
|
||||
}
|
||||
handleRouteNavigateTo(item.url);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -85,7 +85,6 @@
|
||||
weeks_ch : Array<string>;
|
||||
dataSource : Array<any>;
|
||||
sumCount : number;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
days: [],
|
||||
SignUp: [],
|
||||
@@ -97,7 +96,6 @@
|
||||
weeks_ch: ['日', '一', '二', '三', '四', '五', '六'],
|
||||
dataSource: [], //已签到的数据源
|
||||
sumCount: 0,
|
||||
showLoginModal: false,
|
||||
});
|
||||
|
||||
onLoad(() => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false">
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class="goods-detail">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
|
||||
:goodsDetailContent="state.goodsDetailContent" :isActivityGoods="true" :shareType="ShareEnum.group"
|
||||
@hanldeShowGoodSku="hanldeShowGoodSku" @handleShowLoginPopup="handleShowLoginPopup">
|
||||
@hanldeShowGoodSku="hanldeShowGoodSku">
|
||||
<template #tip>
|
||||
<view class="tip-box" v-if="state.showTip && state.goodsDetailData.groupPromotionResult">
|
||||
<view class="title">当前团购活动规则:</view>
|
||||
@@ -57,20 +57,17 @@
|
||||
: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, queryUserInfo } from '@/core/api';
|
||||
import { queryActivityDetial, queryCartNum, queryShare, queryAddCart } from '@/core/api';
|
||||
import { PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import type { Response } from '@/core/models';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useCartStore, useUserInfoStore } from '@/core/store';
|
||||
import { useCartStore, useLoginStore } from '@/core/store';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
@@ -82,9 +79,10 @@
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
/** 购物车store */
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const state = reactive<{
|
||||
@@ -96,7 +94,6 @@
|
||||
id : number;
|
||||
showTip : boolean;
|
||||
spesDesc : string;
|
||||
showLoginModal : boolean;
|
||||
timeData : {
|
||||
days : number,
|
||||
hours : number,
|
||||
@@ -112,7 +109,6 @@
|
||||
id: 0,
|
||||
showTip: true,
|
||||
spesDesc: "",
|
||||
showLoginModal: false,
|
||||
timeData: {
|
||||
days: 0,
|
||||
hours: 0,
|
||||
@@ -175,11 +171,9 @@
|
||||
|
||||
/** 立即购买,打开sku弹框 */
|
||||
const hanldeShowGoodSku = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.showSku = true;
|
||||
_useLoginStore.checkLogin(() => {
|
||||
state.showSku = true;
|
||||
});
|
||||
}
|
||||
|
||||
/** 立即秒杀 */
|
||||
@@ -199,26 +193,6 @@
|
||||
handleShowToast(addCart.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 显示登录弹框 */
|
||||
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 () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false">
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class="goods-detail">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:swiperBanner="state.swiperBanner" :shareType="ShareEnum.pinTuan" @handleShowLoginPopup="handleShowLoginPopup"
|
||||
:swiperBanner="state.swiperBanner" :shareType="ShareEnum.pinTuan"
|
||||
:goodsDetailContent="state.goodsDetailContent" :isActivityGoods="true">
|
||||
<template #activityGoodsOtheService>
|
||||
<view class="pinTuan-record" v-if="state.goodsDetailData?.pinTuanRecord?.length > 0">
|
||||
@@ -64,21 +64,17 @@
|
||||
<GoodsDetailSkuPopup :showSku="state.showSku" :goodsDetailData="state.goodsDetailData"
|
||||
:isShowAddCartBtn="false" @handleChangePopup="handleChangePopup" @handleBuyNow="handleBuyNow"
|
||||
:btnBuyTitlt="state.btnBuyTitlt">
|
||||
</GoodsDetailSkuPopup>
|
||||
|
||||
<!-- 登录弹框 -->
|
||||
<coreshop-login-modal :show="state.showLoginModal" @handleChangePopup="handleChangeLoginPopup"
|
||||
@getUserInfo="getUserInfo"></coreshop-login-modal>
|
||||
</GoodsDetailSkuPopup>
|
||||
</view>
|
||||
</coreshop-page>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { queryPinTuanGoodsDetail, queryUserInfo, queryCartNum, queryAddCart, queryOrderPinTuanTeamInfo } from '@/core/api';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import { queryPinTuanGoodsDetail, queryCartNum, queryAddCart, queryOrderPinTuanTeamInfo } from '@/core/api';
|
||||
import type { Response } from '@/core/models';
|
||||
import { UserToken } from '@/core/consts'
|
||||
import { useCartStore, useUserInfoStore } from '@/core/store';
|
||||
import { useCartStore, useLoginStore } 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';
|
||||
@@ -93,8 +89,8 @@
|
||||
teamId ?: number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
/** 获取购物车数据 */
|
||||
const cartStore = useCartStore();
|
||||
@@ -111,8 +107,7 @@
|
||||
teamId : number;
|
||||
isSingleBuy : boolean;
|
||||
btnBuyTitlt : string;
|
||||
teamInfo : any;
|
||||
showLoginModal : boolean;
|
||||
teamInfo : any;
|
||||
}>({
|
||||
id: 0,
|
||||
goodsDetailData: {},
|
||||
@@ -125,8 +120,7 @@
|
||||
teamId: 0,
|
||||
isSingleBuy: true,
|
||||
btnBuyTitlt: "发起拼团",
|
||||
teamInfo: {},
|
||||
showLoginModal: false,
|
||||
teamInfo: {},
|
||||
});
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -193,28 +187,24 @@
|
||||
|
||||
/** 单独购买 */
|
||||
const handleSingleBuy = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.teamId = 0;
|
||||
state.showSku = true;
|
||||
state.isSingleBuy = true;
|
||||
state.btnBuyTitlt = '单独购买';
|
||||
state.goodsDetailData.skuList.sku_list = state.defaultSkuList;
|
||||
_useLoginStore.checkLogin(() => {
|
||||
state.teamId = 0;
|
||||
state.showSku = true;
|
||||
state.isSingleBuy = true;
|
||||
state.btnBuyTitlt = '单独购买';
|
||||
state.goodsDetailData.skuList.sku_list = state.defaultSkuList;
|
||||
});
|
||||
}
|
||||
|
||||
/** 拼团购买 */
|
||||
const handleMultipleBuy = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.teamId = 0;
|
||||
state.showSku = true;
|
||||
state.isSingleBuy = false;
|
||||
state.btnBuyTitlt = '发起拼团';
|
||||
state.goodsDetailData.skuList.sku_list = state.activitySkuList;
|
||||
_useLoginStore.checkLogin(() => {
|
||||
state.teamId = 0;
|
||||
state.showSku = true;
|
||||
state.isSingleBuy = false;
|
||||
state.btnBuyTitlt = '发起拼团';
|
||||
state.goodsDetailData.skuList.sku_list = state.activitySkuList;
|
||||
});
|
||||
}
|
||||
|
||||
/** 去拼单 */
|
||||
@@ -271,27 +261,7 @@
|
||||
} else {
|
||||
handleShowToast(addCart.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 显示登录弹框 */
|
||||
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>
|
||||
@import './detail.scss';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false">
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class="goods-detail">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc" @handleShowLoginPopup="handleShowLoginPopup"
|
||||
:swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
|
||||
:goodsDetailContent="state.goodsDetailContent" :isActivityGoods="true" :shareType="ShareEnum.seckill"
|
||||
@hanldeShowGoodSku="hanldeShowGoodSku">
|
||||
<template #tip>
|
||||
@@ -56,10 +56,6 @@
|
||||
<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>
|
||||
@@ -70,7 +66,7 @@
|
||||
import { PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useCartStore, useUserInfoStore } from '@/core/store';
|
||||
import { useCartStore, useUserInfoStore ,useLoginStore} from '@/core/store';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
@@ -81,9 +77,9 @@
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
||||
@@ -95,8 +91,7 @@
|
||||
shareUrl : string;
|
||||
id : number;
|
||||
showTip : boolean;
|
||||
spesDesc : string;
|
||||
showLoginModal : boolean;
|
||||
spesDesc : string;
|
||||
timeData : {
|
||||
days : number,
|
||||
hours : number,
|
||||
@@ -111,8 +106,7 @@
|
||||
shareUrl: "",
|
||||
id: 0,
|
||||
showTip: true,
|
||||
spesDesc: "",
|
||||
showLoginModal: false,
|
||||
spesDesc: "",
|
||||
timeData: {
|
||||
days: 0,
|
||||
hours: 0,
|
||||
@@ -175,11 +169,9 @@
|
||||
|
||||
/** 立即购买,打开sku弹框 */
|
||||
const hanldeShowGoodSku = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.showSku = true;
|
||||
_useLoginStore.checkLogin(() => {
|
||||
state.showSku = true;
|
||||
});
|
||||
}
|
||||
|
||||
/** 立即秒杀 */
|
||||
@@ -198,27 +190,7 @@
|
||||
} else {
|
||||
handleShowToast(addCart.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 显示登录弹框 */
|
||||
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 () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<coreshop-page title="接龙详情" mode="left" bgColor="#D33123" titleColor="#fff">
|
||||
<coreshop-page title="接龙详情" mode="left" bgColor="#D33123" titleColor="#fff" showLoginModalDom>
|
||||
<view class="layout-solitaire-box">
|
||||
<view class="config-box">
|
||||
<image class="img" :src="shopConfigStore?.config?.shopLogo"></image>
|
||||
@@ -92,34 +92,29 @@
|
||||
<!-- 分享弹框 -->
|
||||
<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, queryUserInfo } from '@/core/api';
|
||||
import { querySolitaireDetail, queryShare, queryAddCart, queryRemoveCart } from '@/core/api';
|
||||
import { ShareClientEnum, ShareModelEnum, ShareEnum, EmptyEnum, PaymentTypeEnum, AddCartEnum } from '@/core/enum';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import type { Response } from '@/core/models';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useShopConfigStore, useUserInfoStore } from '@/core/store';
|
||||
import { useShopConfigStore, useLoginStore } 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';
|
||||
|
||||
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
// 获取项目配置
|
||||
/** 获取项目配置 */
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
|
||||
const state = reactive<{
|
||||
@@ -130,7 +125,6 @@
|
||||
totalprice : number;
|
||||
shareUrl : string;
|
||||
showShare : boolean;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
id: 0,
|
||||
solitaireInfo: {},
|
||||
@@ -139,7 +133,6 @@
|
||||
totalprice: 0,
|
||||
shareUrl: "",
|
||||
showShare: false,
|
||||
showLoginModal: false,
|
||||
});
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -207,29 +200,27 @@
|
||||
|
||||
/**立即购买 */
|
||||
const handleBuyNow = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
if (state.totalprice == 0) {
|
||||
handleShowToast('请先选择商品');
|
||||
return;
|
||||
}
|
||||
if (state.totalprice < state.solitaireInfo.startBuyPrice) {
|
||||
handleShowToast(`最小购买价格为${state.solitaireInfo.startBuyPrice}元,请增加购买产品`)
|
||||
return true
|
||||
}
|
||||
let ids : Array<number> = [];
|
||||
state.goodsData.forEach((item : any) => {
|
||||
if (item.num > 0) {
|
||||
ids.push(item.addCardId)
|
||||
_useLoginStore.checkLogin(() => {
|
||||
if (state.totalprice == 0) {
|
||||
handleShowToast('请先选择商品');
|
||||
return;
|
||||
}
|
||||
if (state.totalprice < state.solitaireInfo.startBuyPrice) {
|
||||
handleShowToast(`最小购买价格为${state.solitaireInfo.startBuyPrice}元,请增加购买产品`)
|
||||
return true
|
||||
}
|
||||
let ids : Array<number> = [];
|
||||
state.goodsData.forEach((item : any) => {
|
||||
if (item.num > 0) {
|
||||
ids.push(item.addCardId)
|
||||
}
|
||||
});
|
||||
if (ids.length > 0) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/order/submit/submit?orderType=${PaymentTypeEnum.solitaire}&objectId=${state.id}&cartIds=${ids.join(',')}`)
|
||||
} else {
|
||||
handleShowToast('请先选择商品');
|
||||
}
|
||||
});
|
||||
if (ids.length > 0) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/order/submit/submit?orderType=${PaymentTypeEnum.solitaire}&objectId=${state.id}&cartIds=${ids.join(',')}`)
|
||||
} else {
|
||||
handleShowToast('请先选择商品');
|
||||
}
|
||||
}
|
||||
|
||||
/** 联系商家 */
|
||||
@@ -239,21 +230,6 @@
|
||||
phoneNumber: shopConfigStore?.config?.shopMobile
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开获取关闭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 */
|
||||
@@ -280,11 +256,9 @@
|
||||
|
||||
/** 分享弹框显示与否 */
|
||||
const handleToggleShowShare = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.showShare = !state.showShare;
|
||||
_useLoginStore.checkLogin(() => {
|
||||
state.showShare = !state.showShare;
|
||||
})
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<coreshop-page title="优惠券" mode="left">
|
||||
<coreshop-page title="优惠券" mode="left" showLoginModalDom>
|
||||
<view>
|
||||
<view class="content-box p-25" v-if="state.couponList.length > 0">
|
||||
<view v-for="item, index in state.couponList" :key="index" class="coupon-box">
|
||||
@@ -52,39 +52,32 @@
|
||||
<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, queryUserInfo } from '@/core/api';
|
||||
import { queryCouponList, queryReceiveCoupon } from '@/core/api';
|
||||
import { onReachBottom } from '@dcloudio/uni-app';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import type { Response } 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';
|
||||
import { useLoginStore } from '@/core/store';
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
const state = reactive<{
|
||||
couponList : Array<any>;
|
||||
totalPages : number;
|
||||
page : number;
|
||||
limit : number;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
couponList: [],
|
||||
totalPages: 1,
|
||||
page: 1,
|
||||
limit: 10,
|
||||
showLoginModal: false,
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
@@ -118,21 +111,19 @@
|
||||
})
|
||||
|
||||
/** 立即领取 */
|
||||
const handleReceiveCoupon = async (id : number) => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
});
|
||||
const receiveCoupon = await queryReceiveCoupon({ id, });
|
||||
uni.hideLoading();
|
||||
if (receiveCoupon.status) {
|
||||
handleShowToast('领取成功', 'success');
|
||||
} else {
|
||||
handleShowToast(receiveCoupon.msg);
|
||||
}
|
||||
const handleReceiveCoupon = (id : number) => {
|
||||
_useLoginStore.checkLogin(async () => {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
});
|
||||
const receiveCoupon = await queryReceiveCoupon({ id, });
|
||||
uni.hideLoading();
|
||||
if (receiveCoupon.status) {
|
||||
handleShowToast('领取成功', 'success');
|
||||
} else {
|
||||
handleShowToast(receiveCoupon.msg);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 查看使用规则 */
|
||||
@@ -146,21 +137,6 @@
|
||||
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';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<coreshop-page :title="state.formInfo?.name || '表单详情'" mode="left">
|
||||
<coreshop-page :title="state.formInfo?.name || '表单详情'" mode="left" showLoginModalDom>
|
||||
<view class="layout-form-box">
|
||||
<view class="form-head">
|
||||
<view class="swiper"
|
||||
@@ -128,24 +128,21 @@
|
||||
<view class="btn-box" @click="handleSubmit">
|
||||
<view class="p-20">
|
||||
<view class="btn" :style="{ 'background-color': state.formInfo?.buttonColor }">
|
||||
{{ state.formInfo?.buttonName }}</view>
|
||||
{{ 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 ,queryUserInfo} from '@/core/api';
|
||||
import type { Response, CityAddressType ,UserInfoType} from '@/core/models';
|
||||
import { queryFormDetial, queryUploadImages, queryAddSubmit, queryShare } from '@/core/api';
|
||||
import type { Response, CityAddressType } from '@/core/models';
|
||||
import { handleShowToast, handleStaticResources, handleRouteRedirectTo, handleRouteSwitchTab, chooseImage, getSetting } from '@/core/utils';
|
||||
import { queryAreas } from '@/core/api';
|
||||
import { useUserInfoStore } from '@/core/store';
|
||||
import { useLoginStore } 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';
|
||||
@@ -154,10 +151,10 @@
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
const datePicker = ref();
|
||||
const timePicker = ref();
|
||||
|
||||
@@ -171,7 +168,6 @@
|
||||
goodsDetailData : any;
|
||||
paymentType : number,
|
||||
shareUrl : string;
|
||||
showLoginModal:boolean;
|
||||
}>({
|
||||
formInfo: {},
|
||||
id: 0,
|
||||
@@ -182,7 +178,6 @@
|
||||
goodsDetailData: {},
|
||||
paymentType: 0,
|
||||
shareUrl: "",
|
||||
showLoginModal:false,
|
||||
})
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -254,22 +249,7 @@
|
||||
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 = {
|
||||
@@ -403,60 +383,58 @@
|
||||
}
|
||||
|
||||
/** 按钮提交 */
|
||||
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;
|
||||
}
|
||||
const handleSubmit = () => {
|
||||
_useLoginStore.checkLogin(async () => {
|
||||
|
||||
/** 判断图片的 */
|
||||
let images = state.formInfo.items.find((item : any) => item.type === FormTypeEnum.image && item.required && item.defaultValue.length == 0);
|
||||
if (images) {
|
||||
handleShowToast(`${images.name}不能为空`); return;
|
||||
}
|
||||
|
||||
/** 判断商品的 */
|
||||
let goods = state.formInfo.items.find((item : any) => item.type === FormTypeEnum.goods && item.required && item.defaultValue.length == 0);
|
||||
if (goods) {
|
||||
handleShowToast(`${goods.name}不能为空`); return;
|
||||
}
|
||||
|
||||
let submitData = state.formInfo.items.map((item : any) => {
|
||||
if (item.type === FormTypeEnum.image) {
|
||||
return {
|
||||
key: item.id,
|
||||
value: item.defaultValue.join(',')
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
key: item.id,
|
||||
value: item.defaultValue
|
||||
}
|
||||
let data = state.formInfo.items.find((item : any) => item.required && !item.defaultValue);
|
||||
if (data) {
|
||||
handleShowToast(`${data.name}不能为空`); return;
|
||||
}
|
||||
});
|
||||
const form : Response<any> = await queryAddSubmit({
|
||||
data: submitData,
|
||||
id: state.id,
|
||||
token: uni.getStorageSync(UserToken)
|
||||
});
|
||||
if (form.status) {
|
||||
handleShowToast(form.msg, 'success', () => {
|
||||
setTimeout(() => {
|
||||
if (state.formInfo.type == 1 || state.formInfo.type == 2) {
|
||||
handleRouteRedirectTo(`/pages/subpackage/order/pay/pay?formId=${form.data.formSubmitId}&orderType=${state.paymentType}&recharge=${form.data.money}`);
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
|
||||
/** 判断图片的 */
|
||||
let images = state.formInfo.items.find((item : any) => item.type === FormTypeEnum.image && item.required && item.defaultValue.length == 0);
|
||||
if (images) {
|
||||
handleShowToast(`${images.name}不能为空`); return;
|
||||
}
|
||||
|
||||
/** 判断商品的 */
|
||||
let goods = state.formInfo.items.find((item : any) => item.type === FormTypeEnum.goods && item.required && item.defaultValue.length == 0);
|
||||
if (goods) {
|
||||
handleShowToast(`${goods.name}不能为空`); return;
|
||||
}
|
||||
|
||||
let submitData = state.formInfo.items.map((item : any) => {
|
||||
if (item.type === FormTypeEnum.image) {
|
||||
return {
|
||||
key: item.id,
|
||||
value: item.defaultValue.join(',')
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
} else {
|
||||
handleShowToast(form.msg)
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
key: item.id,
|
||||
value: item.defaultValue
|
||||
}
|
||||
}
|
||||
});
|
||||
const form : Response<any> = await queryAddSubmit({
|
||||
data: submitData,
|
||||
id: state.id,
|
||||
token: uni.getStorageSync(UserToken)
|
||||
});
|
||||
if (form.status) {
|
||||
handleShowToast(form.msg, 'success', () => {
|
||||
setTimeout(() => {
|
||||
if (state.formInfo.type == 1 || state.formInfo.type == 2) {
|
||||
handleRouteRedirectTo(`/pages/subpackage/order/pay/pay?formId=${form.data.formSubmitId}&orderType=${state.paymentType}&recharge=${form.data.money}`);
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
} else {
|
||||
handleShowToast(form.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false">
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<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"
|
||||
@hanldeShowGoodSku="hanldeShowGoodSku" @handleShowLoginPopup="handleShowLoginPopup">
|
||||
@hanldeShowGoodSku="hanldeShowGoodSku">
|
||||
</GoodsDetail>
|
||||
|
||||
<!-- 为您推荐 -->
|
||||
@@ -15,16 +15,11 @@
|
||||
<!-- 商品sku弹框 -->
|
||||
<GoodsDetailSkuPopup :showSku="state.showSku" :goodsDetailData="state.goodsDetailData"
|
||||
@handleAddCart="handleAddCart" @handleChangeGoodSku="handleChangeGoodSku" :safeAreaInsetBottom="false"
|
||||
@handleChangePopup="handleChangePopup" @handleBuyNow="handleBuyNow"
|
||||
@handleShowLoginPopup="handleShowLoginPopup"></GoodsDetailSkuPopup>
|
||||
@handleChangePopup="handleChangePopup" @handleBuyNow="handleBuyNow"></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>
|
||||
@@ -33,25 +28,26 @@
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryGoodsDetail, queryCartNum, queryShare, queryGoodsDetailByToken, queryPromotionList, queryAddCart, queryUserInfo } from '@/core/api';
|
||||
import type { UserInfoType, Response, GoodsAgentListType, GoodsPromotionType, GoodsSkuListType } from "@/core/models";
|
||||
import type { 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, useUserInfoStore } from '@/core/store';
|
||||
import { useCartStore } from '@/core/store';
|
||||
import { handleRouteNavigateTo, handleShowToast } from '@/core/utils';
|
||||
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
import GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
|
||||
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';
|
||||
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
const cartStore = useCartStore();
|
||||
/** 购物车store */
|
||||
const _useCartStore = useCartStore();
|
||||
|
||||
const state = reactive<{
|
||||
goodsDetailData : any;
|
||||
@@ -64,7 +60,6 @@
|
||||
showSku : boolean;
|
||||
skuPrice : Number;
|
||||
shareUrl : string;
|
||||
showLoginModal : boolean;
|
||||
}>({
|
||||
goodsDetailData: {},
|
||||
swiperBanner: [],
|
||||
@@ -76,7 +71,6 @@
|
||||
showSku: false,
|
||||
skuPrice: 0,
|
||||
shareUrl: "",
|
||||
showLoginModal: false,
|
||||
})
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -139,7 +133,7 @@
|
||||
/** 获取购物车数量 */
|
||||
const getCartNum = async () => {
|
||||
const num : Response<number> = await queryCartNum();
|
||||
cartStore.setCartNum(num?.data || 0);
|
||||
_useCartStore.setCartNum(num?.data || 0);
|
||||
}
|
||||
|
||||
/** 获取商品促销列表 */
|
||||
@@ -152,11 +146,7 @@
|
||||
|
||||
/** 立即购买,打开sku弹框 */
|
||||
const hanldeShowGoodSku = () => {
|
||||
if (!uni.getStorageSync(UserToken)) {
|
||||
state.showLoginModal = true;
|
||||
return;
|
||||
}
|
||||
state.showSku = true;
|
||||
_useLoginStore.checkLogin(() => state.showSku = true);
|
||||
}
|
||||
|
||||
/** sku弹框显示隐藏 */
|
||||
@@ -179,6 +169,7 @@
|
||||
});
|
||||
if (addCart.status) {
|
||||
handleShowToast(addCart.msg, 'success');
|
||||
|
||||
/** 添加成功后,重新获取购物车数量 */
|
||||
getCartNum();
|
||||
/** 关闭sku弹框 */
|
||||
@@ -205,26 +196,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 显示登录弹框 */
|
||||
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 = {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
import { queryGoodsBrowsing, queryDelGoodsBrowsing, queryGoodsCollection } from '@/core/api';
|
||||
import type { Response, GoodsFootprintType } from '@/core/models';
|
||||
import { EmptyEnum } from '@/core/enum';
|
||||
import { handleShowToast } from '@/core/utils';
|
||||
import { handleShowToast, showToast } from '@/core/utils';
|
||||
|
||||
const state = reactive<{
|
||||
list : Array<GoodsFootprintType>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false">
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class="layout-goods-detail">
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:swiperBanner="state.swiperBanner" :goodsDetailContent="state.goodsDetailContent"
|
||||
@@ -77,22 +77,17 @@
|
||||
</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 ,UserInfoType} from '@/core/models';
|
||||
import { queryServiceDetail, queryAddServiceOrder ,queryUserInfo} from '@/core/api';
|
||||
import type { Response, ServiceGoodsType } from '@/core/models';
|
||||
import { queryServiceDetail, queryAddServiceOrder } 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 { useUserInfoStore, useLoginStore } from '@/core/store';
|
||||
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';
|
||||
@@ -100,22 +95,20 @@
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
}
|
||||
|
||||
/** 获取用户数据 */
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
|
||||
/** 登录store */
|
||||
const _useLoginStore = useLoginStore();
|
||||
|
||||
const state = reactive<{
|
||||
id : number;
|
||||
goodsDetailData : ServiceGoodsType,
|
||||
swiperBanner : Array<string>;
|
||||
goodsDetailContent : string;
|
||||
showLoginModal:boolean;
|
||||
}>({
|
||||
id: 0,
|
||||
goodsDetailData: {},
|
||||
swiperBanner: [],
|
||||
goodsDetailContent: "",
|
||||
showLoginModal:false,
|
||||
});
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -157,35 +150,16 @@
|
||||
}
|
||||
|
||||
/** 立即购买 */
|
||||
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}`);
|
||||
} else {
|
||||
handleShowToast(serviceOrder.msg)
|
||||
}
|
||||
const handleBuyNow = () => {
|
||||
_useLoginStore.checkLogin(async () => {
|
||||
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}`);
|
||||
} else {
|
||||
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';
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
Reference in New Issue
Block a user