功能完善

This commit is contained in:
2024-04-14 01:05:08 +08:00
parent a270c9be70
commit b676a1acd9
80 changed files with 118 additions and 52 deletions

View File

@@ -55,7 +55,7 @@
</view>
</view>
<view class='recommend-view c-flex-column'>
<view class='recommend-view c-flex-column' v-if='recommendList?.length>0'>
<text>浏览此商品的客户还浏览了</text>
<scroll-view scroll-x>
<view style='display: inline-block' v-for='(item, index) in recommendList'
@@ -164,12 +164,14 @@ const currentPageNum = ref(1);
onLoad(async (e: any) => {
if(isLogin()) {
await uni.showLoading();
groupBuyBean.value = await getGroupBuyDetail(e.id);
groupBuyBean.value.goods.price = groupBuyBean.value.price;
bannerList.value = JSON.parse(groupBuyBean.value.content).filter((item: any) => item.type === 2).map((item: any) => item.images);
countdown();
await fetchRecommendList();
await fetchBuyRecordList();
uni.hideLoading();
}
});
@@ -306,8 +308,7 @@ const placeOrder = async () => {
height: 130rpx;
position: relative;
padding: 15rpx 30rpx;
background: #F32B2B;
//background-image: url('../../../static/images/bg_groupbuy_countdown.png');
background-image: url('https://img.lakeapp.cn/wx/images/bg_groupbuy_countdown.png');
background-size: 100% 100%;
.super-second-kill {

View File

@@ -42,7 +42,7 @@ import { getGroupBuyList } from '@/api/groupbuy';
import { goPath } from '@/utils';
const tabIndex = ref(0);
const groupbuyList = ref([]);
const groupbuyList = ref<any[]>([]);
const currentPageNum = ref(1);
onLoad((e) => {
@@ -54,6 +54,7 @@ watch(() => tabIndex.value, () => {
});
const fetchData = async (refresh: boolean = true) => {
await uni.showLoading();
if(!refresh) {
currentPageNum.value += 1;
}
@@ -65,6 +66,7 @@ const fetchData = async (refresh: boolean = true) => {
}
});
groupbuyList.value = list;
uni.hideLoading();
};
const loadMore = () => {
@@ -168,7 +170,7 @@ const loadMore = () => {
height: 83rpx;
margin-top: 20rpx;
align-self: flex-end;
background-image: url("../../../static/images/bg_groupbuy_price.png");
background-image: url("https://img.lakeapp.cn/wx/images/bg_groupbuy_price.png");
background-size: 100% 100%;
color: #FFFFFF;
justify-content: space-between;
@@ -196,7 +198,7 @@ const loadMore = () => {
}
.bottom-price-disabled {
background-image: url("../../../static/images/bg_groupbuy_price_disabled.png");
background-image: url("https://img.lakeapp.cn/wx/images/bg_groupbuy_price_disabled.png");
}
}
}

View File

@@ -11,8 +11,8 @@
</button>
<view class='hint'>
登录代表同意
<text class='link'>
用户协议隐私政策
<text class='link' @click.stop='openPrivacy'>
小程序隐私保护协议
</text>
并授权使用您的账号信息如昵称头像收获地址以便您统一管理
</view>
@@ -32,6 +32,17 @@ function wechatLogin() {
uni.reLaunch({ url: '/pages/home/index' });
});
}
const openPrivacy = () => {
wx.openPrivacyContract({
success: () => {
}, // 打开成功
fail: () => {
}, // 打开失败
complete: () => {
}
});
};
</script>
<style lang='scss' scoped>
@@ -71,7 +82,7 @@ function wechatLogin() {
.hint {
padding: 20rpx 50rpx;
font-size: 20rpx;
font-size: 25rpx;
color: $u-tips-color;
position: absolute;
bottom: 0;

View File

@@ -95,6 +95,25 @@ const submenuList = [
}
];
onMounted(() => {
wx.getPrivacySetting({
success: res => {
console.log(res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
if(res.needAuthorization) {
// 需要弹出隐私协议
// agreementPopupRef.value.show();
} else {
// 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口
}
},
fail: (res) => {
console.log('fail ', res);
},
complete: () => {
}
});
});
onLoad((e) => {
console.log('home load e ', e);
});

View File

@@ -3,19 +3,23 @@
<text class='title'>入群步骤</text>
<view class='indicator' />
<text class='step-title'>
1.长按识别下方二维码添加xxxx
1.长按识别下方二维码添加店铺福利群
</text>
<view class='divider' style='margin-top: 28rpx' />
<image :src=' assetsUrl("test_qrcode.png")' show-menu-by-longpress />
<image :src=' companyConfigInfo.regqrcode' show-menu-by-longpress />
<text class='step-title'>
2.识别xxxx发您的二维码即可入群
2.识别店铺福利群发您的二维码即可入群
</text>
</view>
</template>
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import { useUserStore } from '@/store';
const userStore = useUserStore();
const { companyConfigInfo } = storeToRefs(userStore);
</script>
<style lang='scss' scoped>

View File

@@ -1,5 +1,5 @@
<template>
<view class='content' v-if='companyConfigInfo.mallopen==0'>
<view class='content' v-if='companyConfigInfo.mallopen==1'>
<view class='search-view'>
<view class='search-input' @click.stop='goPath("/pages/mall/subs/search/index")'>
<image :src=' assetsUrl("ic_search.png")'></image>
@@ -50,7 +50,7 @@ import useShoppingCartStore from '@/store/modules/shoppingcart';
import { useUserStore } from '@/store';
const userStore = useUserStore();
const { userInfo, companyConfigInfo } = storeToRefs(userStore);
const { companyConfigInfo } = storeToRefs(userStore);
const shoppingCartStore = useShoppingCartStore();
const { shoppingCartList } = storeToRefs(shoppingCartStore);
@@ -66,6 +66,8 @@ onLoad(() => {
return;
}
console.log('companyConfigInfo.value', companyConfigInfo.value);
userStore.$onAction(({ name, after }) => {
after(() => {
//更新用户信息
@@ -79,8 +81,10 @@ onLoad(() => {
});
const fetchCategoryList = async () => {
categoryList.value = await getCategoryList();
await changeCategory(0);
if(companyConfigInfo.value.mallopen == 1) {
categoryList.value = await getCategoryList();
await changeCategory(0);
}
};
const changeCategory = async (index: number) => {

View File

@@ -7,7 +7,9 @@
</view>
<scroll-view scroll-y>
<coupon-item v-for='(item,index) in coupons' :item='item' :key='index' @confirm='confirmItem(index)' />
<coupon-item v-if='coupons.length>0' v-for='(item,index) in coupons' :item='item' :key='index'
@confirm='confirmItem(index)' />
<u-loadmore v-else status='loading' />
</scroll-view>
</view>
</uni-popup>
@@ -104,6 +106,7 @@ defineExpose({
}
scroll-view {
height: 600rpx;
max-height: 600rpx;
}

View File

@@ -42,7 +42,7 @@
</view>
</view>
<view class='recommend-view c-flex-column'>
<view class='recommend-view c-flex-column' v-if='recommendList?.length>0'>
<text>浏览此商品的客户还浏览了</text>
<scroll-view scroll-x>
<view style='display: inline-block' v-for='(item, index) in recommendList'
@@ -113,6 +113,7 @@ const bannerList = ref([]);
const swiperIndex = ref(0);
onLoad(async (e: any) => {
await uni.showLoading();
goodsBean.value = await getGoodsDetail(e.goodsId);
const { rows } = await getGoodsList({
page: {
@@ -125,6 +126,7 @@ onLoad(async (e: any) => {
}
});
recommendList.value = rows;
uni.hideLoading();
});
const getStockColorCount = computed(() => {

View File

@@ -85,7 +85,7 @@
<view style='flex: 1' />
<view class='c-flex-row'>
<text class='card-view-value'>共1件商品 合计
<text style='font-size: 34rpx;color:#F32B2B'>¥{{ orderBean?.totalPrice || 0 }}</text>
<text style='font-size: 34rpx;color:#F32B2B'>¥{{ totalPrice || 0 }}</text>
</text>
</view>
</view>
@@ -100,7 +100,7 @@
<view class='bottom-view c-flex-row'>
<text>合计</text>
<text>{{ orderBean?.totalPrice || 0 }}</text>
<text>{{ totalPrice || 0 }}</text>
<sqb-pay @navigateTo='navigateTo'
:return_url='buildSqbParams.return_url'
:total_amount='buildSqbParams.total_amount'
@@ -131,9 +131,11 @@ import { CouponBean } from '@/api/user/types';
import { OrderBean } from '@/api/order/types';
import { useUserStore } from '@/store';
import { handlePayResult } from '@/utils/order';
import useShoppingCartStore from '@/store/modules/shoppingcart';
const userStore = useUserStore();
const { terminalInfo, deliveryAddress } = storeToRefs(userStore);
const { userInfo, terminalInfo, deliveryAddress } = storeToRefs(userStore);
const shoppingCartStore = useShoppingCartStore();
const couponDialogRef = ref();
const paymentDialogRef = ref();
@@ -149,6 +151,10 @@ onLoad((e) => {
createOrder();
});
const totalPrice = computed(() => {
return (orderBean?.value?.totalPrice || 0) - (checkedCoupon.value?.reduce || 0);
});
const buildSqbParams = computed(() => {
const params = sortASCII({
client_sn: orderBean.value?.id || '',
@@ -177,6 +183,7 @@ const showCouponDialog = () => {
const confirmCoupon = (item: CouponBean) => {
checkedCoupon.value = item;
createOrder();
};
const navigateTo = (e: any) => {
handlePayResult(orderBean.value?.id, e, {
@@ -195,13 +202,14 @@ const createOrder = async () => {
const params = {
// 'discount': 0,
// 'freePrice': 0,
// 'reducePrice': 0,
'totalPrice': orderBean?.value?.totalPrice,
'reducePrice': checkedCoupon.value == undefined ? 0 : checkedCoupon.value?.reduce,
'totalPrice': totalPrice.value,
// 'integral': 0,
// 'allowIntegral': 0,
// 'produceIntegralNumber': 0,
'couponIds': checkedCoupon.value?.id,
'remark': orderBean.value?.remark,
// 'address': JSON.stringify(deliveryAddress.value),
'address': tabIndex.value == 0 ? undefined : JSON.stringify(deliveryAddress.value),
'orderGoods': orderBean?.value?.orderGoods?.map(item => (
{
'goodsId': item.id,
@@ -209,8 +217,9 @@ const createOrder = async () => {
'goodsNum': item.checkedStock.count,
'stockId': item.checkedStock.stockId,
'originPrice': item.price,
'consumePrice': item.price
// 'discount': 0,
// 'consumePrice': item.price * ((userInfo.value?.levelEntity?.discount || 0) / 100),
'consumePrice': item.price,
'discount': userInfo.value?.levelEntity?.discount || 0
// 'discountOriginPrice': 0,
// 'produceIntegral': 0,
// 'priceModify': [0],
@@ -221,6 +230,15 @@ const createOrder = async () => {
const result = await orderCreate(params);
orderBean.value!.id = result.id;
uni.hideLoading();
//删除购物车已存在商品
orderBean?.value?.orderGoods?.forEach(item => {
const index = shoppingCartStore.getSameGoodsIndex(item.id, item.checkedStock.colorId, item.checkedStock.sizeId);
if(index >= 0) {
shoppingCartStore.delete(index);
}
});
};
const payment = async () => {

View File

@@ -44,7 +44,7 @@ const fetchAddressList = async () => {
const onChecked = (e: any) => {
const pages = getCurrentPages();
if(pages.length > 2 && pages[pages.length - 2].route?.includes('pages/mall/subs/order/order-confirm')) {
if(pages.length >= 2 && pages[pages.length - 2].route?.includes('pages/mall/subs/order/order-confirm')) {
userStore.setDeliveryAddress(e);
uni.navigateBack();
}

View File

@@ -118,9 +118,8 @@ import { OrderBean } from '@/api/order/types';
import { parseParameter, sortASCII } from '@/utils';
import { hexMD5 } from '@/utils/common/md5';
import { useUserStore } from '@/store';
import { handlePayResult, isPending } from '@/utils/order';
import { getOrderDeadline, handlePayResult, isPending } from '@/utils/order';
import dayjs from 'dayjs';
import { pay } from '@/api/groupbuy';
const userState = useUserStore();
const { terminalInfo } = storeToRefs(userState);
@@ -134,12 +133,16 @@ const orderBean = ref<{
let currentInterval = 0;
onLoad(async (e: any) => {
await uni.showLoading();
orderBean.value = await getOrderDetail(e.orderId);
await fetchData(e.orderId);
handleCountdown();
uni.hideLoading();
});
const fetchData = async (orderId: string) => {
await uni.showLoading();
orderBean.value = await getOrderDetail(orderId);
uni.hideLoading();
};
onUnload(() => {
clearInterval(currentInterval);
});
@@ -161,29 +164,28 @@ const buildSqbParams = computed(() => {
});
const navigateTo = (e: any) => {
console.log('--------------_>>>>>>navigateTo ', e);
handlePayResult(orderBean.value?.order.id, e, {
onSuccess: () => {
// pay({
// 'orderId': orderBean.value?.order.id,
// 'result': 'xxx'
// });
fetchData(orderBean.value?.order.id || '');
}
});
};
const handleCountdown = () => {
clearInterval(currentInterval);
let second = 30 * 60;
currentInterval = setInterval(() => {
if(isPending(orderBean.value?.order)) {
orderBean.value!.order!.countdown = second;
if(orderBean.value!.order!.countdown <= 0) {
orderBean.value!.order!.countdown = 0;
if(orderBean.value != undefined) {
if(isPending(orderBean.value?.order)) {
let second = (getOrderDeadline(orderBean.value?.order) - Date.now()) / 1000;
orderBean.value.order.countdown = second;
if(second <= 0) {
fetchData(orderBean.value?.order.id || '');
}
second--;
} else {
uni.navigateBack();
clearInterval(currentInterval);
fetchData(orderBean.value?.order.id || '');
}
second--;
}
}, 1000);
};

View File

@@ -14,7 +14,7 @@
import { ref } from 'vue';
import { showToast } from '@/utils';
import { isPending } from '@/utils/order';
import { getOrderDeadline, isPending } from '@/utils/order';
import { getOrderList } from '@/api/order';
import OrderItem from '@/pages/mine/subs/order/components/order-item.vue';
import { OrderBean } from '@/api/order/types';
@@ -64,10 +64,10 @@ const fetchData = async (refresh: boolean = true) => {
const handleCountdown = (items: OrderBean[]) => {
clearInterval(currentInterval);
let second = 30 * 60;
currentInterval = setInterval(() => {
items.forEach(item => {
if(isPending(item)) {
let second = (getOrderDeadline(item) - Date.now()) / 1000;
item.countdown = second;
if(item.countdown <= 0) {
item.countdown = 0;

View File

@@ -4,7 +4,7 @@
<image :src='assetsUrl("bg_member_recharge.png")' />
<view class='balance-content'>
<text>累计余额</text>
<text>1</text>
<text>{{ userInfo?.totalIncoming}}</text>
</view>
<view class='balance-content'>
<text>当前余额</text>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -1,5 +1,6 @@
import { defineStore } from 'pinia';
import { GoodsBean, StockBean } from '@/api/goods/types';
import { getCompanyId } from '@/utils';
const useShoppingCartStore = defineStore('shoppingCart', {
state: (): { shoppingCartList: GoodsBean[] } => ({
@@ -8,7 +9,7 @@ const useShoppingCartStore = defineStore('shoppingCart', {
persist: {
// 修改存储中使用的键名称,默认为当前 Store的 id
key: 'shoppingCartState',
key: 'shoppingCartState_' + getCompanyId(),
storage: {
setItem(key, value) {
uni.setStorageSync(key, value); // [!code warning]

View File

@@ -113,7 +113,6 @@ const useUserStore = defineStore('user', {
code: result.code,
userInfo: userInfo,
referrerUserId: '1727303781559697409'
// referrerUserId: '1731886841265598466'
});
if(res.user == undefined || res.user.id === null) {

View File

@@ -1,2 +1,2 @@
export const assetsUrl = (name: string) => `/static/images/${name}`;
export const assetsUrl = (name: string) => `https://img.lakeapp.cn/wx/images/${name}`;
export const defaultAvatar = 'https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132';

View File

@@ -8,7 +8,7 @@ import { showToast } from '@/utils';
*/
export function getOrderDeadline(order: OrderBean) {
// return dayjs(order?.createTime).add(30, 'minute').toDate().getTime();
return dayjs(order?.createTime).add(10, 'day').toDate().getTime();
return dayjs(order?.createTime).add(30, 'minute').toDate().getTime();
}
/**