优化
This commit is contained in:
10
src/api/groupbuy/index.ts
Normal file
10
src/api/groupbuy/index.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { get } from '@/utils/request';
|
||||||
|
|
||||||
|
export const getGroupBuyList = (data: {
|
||||||
|
pageNum: string,
|
||||||
|
pageSize: string,
|
||||||
|
obj: {
|
||||||
|
companyId: string,
|
||||||
|
}
|
||||||
|
}) => get({ url: '/wc/coupons/group/pageList', data });
|
||||||
|
|
@@ -17,7 +17,8 @@ enum URL {
|
|||||||
addressCreate = '/ext/addr/create',
|
addressCreate = '/ext/addr/create',
|
||||||
addressUpdate = '/ext/addr/update',
|
addressUpdate = '/ext/addr/update',
|
||||||
addressDelete = '/ext/addr/delete',
|
addressDelete = '/ext/addr/delete',
|
||||||
dynamicCode = '/member/dynccode'
|
dynamicCode = '/member/dynccode',
|
||||||
|
rechargeList = '/ext/recharge/rule_config'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getUserProfile = () => get<UserState>({ url: URL.profile });
|
export const getUserProfile = () => get<UserState>({ url: URL.profile });
|
||||||
@@ -30,14 +31,13 @@ export const logout = () => post<any>({ url: URL.logout });
|
|||||||
|
|
||||||
export const getAddressList = () => get<any>({ url: URL.addressList });
|
export const getAddressList = () => get<any>({ url: URL.addressList });
|
||||||
export const getAddressDetail = (id: string) => get<any>({ url: URL.addressDetail + `?id=${id}` });
|
export const getAddressDetail = (id: string) => get<any>({ url: URL.addressDetail + `?id=${id}` });
|
||||||
|
|
||||||
export const addressCreate = (data: any) => post<any>({ url: URL.addressCreate, data });
|
export const addressCreate = (data: any) => post<any>({ url: URL.addressCreate, data });
|
||||||
export const addressUpdate = (data: any) => post<any>({ url: URL.addressUpdate, data });
|
export const addressUpdate = (data: any) => post<any>({ url: URL.addressUpdate, data });
|
||||||
export const addressDelete = (id: string) => post<any>({ url: URL.addressDelete + `?id=${id}` });
|
export const addressDelete = (id: string) => post<any>({ url: URL.addressDelete + `?id=${id}` });
|
||||||
|
|
||||||
export const getDynamicCode = () => post<any>({ url: URL.dynamicCode });
|
export const getDynamicCode = () => post<any>({ url: URL.dynamicCode });
|
||||||
|
|
||||||
export const getCouponList = (params: {
|
export const getRechargeList = () => get<any>({ url: URL.rechargeList });
|
||||||
obj: { memberId: string, status: number },
|
|
||||||
pageNum: number,
|
export const getCouponList = (data: any) => post<any>({ url: '/couponseUse/pageList', data });
|
||||||
pageSize: number
|
|
||||||
}) => get<any>({ url: '/couponseUse/pageList' });
|
|
||||||
|
@@ -58,6 +58,12 @@
|
|||||||
"navigationBarBackgroundColor": "#F32B2B"
|
"navigationBarBackgroundColor": "#F32B2B"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "groupbuy/detail",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "商品团购券"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "webview/index",
|
"path": "webview/index",
|
||||||
"navigationBarTitleText": "网页"
|
"navigationBarTitleText": "网页"
|
||||||
@@ -95,6 +101,12 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "购物车"
|
"navigationBarTitleText": "购物车"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "search/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "搜索"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
11
src/pages/common/groupbuy/detail.vue
Normal file
11
src/pages/common/groupbuy/detail.vue
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang='ts' setup>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
|
||||||
|
</style>
|
@@ -34,8 +34,13 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
import { getGroupBuyList } from '@/api/groupbuy';
|
||||||
|
|
||||||
const tabIndex = ref(0);
|
const tabIndex = ref(0);
|
||||||
|
|
||||||
|
onLoad((e) => {
|
||||||
|
getGroupBuyList();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
@@ -51,7 +56,7 @@ const tabIndex = ref(0);
|
|||||||
border-radius: 30rpx 0 0 0;
|
border-radius: 30rpx 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-item:nth-of-type(2) {
|
.tab-item:nth-of-type(2) {
|
||||||
border-radius: 0 30rpx 0 0;
|
border-radius: 0 30rpx 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,6 +81,7 @@ const tabIndex = ref(0);
|
|||||||
|
|
||||||
.scroll-view {
|
.scroll-view {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
padding: 40rpx 30rpx;
|
padding: 40rpx 30rpx;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
<text>会员充值</text>
|
<text>会员充值</text>
|
||||||
</view>
|
</view>
|
||||||
<view class='divider' style='margin: 0;height: 153rpx' />
|
<view class='divider' style='margin: 0;height: 153rpx' />
|
||||||
<view @click.stop='goPath("/pages/mine/subs/coupon/coupon-list")'>
|
<view @click.stop='goPath("/pages/mine/subs/coupon/index")'>
|
||||||
<image :src='assetsUrl("ic_coupon.png")' style='width: 108rpx;height: 95rpx' />
|
<image :src='assetsUrl("ic_coupon.png")' style='width: 108rpx;height: 95rpx' />
|
||||||
<text>优惠券</text>
|
<text>优惠券</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -94,7 +94,7 @@ const submenuList = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
onLoad(async (e) => {
|
onLoad(async (e) => {
|
||||||
const data = await getCompanyInfo('1471673498334113794');
|
const data = await getCompanyInfo(userInfo.value.companyId);
|
||||||
bannerList.value = data.bannerinx?.map((res: { src: string }) => res.src);
|
bannerList.value = data.bannerinx?.map((res: { src: string }) => res.src);
|
||||||
recommendBannerList.value = data.bannerhot?.map((res: { src: string }) => res.src);
|
recommendBannerList.value = data.bannerhot?.map((res: { src: string }) => res.src);
|
||||||
});
|
});
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class='content'>
|
<view class='content'>
|
||||||
<view class='search-view'>
|
<view class='search-view'>
|
||||||
<view class='search-input'>
|
<view class='search-input' @click.stop='goPath("/pages/mall/subs/search/index")'>
|
||||||
<image :src=' assetsUrl("ic_search.png")'></image>
|
<image :src=' assetsUrl("ic_search.png")'></image>
|
||||||
<input placeholder='输入名称、款号搜索' />
|
<input placeholder='输入名称、款号搜索' />
|
||||||
</view>
|
</view>
|
||||||
|
@@ -1,10 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class='content'>
|
<view class='content'>
|
||||||
<swiper class='swiper' :interval='1500' :duration='1000'>
|
<view class='swiper-container'>
|
||||||
<swiper-item v-for='(item,index) in bannerList' :key='index'>
|
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
|
||||||
<image src='/static/images/test_bg.png' />
|
<swiper-item v-for='(item,index) in bannerList' :key='index'>
|
||||||
</swiper-item>
|
<image src='/static/images/test_bg.png' />
|
||||||
</swiper>
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
<view class='indicator'>
|
||||||
|
<text>{{ swiperIndex + 1 }}</text>
|
||||||
|
<text>/{{ bannerList.length }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class='goods-info-view c-flex-column'>
|
<view class='goods-info-view c-flex-column'>
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
@@ -16,7 +22,7 @@
|
|||||||
<text>女童夏装套装洋气装短袖阔腿裤子夏装夏装套装</text>
|
<text>女童夏装套装洋气装短袖阔腿裤子夏装夏装套装</text>
|
||||||
<view class='share-button c-flex-column'>
|
<view class='share-button c-flex-column'>
|
||||||
<image :src='assetsUrl("ic_share.png")'></image>
|
<image :src='assetsUrl("ic_share.png")'></image>
|
||||||
<text>分享</text>
|
<button class='btn' plain open-type='share'>分享</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -51,13 +57,13 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='bottom-view c-flex-row'>
|
<view class='bottom-view c-flex-row'>
|
||||||
<view class='small-button-view'>
|
<view class='small-button-view' @click.stop='goBack'>
|
||||||
<view class='small-button-item'>
|
<view class='small-button-item'>
|
||||||
<image :src='assetsUrl("ic_goods_store.png")' />
|
<image :src='assetsUrl("ic_goods_store.png")' />
|
||||||
<text>商家</text>
|
<text>商家</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='small-button-item'>
|
<view class='small-button-item' @click.stop='goPath("/pages/mine/subs/order/order-list")'>
|
||||||
<image :src='assetsUrl("ic_goods_order.png")' />
|
<image :src='assetsUrl("ic_goods_order.png")' />
|
||||||
<text>订单</text>
|
<text>订单</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -88,6 +94,15 @@ import SkuDialog from '../components/sku-dialog.vue';
|
|||||||
const skuDialogRef = ref();
|
const skuDialogRef = ref();
|
||||||
|
|
||||||
const bannerList = ref([1, 2, 3, 4]);
|
const bannerList = ref([1, 2, 3, 4]);
|
||||||
|
const swiperIndex = ref(0);
|
||||||
|
|
||||||
|
const swiperChange = (e: any) => {
|
||||||
|
swiperIndex.value = e.detail.current;
|
||||||
|
};
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
uni.navigateBack();
|
||||||
|
};
|
||||||
|
|
||||||
const showSkuDialog = () => {
|
const showSkuDialog = () => {
|
||||||
skuDialogRef.value.show();
|
skuDialogRef.value.show();
|
||||||
@@ -110,14 +125,38 @@ const placeOrder = () => {
|
|||||||
padding-bottom: 200rpx;
|
padding-bottom: 200rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.swiper {
|
.swiper-container {
|
||||||
display: flex;
|
position: relative;
|
||||||
width: 100%;
|
|
||||||
height: 750rpx;
|
|
||||||
|
|
||||||
image {
|
.swiper {
|
||||||
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 750rpx;
|
height: 750rpx;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
height: 750rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.indicator {
|
||||||
|
background: rgba(1, 1, 1, 0.5);
|
||||||
|
border-radius: 45rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
position: absolute;
|
||||||
|
right: 20rpx;
|
||||||
|
bottom: 20rpx;
|
||||||
|
padding: 5rpx 25rpx;
|
||||||
|
|
||||||
|
text:nth-of-type(1) {
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
text:nth-of-type(2) {
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,16 +198,19 @@ const placeOrder = () => {
|
|||||||
.share-button {
|
.share-button {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
text {
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #636566;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 36rpx;
|
width: 36rpx;
|
||||||
height: 32rpx;
|
height: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
background: #00000000;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #636566;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding: 0;
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-show='tabIndex==1' class='address-view c-flex-column'>
|
<view v-show='tabIndex==1' class='address-view c-flex-column'
|
||||||
|
@click.stop='goPath("/pages/mine/subs/address/address-list")'>
|
||||||
<view class='user-info c-flex-row'>
|
<view class='user-info c-flex-row'>
|
||||||
<text>默认</text>
|
<text>默认</text>
|
||||||
<text>黄先生</text>
|
<text>黄先生</text>
|
||||||
@@ -102,6 +103,7 @@
|
|||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
import PaymentDialog from '../components/payment-dialog.vue';
|
import PaymentDialog from '../components/payment-dialog.vue';
|
||||||
import CouponDialog from '@/pages/mall/subs/components/coupon-dialog.vue';
|
import CouponDialog from '@/pages/mall/subs/components/coupon-dialog.vue';
|
||||||
|
import { goPath } from '@/utils';
|
||||||
|
|
||||||
const couponDialogRef = ref();
|
const couponDialogRef = ref();
|
||||||
const paymentDialogRef = ref();
|
const paymentDialogRef = ref();
|
||||||
@@ -144,9 +146,16 @@ const payment = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab:nth-of-type(1) {
|
||||||
|
border-radius: 10rpx 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab:nth-of-type(2) {
|
||||||
|
border-radius: 0 10rpx 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-active {
|
.tab-active {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border-radius: 10rpx 0 10rpx 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab:nth-of-type(1) image {
|
.tab:nth-of-type(1) image {
|
||||||
|
109
src/pages/mall/subs/search/index.vue
Normal file
109
src/pages/mall/subs/search/index.vue
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<template>
|
||||||
|
<view class='content'>
|
||||||
|
<view class='search-view'>
|
||||||
|
<view class='search-input'>
|
||||||
|
<image :src='assetsUrl("ic_search.png")' />
|
||||||
|
<input placeholder='输入名称、款号搜索' />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<scroll-view class='goods-list' :scroll-y='true' type='custom'>
|
||||||
|
<grid-view type='masonry' :cross-axis-count='2'>
|
||||||
|
<view v-for='(item, index) in goodsList' :key='index' class='goods-item'
|
||||||
|
@click.stop='goPath(`/pages/mall/subs/goods/goods-detail?goodsId=${item.goodsId}`)'>
|
||||||
|
<image class='goods-image' :src='item.images' />
|
||||||
|
<text class='goods-name'>{{ item.goodsName }}</text>
|
||||||
|
<text class='goods-price'>¥{{ item.price }}</text>
|
||||||
|
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' />
|
||||||
|
</view>
|
||||||
|
</grid-view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang='ts' setup>
|
||||||
|
|
||||||
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
import { goPath } from '@/utils';
|
||||||
|
|
||||||
|
import { GoodsBean } from '@/api/goods/types';
|
||||||
|
|
||||||
|
const goodsList = ref<GoodsBean[]>([1, 2, 3, 4, 1, 2, 2, 2]);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100vh;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-view {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
background: white;
|
||||||
|
padding: 19rpx 30rpx;
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
background: #F7F7F7;
|
||||||
|
padding: 17rpx 23rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-list {
|
||||||
|
display: flex;
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
.goods-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
background: #666666;
|
||||||
|
padding: 10rpx 10rpx;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.goods-image {
|
||||||
|
border-radius: 10rpx;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 200rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-name {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #333333;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-price {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #F32B2B;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-image {
|
||||||
|
width: 42rpx;
|
||||||
|
height: 42rpx;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10rpx;
|
||||||
|
right: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@@ -25,7 +25,7 @@
|
|||||||
<text>{{ userInfo.balance }}</text>
|
<text>{{ userInfo.balance }}</text>
|
||||||
<text>余额</text>
|
<text>余额</text>
|
||||||
</view>
|
</view>
|
||||||
<view @click.stop='gotoPath("/pages/mine/subs/coupon/coupon-list")'>
|
<view @click.stop='gotoPath("/pages/mine/subs/coupon/index")'>
|
||||||
<text>3</text>
|
<text>3</text>
|
||||||
<text>优惠券</text>
|
<text>优惠券</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -98,7 +98,7 @@ const serviceList = [
|
|||||||
{
|
{
|
||||||
title: '消费记录',
|
title: '消费记录',
|
||||||
icon: assetsUrl('ic_member_service_record.png'),
|
icon: assetsUrl('ic_member_service_record.png'),
|
||||||
path: '/pages/mine/subs/trade/trade-list'
|
path: '/pages/mine/subs/trade/index'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '关注公众号',
|
title: '关注公众号',
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='bottom-button-view'>
|
<view class='bottom-button-view'>
|
||||||
<button class='primary-button'>保存地址</button>
|
<button class='primary-button' @click.stop='save'>保存地址</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -39,6 +39,26 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
import { addressCreate } from '@/api/user';
|
||||||
|
|
||||||
|
const save = () => {
|
||||||
|
addressCreate(
|
||||||
|
{
|
||||||
|
bean: {
|
||||||
|
'name': '高昂',
|
||||||
|
'mobile': '15475655487',
|
||||||
|
'zonecode': '420101001001',
|
||||||
|
'addr': '肯德基挂',
|
||||||
|
'defaultstatus': 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
@@ -9,6 +9,10 @@
|
|||||||
|
|
||||||
import CouponItem from './components/coupon-item.vue';
|
import CouponItem from './components/coupon-item.vue';
|
||||||
import { getCouponList } from '@/api/user';
|
import { getCouponList } from '@/api/user';
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
|
|
||||||
|
const store = useUserStore();
|
||||||
|
const { userInfo } = storeToRefs(store);
|
||||||
|
|
||||||
const coupons = ref([{
|
const coupons = ref([{
|
||||||
id: 1,
|
id: 1,
|
||||||
@@ -65,7 +69,7 @@ const coupons = ref([{
|
|||||||
onLoad(async () => {
|
onLoad(async () => {
|
||||||
const { data } = await getCouponList({
|
const { data } = await getCouponList({
|
||||||
obj: {
|
obj: {
|
||||||
memberId: item?.id, status: 0
|
memberId: userInfo.value?.id, status: 0
|
||||||
}, pageNum: 1, pageSize: 1000
|
}, pageNum: 1, pageSize: 1000
|
||||||
});
|
});
|
||||||
coupons.value = data.list;
|
coupons.value = data.list;
|
||||||
|
@@ -8,19 +8,19 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class='balance-content'>
|
<view class='balance-content'>
|
||||||
<text>当前余额(元)</text>
|
<text>当前余额(元)</text>
|
||||||
<text class='accent-text-color'>¥1</text>
|
<text class='accent-text-color'>¥{{ userInfo.balance }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='recharge-option-card'>
|
<view class='recharge-option-card'>
|
||||||
<text>充值金额</text>
|
<text>充值金额</text>
|
||||||
<tabbar :titles='rechargeItems?.map(res=>res.title)' @change='change' />
|
<tabbar :titles='rechargeItems?.map(res=>res.rechargeamount)' @change='change' />
|
||||||
<view class='divider' />
|
<view class='divider' />
|
||||||
<view class='option-item'>
|
<view class='option-item'>
|
||||||
<image :src='assetsUrl("bg_member_recharge_item.png")' />
|
<image :src='assetsUrl("bg_member_recharge_item.png")' />
|
||||||
<text>充值{{ rechargeItems[currentIndex].title }}送{{ rechargeItems[currentIndex].price / 10 }}元</text>
|
<text>充值{{ rechargeItems[currentIndex].rechargeamount }}送{{ rechargeItems[currentIndex].rewardamount }}元</text>
|
||||||
<text class='accent-text-color'>
|
<text class='accent-text-color'>
|
||||||
实得{{ rechargeItems[currentIndex].price + (rechargeItems[currentIndex].price / 10) }}元
|
实得{{ rechargeItems[currentIndex].rechargeamount + (rechargeItems[currentIndex].rewardamount) }}元
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -33,25 +33,20 @@
|
|||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
|
import { getRechargeList } from '@/api/user';
|
||||||
|
|
||||||
const rechargeItems = ref([
|
const store = useUserStore();
|
||||||
{
|
const { userInfo } = storeToRefs(store);
|
||||||
title: '100元',
|
|
||||||
price: 100
|
const rechargeItems = ref([]);
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '200元',
|
|
||||||
price: 200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '500元',
|
|
||||||
price: 500
|
|
||||||
}, {
|
|
||||||
title: '1000元',
|
|
||||||
price: 1000
|
|
||||||
}]);
|
|
||||||
const currentIndex = ref<number>(0);
|
const currentIndex = ref<number>(0);
|
||||||
|
|
||||||
|
onLoad(async () => {
|
||||||
|
const { rechargetype, ruleitems } = await getRechargeList();
|
||||||
|
rechargeItems.value = ruleitems;
|
||||||
|
});
|
||||||
|
|
||||||
const change = (index: number) => {
|
const change = (index: number) => {
|
||||||
currentIndex.value = index;
|
currentIndex.value = index;
|
||||||
};
|
};
|
||||||
|
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
<view class='qrcode-card'>
|
<view class='qrcode-card'>
|
||||||
<view class='balance-view'>
|
<view class='balance-view'>
|
||||||
<text class='balance-text'>账户余额:256.32元</text>
|
<text class='balance-text'>账户余额:{{ userInfo.balance || 0 }}元</text>
|
||||||
<view class='btn-recharge'>
|
<view class='btn-recharge' @click.stop='goPath("/pages/mine/subs/recharge/index")'>
|
||||||
<text>去充值</text>
|
<text>去充值</text>
|
||||||
<image :src='assetsUrl("ic_arrow_right.png")' />
|
<image :src='assetsUrl("ic_arrow_right.png")' />
|
||||||
</view>
|
</view>
|
||||||
@@ -42,18 +42,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { generateBarCode, generateQrCode } from '@/api/common';
|
|
||||||
import {getDynamicCode} from '@/api/user';
|
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
import { generateBarCode, generateQrCode } from '@/api/common';
|
||||||
|
import { getDynamicCode } from '@/api/user';
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
|
import { goPath } from '@/utils';
|
||||||
|
|
||||||
|
const store = useUserStore();
|
||||||
|
const { userInfo } = storeToRefs(store);
|
||||||
|
|
||||||
const code = ref<{ barCode: string, qrCode: string }>();
|
const code = ref<{ barCode: string, qrCode: string }>();
|
||||||
const codeContent = ref<string>(Date.now().toFixed(0));
|
const codeContent = ref<string>('');
|
||||||
const codeRefreshInterval = ref(30);
|
const codeRefreshInterval = ref(30);
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
generateCode();
|
generateCode();
|
||||||
// getDynamicCode()
|
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
codeRefreshInterval.value -= 1;
|
codeRefreshInterval.value -= 1;
|
||||||
@@ -66,6 +70,8 @@ onLoad(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const generateCode = async () => {
|
const generateCode = async () => {
|
||||||
|
const { dynccode } = await getDynamicCode();
|
||||||
|
codeContent.value = dynccode;
|
||||||
const barCode = await generateBarCode(codeContent.value);
|
const barCode = await generateBarCode(codeContent.value);
|
||||||
const qrCode = await generateQrCode(codeContent.value);
|
const qrCode = await generateQrCode(codeContent.value);
|
||||||
code.value = {
|
code.value = {
|
||||||
|
7
src/project.private.config.json
Normal file
7
src/project.private.config.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||||
|
"projectname": "VIP顾客中心",
|
||||||
|
"setting": {
|
||||||
|
"compileHotReLoad": true
|
||||||
|
}
|
||||||
|
}
|
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
|
|||||||
import type { providerType, UserState } from './types';
|
import type { providerType, UserState } from './types';
|
||||||
import { getUserProfile, login, logout as userLogout, register } from '@/api/user/index';
|
import { getUserProfile, login, logout as userLogout, register } from '@/api/user/index';
|
||||||
import { clearToken, setCompanyId, setToken } from '@/utils/auth';
|
import { clearToken, setCompanyId, setToken } from '@/utils/auth';
|
||||||
import type { RegisterParams } from '@/api/user/types';
|
import type { LoginResult, RegisterParams } from '@/api/user/types';
|
||||||
|
|
||||||
const useUserStore = defineStore('user', {
|
const useUserStore = defineStore('user', {
|
||||||
state: (): UserState => <UserState>({
|
state: (): UserState => <UserState>({
|
||||||
@@ -14,7 +14,8 @@ const useUserStore = defineStore('user', {
|
|||||||
telephone: '',
|
telephone: '',
|
||||||
balance: 0,
|
balance: 0,
|
||||||
integration: 0,
|
integration: 0,
|
||||||
birthday: ''
|
birthday: '',
|
||||||
|
companyId: ''
|
||||||
}),
|
}),
|
||||||
|
|
||||||
persist: {
|
persist: {
|
||||||
@@ -90,7 +91,8 @@ const useUserStore = defineStore('user', {
|
|||||||
const res = await login({
|
const res = await login({
|
||||||
code: result.code,
|
code: result.code,
|
||||||
userInfo: userInfo,
|
userInfo: userInfo,
|
||||||
referrerUserId: '1731886841265598466'
|
referrerUserId: '1727303781559697409'
|
||||||
|
// referrerUserId: '1731886841265598466'
|
||||||
});
|
});
|
||||||
|
|
||||||
if(res.user == undefined || res.user.id === null) {
|
if(res.user == undefined || res.user.id === null) {
|
||||||
@@ -106,12 +108,16 @@ const useUserStore = defineStore('user', {
|
|||||||
creatorId: res.user.creatorId,
|
creatorId: res.user.creatorId,
|
||||||
gender: res.user.gender
|
gender: res.user.gender
|
||||||
};
|
};
|
||||||
await this.userRegister(registerForm);
|
const registerResult = await this.userRegister(registerForm);
|
||||||
|
console.log(registerResult);
|
||||||
|
this.setUserInfo(registerResult as LoginResult);
|
||||||
|
setToken(res.token);
|
||||||
|
setCompanyId(res.user.companyId);
|
||||||
|
} else {
|
||||||
|
this.setUserInfo(res.user);
|
||||||
|
setToken(res.token);
|
||||||
|
setCompanyId(res.user.companyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setUserInfo(res.user);
|
|
||||||
setToken(res.token);
|
|
||||||
setCompanyId(res.user.companyId);
|
|
||||||
resolve(res);
|
resolve(res);
|
||||||
} else {
|
} else {
|
||||||
reject(new Error(result.errMsg));
|
reject(new Error(result.errMsg));
|
||||||
|
@@ -27,7 +27,7 @@ export function mpUpdate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showToast(title: string, icon: string = 'none', duration: number = 2000) {
|
export function showToast(title: string, icon: 'none' | 'success' | 'loading' | 'error' | 'fail' | 'exception' | undefined, duration: number = 2000) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title,
|
title,
|
||||||
icon,
|
icon,
|
||||||
|
@@ -27,6 +27,8 @@ function requestInterceptors() {
|
|||||||
if(token && config.header) {
|
if(token && config.header) {
|
||||||
config.header.token = token;
|
config.header.token = token;
|
||||||
config.header.companyid = getCompanyId();
|
config.header.companyid = getCompanyId();
|
||||||
|
|
||||||
|
// config.header.contentType = "x-www-form-urlencoded"
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
@@ -70,7 +72,7 @@ function responseInterceptors() {
|
|||||||
requestQueue.forEach(cb => cb());
|
requestQueue.forEach(cb => cb());
|
||||||
// 重试完了清空这个队列
|
// 重试完了清空这个队列
|
||||||
requestQueue = [];
|
requestQueue = [];
|
||||||
isRefreshing = false;
|
// isRefreshing = false;
|
||||||
// 重新执行本次请求
|
// 重新执行本次请求
|
||||||
return uni.$u.http.request(config);
|
return uni.$u.http.request(config);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user