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