diff --git a/src/api/goods/types.ts b/src/api/goods/types.ts
index 2c0c4bc..1522d8a 100644
--- a/src/api/goods/types.ts
+++ b/src/api/goods/types.ts
@@ -24,6 +24,7 @@ export interface GoodsBean {
material_name: string;
name: string;
price: number;
+ send_num: number;
price_ext: number;
profile: string;
remark: string;
@@ -52,4 +53,5 @@ export interface StockBean {
sizeId: string;
sizeName: string;
stockId: string;
+ count: number;
}
diff --git a/src/api/groupbuy/index.ts b/src/api/groupbuy/index.ts
index ba1e930..940d634 100644
--- a/src/api/groupbuy/index.ts
+++ b/src/api/groupbuy/index.ts
@@ -15,5 +15,5 @@ export const getGroupBuyRecordList = (groupId: string, pageNum: number, pageSize
url: `wechat/coupons/group/order/list?groupId=${groupId}&pageNum=${pageNum}&pageSize=${pageSize}`
});
-export const preOrder = (data: any) => post({ url: 'wechat/coupons/group/pre', data });
+export const preOrder = (data: any) => post({ url: 'wechat/coupons/group/pre_v2', data });
diff --git a/src/components/sku-dialog.vue b/src/components/sku-dialog.vue
index 4076c71..4e3d796 100644
--- a/src/components/sku-dialog.vue
+++ b/src/components/sku-dialog.vue
@@ -5,7 +5,7 @@
{{ bean?.name }}
- {{ bean?.price||0 }}
+ {{ bean?.price || 0 }}
@@ -48,28 +48,60 @@
diff --git a/src/pages/common/groupbuy/index.vue b/src/pages/common/groupbuy/index.vue
index bef9633..8a32afe 100644
--- a/src/pages/common/groupbuy/index.vue
+++ b/src/pages/common/groupbuy/index.vue
@@ -12,10 +12,10 @@
{{ item.name }}
- 原价:¥{{ item.goodsPrice }}
-
+ 原价:¥{{ item.price }}
+
- 直降¥{{ (item.goodsPrice - item.payPrice).toFixed(2) }}
+ 直降¥{{ (item.price - item.payPrice).toFixed(2) }}
即将恢复
diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue
index e44340a..0095e1e 100644
--- a/src/pages/home/index.vue
+++ b/src/pages/home/index.vue
@@ -66,7 +66,7 @@
import { getCompanyInfo, getCompanyList } from '@/api/company';
import { useUserStore } from '@/store';
import { assetsUrl } from '@/utils/assets';
-import { goPath, setCompanyId } from '@/utils';
+import { getCompanyId, goPath, isLogin, setCompanyId } from '@/utils';
import { storeToRefs } from 'pinia';
const store = useUserStore();
@@ -93,22 +93,30 @@ const submenuList = [
}
];
-onLoad(async (e) => {
- const data = await getCompanyInfo(userInfo.value.companyId);
- bannerList.value = data.bannerinx?.map((res: { src: string }) => res.src);
- recommendBannerList.value = data.bannerhot?.map((res: { src: string }) => res.src);
+onLoad((e) => {
+ console.log('home load e ', e);
+});
- getCompanyList(userInfo.value.maOpenId).then(res => {
- const companyList = res.map((res: { company: any }) => res.company);
- const userList = res.map((res: { user: any }) => res.user);
- uni.showActionSheet({
- itemList: companyList.map((res: { companyName: string }) => res.companyName),
- success: (res) => {
- setCompanyId(companyList[res.tapIndex].id);
- store.setUserInfo(userList[res.tapIndex]);
+onShow(async () => {
+ if(isLogin()) {
+ const data = await getCompanyInfo(userInfo.value.companyId);
+ bannerList.value = data.bannerinx?.map((res: { src: string }) => res.src);
+ recommendBannerList.value = data.bannerhot?.map((res: { src: string }) => res.src);
+
+ getCompanyList(userInfo.value.maOpenId).then(res => {
+ const companyList = res.map((res: { company: any }) => res.company);
+ const userList = res.map((res: { user: any }) => res.user);
+ if(getCompanyId() == undefined) {
+ uni.showActionSheet({
+ itemList: companyList.map((res: { companyName: string }) => res.companyName),
+ success: (res) => {
+ setCompanyId(companyList[res.tapIndex].id);
+ store.setUserInfo(userList[res.tapIndex]);
+ }
+ });
}
});
- });
+ }
});
const swiperChange = (e: any) => {
diff --git a/src/pages/mall/index.vue b/src/pages/mall/index.vue
index 630549f..43d2f68 100644
--- a/src/pages/mall/index.vue
+++ b/src/pages/mall/index.vue
@@ -20,7 +20,7 @@
-
+
{{ item.goodsName }}
¥{{ item.price }}
@@ -84,10 +84,6 @@ const randomImageHeight = () => {
return height;
};
-const getRandomIntegerInRange = (a: number, b: number) => {
- return Math.floor(Math.random() * (b - a + 1)) + a;
-};
-
const getRandomFloatInRange = (a: number, b: number) => {
return Math.random() * (b - a) + a;
};
diff --git a/src/pages/mall/subs/components/coupon-dialog.vue b/src/pages/mall/subs/components/coupon-dialog.vue
index 09fbecd..913c042 100644
--- a/src/pages/mall/subs/components/coupon-dialog.vue
+++ b/src/pages/mall/subs/components/coupon-dialog.vue
@@ -1,13 +1,13 @@
-
+
优惠券
确定
-
-
+
+
@@ -17,7 +17,7 @@
import CouponItem from '../components/coupon-item.vue';
const popupRef = ref();
-const coupons = [{
+const coupons = ref([{
id: 1,
title: '优惠券',
desc: '满100减10',
@@ -67,7 +67,7 @@ const coupons = [{
useTime: '2024-12-31',
status: 0,
useStatus: '未使用'
-}];
+}]);
const show = () => {
popupRef.value.open();
@@ -86,7 +86,7 @@ defineExpose({
.popup-content {
background: #FFFFFF;
border-radius: 20rpx 20rpx 0 0;
- padding: 38rpx 45rpx 0 45rpx;
+ padding: 38rpx 45rpx 10rpx 45rpx;
view:nth-of-type(1) {
display: flex;
diff --git a/src/pages/mall/subs/goods/detail.vue b/src/pages/mall/subs/goods/detail.vue
index 37baa2c..22fe262 100644
--- a/src/pages/mall/subs/goods/detail.vue
+++ b/src/pages/mall/subs/goods/detail.vue
@@ -15,7 +15,7 @@
{{ goodsBean?.price || 0 }}
- 销量2653
+ 销量{{ goodsBean?.send_num || 0 }}
@@ -90,7 +90,7 @@
-
+
diff --git a/src/pages/mall/subs/shoppingcart/index.vue b/src/pages/mall/subs/shoppingcart/index.vue
index d8ca863..e7dafaf 100644
--- a/src/pages/mall/subs/shoppingcart/index.vue
+++ b/src/pages/mall/subs/shoppingcart/index.vue
@@ -1,28 +1,36 @@
- 管理
+
+ {{ isEditMode ? '退出管理' : '管理' }}
+
-
+
-
+
{{ item.name }}
-
- {{ item?.colorName }},{{ item?.sizeName }} x{{ item?.count }}
-
+
+
+ {{ item?.checkedStock.colorName }},{{ item?.checkedStock.sizeName }}
+ x{{ item?.checkedStock.count }}
+
+
+
¥{{ item.price }}
-
+
- {{ item.count || 0 }}
-
+ {{ item?.checkedStock.count || 0 }}
+
@@ -38,31 +46,88 @@
全选
- 合计:
- ¥29.90
-
- 结算
+
+ 删除
+
+ 合计:
+ ¥{{ totalPayPrice }}
+
+ 结算
+
+
@@ -82,10 +147,10 @@ const settlement = () => {
}
.card-view {
- margin: 30rpx;
+ margin: 30rpx 30rpx 180rpx 30rpx;
border-radius: 10rpx;
background: #FFFFFF;
- padding: 10rpx 20rpx 120rpx 17rpx;
+ padding: 10rpx 20rpx 10rpx 17rpx;
.c-flex-column:nth-of-type(1) {
margin: 20rpx 0;
@@ -112,16 +177,16 @@ const settlement = () => {
text:nth-of-type(1) {
font-weight: 400;
- font-size: 28rpx;
+ font-size: 30rpx;
color: #333333;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
+ overflow: hidden;
}
.sku-view {
display: flex;
flex-direction: row;
- width: 210rpx;
position: relative;
background: #F2F2F2;
margin-top: 10rpx;
@@ -213,7 +278,6 @@ const settlement = () => {
text:nth-of-type(1) {
font-size: 30rpx;
- color: #333333;
text {
font-weight: bold;
diff --git a/src/pages/mine/subs/address/create.vue b/src/pages/mine/subs/address/create.vue
index de1223a..195dbb7 100644
--- a/src/pages/mine/subs/address/create.vue
+++ b/src/pages/mine/subs/address/create.vue
@@ -2,20 +2,21 @@
收货人
-
+
手机号
-
+
详细地址
-
+
记得完善门牌号
@@ -27,7 +28,8 @@
设为默认地址
提醒:每次下单会默认推荐使用该地址
-
+
+
@@ -41,16 +43,40 @@
import { assetsUrl } from '@/utils/assets';
import { addressCreate } from '@/api/user';
+const params = ref<{
+ name: string,
+ mobile: string,
+ zonecode: string,
+ addr: string,
+ defaultstatus: number
+}>({
+ name: '',
+ mobile: '',
+ zonecode: '',
+ addr: '',
+ defaultstatus: 0
+});
+
+const bindConsignee = (e: any) => {
+ params.value.name = e.detail.value;
+};
+
+const bindMobile = (e: any) => {
+ params.value.mobile = e.detail.value;
+};
+
+const bindAddress = (e: any) => {
+ params.value.addr = e.detail.value;
+};
+
+const bindStatus = (e: any) => {
+ params.value.defaultstatus = e.detail.value == true ? 1 : 0;
+};
+
const save = () => {
addressCreate(
{
- bean: {
- 'name': '高昂',
- 'mobile': '15475655487',
- 'zonecode': '420101001001',
- 'addr': '肯德基挂',
- 'defaultstatus': 1
- }
+ bean: params.value
}
).then(() => {
uni.showToast({
diff --git a/src/pages/mine/subs/address/index.vue b/src/pages/mine/subs/address/index.vue
index 5254e56..920eab6 100644
--- a/src/pages/mine/subs/address/index.vue
+++ b/src/pages/mine/subs/address/index.vue
@@ -24,6 +24,10 @@ const addressList = ref<{
}[]>([]);
onLoad((e) => {
+ // fetchAddressList();
+});
+
+onShow(() => {
fetchAddressList();
});
diff --git a/src/pages/mine/subs/profile/index.vue b/src/pages/mine/subs/profile/index.vue
index e8dd9e4..3dcbbde 100644
--- a/src/pages/mine/subs/profile/index.vue
+++ b/src/pages/mine/subs/profile/index.vue
@@ -3,22 +3,22 @@
- {{ userInfo.nickName }}
- 会员卡
+ {{ userInfo.name }}
+ {{ userInfo.levelName }}
头像
-
+
姓名
-
+
@@ -32,12 +32,12 @@
性别
+ :src='assetsUrl(params?.gender==0?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
男
+ :src='assetsUrl(params?.gender==1?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
女
@@ -46,7 +46,7 @@
生日
- {{ userInfo.birthday || '请选择生日' }}
+ {{ params?.birthday || '请选择生日' }}
@@ -63,7 +63,21 @@ import { showToast } from '@/utils';
const store = useUserStore();
const { userInfo } = storeToRefs(store);
-const currentGender = ref(0);
+const params = ref<{
+ avatarUrl: string;
+ image: string;
+ nickName: string;
+ telephone: string;
+ gender: number;
+ birthday: string;
+}>({
+ avatarUrl: userInfo.value.image,
+ image: userInfo.value.image,
+ nickName: userInfo.value.nickName,
+ telephone: userInfo.value.telephone,
+ gender: userInfo.value.gender,
+ birthday: userInfo.value.birthday
+});
onLoad(() => {
store.getProfile();
@@ -79,7 +93,8 @@ const chooseAvatar = (e: any) => {
'Content-Type': 'multipart/form-data'
},
success: (res: any) => {
- userInfo.value.image = JSON.parse(res.data).data;
+ params.value!.avatarUrl = JSON.parse(res.data).data;
+ params.value!.image = JSON.parse(res.data).data;
},
error: (err: any) => {
showToast('上传失败');
@@ -91,40 +106,30 @@ const chooseAvatar = (e: any) => {
};
const bindNickname = (e: any) => {
- userInfo.value.nickName = e.detail.value;
+ console.log('---------->>>>', e.detail.value);
+ params.value!.nickName = e.detail.value;
};
const bindTelephone = (e: any) => {
- userInfo.value.telephone = e.detail.value;
+ params.value!.telephone = e.detail.value;
};
const changeGender = (index: number) => {
- currentGender.value = index;
- userInfo.value.gender = index;
+ params.value!.gender = index;
};
const changeDate = (e: any) => {
- userInfo.value.birthday = e.detail.value;
+ params.value!.birthday = e.detail.value;
};
const save = async () => {
- // const registerForm = {
- // unionId: userInfo.value.unionId,
- // openId: userInfo.value.openId,
- // maOpenId: userInfo.value.maOpenId,
- // image: userInfo.value.image,
- // nickName: userInfo.value.nickName,
- // telephone: userInfo.value.telephone,
- // birthday: userInfo.value.birthday,
- // gender: userInfo.value.gender,
- // companyId: userInfo.value.companyId,
- // creatorId: userInfo.value.creatorId
- // };
- // console.log('--------_>>>userInfo.value ', userInfo.value);
- // const result = await store.userRegister(registerForm);
- // console.log('--------->>>', result);
-
- store.setUserInfo(userInfo.value)
+ console.log('---------->>>>', params.value);
+ const newUserInfo = {
+ ...userInfo.value,
+ ...params.value
+ };
+ console.log('---------->>>>', newUserInfo);
+ store.setUserInfo(newUserInfo);
};
diff --git a/src/store/modules/shoppingcart/index.ts b/src/store/modules/shoppingcart/index.ts
index b8b8621..144ea9e 100644
--- a/src/store/modules/shoppingcart/index.ts
+++ b/src/store/modules/shoppingcart/index.ts
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia';
+import { StockBean } from '@/api/goods/types';
const useShoppingCartStore = defineStore('shoppingCart', {
state: (): { shoppingCartList: any[] } => ({
@@ -27,14 +28,35 @@ const useShoppingCartStore = defineStore('shoppingCart', {
getTotalCount(): number {
return this.shoppingCartList.length;
+ },
+
+ getSameGoodsIndex: (state) => (goodsId: string, colorId: string, sizeId: string) => {
+ return state.shoppingCartList.findIndex(res => res.id === goodsId && res.checkedStock.colorId === colorId && res.checkedStock.sizeId === sizeId);
}
},
+
actions: {
save(partial: Partial) {
this.shoppingCartList.push(partial);
},
- clear() {
+ updateCount(index: number, count: number) {
+ this.shoppingCartList[index].checkedStock.count += count;
+ },
+
+ updateStock(index: number, stock: StockBean) {
+ this.shoppingCartList[index].checkedStock = stock;
+ },
+
+ delete(index: number) {
+ this.shoppingCartList.splice(index, 1);
+ },
+
+ deleteIfChecked() {
+ this.shoppingCartList = this.shoppingCartList.filter(res => res.checked == undefined || res.checked === false);
+ },
+
+ clearAll() {
this.shoppingCartList = [];
}
}
diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts
index 35c681a..a2b9eec 100644
--- a/src/store/modules/user/index.ts
+++ b/src/store/modules/user/index.ts
@@ -5,26 +5,8 @@ import { clearToken, setCompanyId, setToken } from '@/utils/auth';
import type { LoginResult, RegisterParams } from '@/api/user/types';
const useUserStore = defineStore('user', {
- state: (): UserState => ({
- id: '',
- unionId: '',
- openId: '',
- maOpenId: '',
- name: '未登录',
- nickName: '未登录',
- image: '',
- telephone: '',
- gender: 0,
- birthday: '',
- address: '',
- balance: 0,
- integration: 0,
- creatorId: '',
- companyId: '',
- levelName: '',
- orderNum: 0,
- storeId: '',
- creatorName: ''
+ state: () => ({
+ userInfo: {} as UserState
}),
persist: {
@@ -43,15 +25,15 @@ const useUserStore = defineStore('user', {
},
getters: {
- userInfo(state: UserState): UserState {
- return { ...state };
- }
+ // getUserInfo(state: UserState): UserState {
+ // return state.address;
+ // }
},
actions: {
// 设置用户的信息
setUserInfo(partial: Partial) {
- this.$patch(partial);
+ this.userInfo = partial as UserState;
},
// 重置用户信息
resetInfo() {
@@ -118,7 +100,6 @@ const useUserStore = defineStore('user', {
gender: res.user.gender
};
const registerResult = await this.userRegister(registerForm);
- console.log(registerResult);
this.setUserInfo(registerResult as LoginResult);
setToken(res.token);
setCompanyId(res.user.companyId);
diff --git a/src/store/modules/user/types.ts b/src/store/modules/user/types.ts
index 970b0cc..68fcbd7 100644
--- a/src/store/modules/user/types.ts
+++ b/src/store/modules/user/types.ts
@@ -21,7 +21,7 @@ export interface UserState {
gold: string;
goodsNum: number;
id: string;
- image: string;
+ image: string | 'https://img.1216.top/lake/def_avatar.png';
integration: number;
lastConsumTime: string;
levelEntity: any;
diff --git a/src/utils/auth/index.ts b/src/utils/auth/index.ts
index 682b4e2..e50ed67 100644
--- a/src/utils/auth/index.ts
+++ b/src/utils/auth/index.ts
@@ -1,4 +1,4 @@
-const TokenKey = 'access-token';
+const TokenKey = 'accessToken';
const CompanyIdKey = 'companyId';
const TokenPrefix = 'Bearer ';