优化
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
"@dcloudio/uni-components": "3.0.0-3090920231225001",
|
"@dcloudio/uni-components": "3.0.0-3090920231225001",
|
||||||
"@dcloudio/uni-mp-weixin": "3.0.0-3090920231225001",
|
"@dcloudio/uni-mp-weixin": "3.0.0-3090920231225001",
|
||||||
"@dcloudio/uni-mp-xhs": "3.0.0-3090920231225001",
|
"@dcloudio/uni-mp-xhs": "3.0.0-3090920231225001",
|
||||||
|
"dayjs": "^1.11.10",
|
||||||
"pinia": "2.0.36",
|
"pinia": "2.0.36",
|
||||||
"pinia-plugin-persistedstate": "^3.2.1",
|
"pinia-plugin-persistedstate": "^3.2.1",
|
||||||
"uview-plus": "^3.1.38",
|
"uview-plus": "^3.1.38",
|
||||||
|
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -20,6 +20,9 @@ dependencies:
|
|||||||
'@dcloudio/uni-mp-xhs':
|
'@dcloudio/uni-mp-xhs':
|
||||||
specifier: 3.0.0-3090920231225001
|
specifier: 3.0.0-3090920231225001
|
||||||
version: 3.0.0-3090920231225001(postcss@8.4.32)(vue@3.2.47)
|
version: 3.0.0-3090920231225001(postcss@8.4.32)(vue@3.2.47)
|
||||||
|
dayjs:
|
||||||
|
specifier: ^1.11.10
|
||||||
|
version: 1.11.10
|
||||||
pinia:
|
pinia:
|
||||||
specifier: 2.0.36
|
specifier: 2.0.36
|
||||||
version: 2.0.36(typescript@5.3.2)(vue@3.2.47)
|
version: 2.0.36(typescript@5.3.2)(vue@3.2.47)
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
import { get } from '@/utils/request';
|
import { get } from '@/utils/request';
|
||||||
|
|
||||||
|
export const getCompanyList = (maOpenId: string) => get({ url: `/wc/wechat/company?maOpenId=${maOpenId}` });
|
||||||
export const getCompanyInfo = (companyId: string) => get({ url: `/ext/zconfig/company_find?companyId=${companyId}` });
|
export const getCompanyInfo = (companyId: string) => get({ url: `/ext/zconfig/company_find?companyId=${companyId}` });
|
||||||
|
@@ -1,14 +1,15 @@
|
|||||||
import { get, post } from '@/utils';
|
import { get, post } from '@/utils';
|
||||||
|
import { CategoryBean, GoodsBean } from '@/api/goods/types';
|
||||||
|
|
||||||
enum URL {
|
enum URL {
|
||||||
categoryList = '/ext//goods/category_list',
|
categoryList = '/ext/goods/category_list',
|
||||||
goodsList = '/ext/goods/query',
|
goodsList = '/ext/goods/query',
|
||||||
goodsDetail = '/ext/goods/info',
|
goodsDetail = '/ext/goods/info',
|
||||||
order = '/user/logout',
|
order = '/user/logout',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getCategoryList = (companyId: string) => get({ url: URL.categoryList + `?companyId=${companyId}` });
|
export const getCategoryList = () => get<CategoryBean>({ url: URL.categoryList });
|
||||||
|
|
||||||
export const getGoodsList = (params: any) => post({ url: URL.goodsList, data: params });
|
export const getGoodsList = (params: any) => post<GoodsBean>({ url: URL.goodsList, data: params });
|
||||||
|
|
||||||
export const getGoodsDetail = () => get({ url: URL.goodsDetail });
|
export const getGoodsDetail = (goodsId: string) => get<GoodsBean>({ url: URL.goodsDetail + `?goodsId=${goodsId}` });
|
||||||
|
@@ -4,9 +4,52 @@ export interface CategoryBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface GoodsBean {
|
export interface GoodsBean {
|
||||||
code: string;
|
id: string;
|
||||||
goodsId: string;
|
goodsId: string;
|
||||||
goodsName: string;
|
goodsName: string;
|
||||||
|
allow_integral: number;
|
||||||
|
available: number;
|
||||||
|
back_factory: number;
|
||||||
|
brand_id: string;
|
||||||
|
brand_name: string;
|
||||||
|
code: string;
|
||||||
|
company_id: string;
|
||||||
|
cost_price: number;
|
||||||
|
create_time: string;
|
||||||
|
creator_id: string;
|
||||||
|
discount: number;
|
||||||
images: string;
|
images: string;
|
||||||
|
market_time: string;
|
||||||
|
material_id: string;
|
||||||
|
material_name: string;
|
||||||
|
name: string;
|
||||||
price: number;
|
price: number;
|
||||||
|
price_ext: number;
|
||||||
|
profile: string;
|
||||||
|
remark: string;
|
||||||
|
remark1: string;
|
||||||
|
remark2: string;
|
||||||
|
remark3: string;
|
||||||
|
remark4: string;
|
||||||
|
season_id: string;
|
||||||
|
season_name: string;
|
||||||
|
status: number;
|
||||||
|
stocks: StockBean[],
|
||||||
|
store_id: string;
|
||||||
|
suplier_id: string;
|
||||||
|
suplier_name: string;
|
||||||
|
type_id: string;
|
||||||
|
type_name: string;
|
||||||
|
update_time: string;
|
||||||
|
years_id: string;
|
||||||
|
years_name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StockBean {
|
||||||
|
colorId: string;
|
||||||
|
colorName: string;
|
||||||
|
existingNumber: number;
|
||||||
|
sizeId: string;
|
||||||
|
sizeName: string;
|
||||||
|
stockId: string;
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,8 @@ enum URL {
|
|||||||
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'
|
rechargeList = '/ext/recharge/rule_config',
|
||||||
|
couponList = '/wechat/coupons/coupons/pageList',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getUserProfile = () => get<UserState>({ url: URL.profile });
|
export const getUserProfile = () => get<UserState>({ url: URL.profile });
|
||||||
@@ -41,4 +42,4 @@ export const getDynamicCode = () => post<any>({ url: URL.dynamicCode });
|
|||||||
|
|
||||||
export const getRechargeList = () => get<any>({ url: URL.rechargeList });
|
export const getRechargeList = () => get<any>({ url: URL.rechargeList });
|
||||||
|
|
||||||
export const getCouponList = (data: any) => post<any>({ url: '/couponseUse/pageList', data });
|
export const getCouponList = (data: any) => post<any>({ url: URL.couponList, data });
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
<uni-popup ref='popupRef' type='bottom' :mask-click='false' @touchmove.stop.prevent=''>
|
<uni-popup ref='popupRef' type='bottom' :mask-click='false' @touchmove.stop.prevent=''>
|
||||||
<view class='content'>
|
<view class='content'>
|
||||||
<view class='c-flex-row' style='align-items: flex-start'>
|
<view class='c-flex-row' style='align-items: flex-start'>
|
||||||
<image class='goods-image' :src='assetsUrl("test_bg.png")' />
|
<image class='goods-image' :src='bean?.images' />
|
||||||
<view class='c-flex-column' style='flex: 1'>
|
<view class='c-flex-column' style='flex: 1'>
|
||||||
<text class='goods-name'>女童夏装套装洋气装短袖阔…</text>
|
<text class='goods-name'>{{ bean.name }}…</text>
|
||||||
<text class='goods-price'>29.90</text>
|
<text class='goods-price'>{{ bean?.price }}</text>
|
||||||
</view>
|
</view>
|
||||||
<image class='close-image' :src='assetsUrl("ic_close.png")' @click.stop='close' />
|
<image class='close-image' :src='assetsUrl("ic_close.png")' @click.stop='close' />
|
||||||
</view>
|
</view>
|
||||||
@@ -48,10 +48,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
import { Proptype, ref } from 'vue';
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
import { GoodsBean } from '@/api/goods/types';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
bean: Object as Proptype<GoodsBean>
|
||||||
|
});
|
||||||
const popupRef = ref();
|
const popupRef = ref();
|
||||||
const skuColorList = ref(['黑色', '白色']);
|
const skuColorList = ref<string[]>([]);
|
||||||
const currentColorIndex = ref(0);
|
const currentColorIndex = ref(0);
|
||||||
const skuSizeList = ref(['120cm', '130cm', '140cm', '150cm', '160cm', '170cm']);
|
const skuSizeList = ref(['120cm', '130cm', '140cm', '150cm', '160cm', '170cm']);
|
||||||
const currentSizeIndex = ref(0);
|
const currentSizeIndex = ref(0);
|
||||||
@@ -59,6 +64,22 @@ const goodsCount = ref(1);
|
|||||||
|
|
||||||
const show = () => {
|
const show = () => {
|
||||||
popupRef.value.open();
|
popupRef.value.open();
|
||||||
|
// props.bean.stocks.map((res: { colorName: string }) => res.colorName).forEach((colorName: string) => {
|
||||||
|
// if(skuColorList.value.includes(colorName)) {
|
||||||
|
// skuColorList.value.push(colorName);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
props.bean.stocks?.reduce((a: any[], b: { colorId: string, colorName: any; }) => {
|
||||||
|
if(a.find(e => e.colorId === b.colorId)) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
a.push(b);
|
||||||
|
return a;
|
||||||
|
}, []).map((res: { colorName: any; }) =>
|
||||||
|
({
|
||||||
|
colorName: res.colorName
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
|
@@ -63,10 +63,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import { getCompanyInfo } from '@/api/company';
|
import { getCompanyInfo, getCompanyList } from '@/api/company';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
import { goPath } from '@/utils';
|
import { goPath, setCompanyId } from '@/utils';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
const store = useUserStore();
|
const store = useUserStore();
|
||||||
@@ -97,6 +97,18 @@ onLoad(async (e) => {
|
|||||||
const data = await getCompanyInfo(userInfo.value.companyId);
|
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);
|
||||||
|
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const swiperChange = (e: any) => {
|
const swiperChange = (e: any) => {
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view class='container'>
|
<view class='container'>
|
||||||
<scroll-view class='category-list' :scroll-y='true'>
|
<scroll-view class='category-list' :scroll-y='true'>
|
||||||
<view v-for='(item,index) in categoryList' :key='index' class='category-item'
|
<view v-for='(item,index) in categoryList' :key='index' class='category-item'
|
||||||
@@ -24,7 +23,7 @@
|
|||||||
<image class='goods-image' :src='item.images' />
|
<image class='goods-image' :src='item.images' />
|
||||||
<text class='goods-name'>{{ item.goodsName }}</text>
|
<text class='goods-name'>{{ item.goodsName }}</text>
|
||||||
<text class='goods-price'>¥{{ item.price }}</text>
|
<text class='goods-price'>¥{{ item.price }}</text>
|
||||||
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' />
|
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' @click.stop='addShoppingCart' />
|
||||||
</view>
|
</view>
|
||||||
</grid-view>
|
</grid-view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -32,7 +31,7 @@
|
|||||||
|
|
||||||
<view class='shopping-cart' @click.stop='goPath("/pages/mall/subs/shoppingcart/index")'>
|
<view class='shopping-cart' @click.stop='goPath("/pages/mall/subs/shoppingcart/index")'>
|
||||||
<image :src='assetsUrl("ic_shopping_cart.png")' />
|
<image :src='assetsUrl("ic_shopping_cart.png")' />
|
||||||
<text>10</text>
|
<text v-if='shoppingCartCount>0'>{{ shoppingCartCount }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -46,31 +45,37 @@ import { CategoryBean, GoodsBean } from '@/api/goods/types';
|
|||||||
const categoryList = ref<CategoryBean[]>([]);
|
const categoryList = ref<CategoryBean[]>([]);
|
||||||
const categorySelectedIndex = ref<number>(0);
|
const categorySelectedIndex = ref<number>(0);
|
||||||
const goodsList = ref<GoodsBean[]>([]);
|
const goodsList = ref<GoodsBean[]>([]);
|
||||||
|
const shoppingCartCount = ref<number>(0);
|
||||||
const companyId = '1140269023306428417';
|
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
fetchCategoryList();
|
fetchCategoryList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchCategoryList = async () => {
|
const fetchCategoryList = async () => {
|
||||||
categoryList.value = await getCategoryList(companyId);
|
categoryList.value = await getCategoryList();
|
||||||
await changeCategory(0);
|
await changeCategory(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeCategory = async (index: number) => {
|
const changeCategory = async (index: number) => {
|
||||||
categorySelectedIndex.value = index;
|
categorySelectedIndex.value = index;
|
||||||
|
await fetchGoodsList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchGoodsList = async () => {
|
||||||
const data = await getGoodsList({
|
const data = await getGoodsList({
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 2,
|
pageSize: 20,
|
||||||
bean: {
|
bean: {
|
||||||
companyId: companyId,
|
|
||||||
keyword: '',
|
keyword: '',
|
||||||
typeIds: [categoryList.value[index].typeId]
|
typeIds: [categoryList.value[categorySelectedIndex.value].typeId]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
goodsList.value = data.rows;
|
goodsList.value = data.rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const addShoppingCart = () => {
|
||||||
|
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
@@ -112,6 +117,7 @@ const changeCategory = async (index: number) => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 210rpx;
|
width: 210rpx;
|
||||||
|
height: 100vh;
|
||||||
|
|
||||||
.category-item {
|
.category-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -123,9 +129,11 @@ const changeCategory = async (index: number) => {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
text {
|
text {
|
||||||
width: 100%;
|
width: 60%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +157,7 @@ const changeCategory = async (index: number) => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
background: white;
|
background: white;
|
||||||
padding: 38rpx 20rpx 0 20rpx;
|
padding: 38rpx 20rpx 0 20rpx;
|
||||||
|
height: 100vh;
|
||||||
|
|
||||||
.goods-item {
|
.goods-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
<view class='content'>
|
<view class='content'>
|
||||||
<view class='swiper-container'>
|
<view class='swiper-container'>
|
||||||
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
|
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
|
||||||
<swiper-item v-for='(item,index) in bannerList' :key='index'>
|
<swiper-item v-for='(item,index) in [goodsBean?.images]' :key='index'>
|
||||||
<image src='/static/images/test_bg.png' />
|
<image :src='item' />
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
<view class='indicator'>
|
<view class='indicator' style='display: none'>
|
||||||
<text>{{ swiperIndex + 1 }}</text>
|
<text>{{ swiperIndex + 1 }}</text>
|
||||||
<text>/{{ bannerList.length }}</text>
|
<text>/{{ bannerList.length }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -14,12 +14,12 @@
|
|||||||
|
|
||||||
<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'>
|
||||||
<text class='goods-price accent-text-color'>39.89</text>
|
<text class='goods-price accent-text-color'>{{ goodsBean?.price || 0 }}</text>
|
||||||
<text>销量2653</text>
|
<text>销量2653</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text>女童夏装套装洋气装短袖阔腿裤子夏装夏装套装</text>
|
<text style='flex: 1'>{{ goodsBean?.name }}</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>
|
||||||
<button class='btn' plain open-type='share'>分享</button>
|
<button class='btn' plain open-type='share'>分享</button>
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||||
<text>共1种颜色可选</text>
|
<text>共1种颜色可选</text>
|
||||||
</view>
|
</view>
|
||||||
<view class='divider' style='width:auto;height: 0.5rpx;margin-left: 100rpx' />
|
<view class='divider' style='width:auto;height: 0.5rpx;margin-left: 100rpx;display: none' />
|
||||||
<view class='c-flex-row' @click.stop='showSkuDialog'>
|
<view class='c-flex-row' style='display: none' @click.stop='showSkuDialog'>
|
||||||
<text>参数</text>
|
<text>参数</text>
|
||||||
<text>品牌 风格 季节 款号</text>
|
<text>品牌 风格 季节 款号</text>
|
||||||
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||||
@@ -45,22 +45,22 @@
|
|||||||
<view class='recommend-view c-flex-column'>
|
<view class='recommend-view c-flex-column'>
|
||||||
<text>浏览此商品的客户还浏览了</text>
|
<text>浏览此商品的客户还浏览了</text>
|
||||||
<scroll-view scroll-x>
|
<scroll-view scroll-x>
|
||||||
<view style='display: inline-block' v-for='(item, index) in [1, 2, 3, 4]'
|
<view style='display: inline-block' v-for='(item, index) in recommendList'
|
||||||
:key='index'>
|
:key='index'>
|
||||||
<view class='recommend-item c-flex-column'>
|
<view class='recommend-item c-flex-column'>
|
||||||
<image :src='assetsUrl("test_bg.png")' />
|
<image :src='item.images' />
|
||||||
<text>女童夏装套装…</text>
|
<text>{{ item.goodsName }}</text>
|
||||||
<text class='goods-price'>22</text>
|
<text class='goods-price'>{{ item.price }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='goods-detail c-flex-column'>
|
<view class='goods-detail c-flex-column' style='display: none'>
|
||||||
<text>商品详情</text>
|
<text>商品详情</text>
|
||||||
<image :src='assetsUrl("test_bg.png")' mode='aspectFill'/>
|
<image :src='assetsUrl("test_bg.png")' mode='aspectFill' />
|
||||||
<image :src='assetsUrl("test_bg.png")' mode='aspectFill'/>
|
<image :src='assetsUrl("test_bg.png")' mode='aspectFill' />
|
||||||
<image :src='assetsUrl("test_bg.png")' mode='aspectFill'/>
|
<image :src='assetsUrl("test_bg.png")' mode='aspectFill' />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='bottom-view c-flex-row'>
|
<view class='bottom-view c-flex-row'>
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
<view class='small-button-item'>
|
<view class='small-button-item'>
|
||||||
<view class='shoppingcart-count' @click.stop='goPath("/pages/mall/subs/shoppingcart/index")'>
|
<view class='shoppingcart-count' @click.stop='goPath("/pages/mall/subs/shoppingcart/index")'>
|
||||||
<image :src='assetsUrl("ic_goods_shoppingcart.png")' />
|
<image :src='assetsUrl("ic_goods_shoppingcart.png")' />
|
||||||
<text>12</text>
|
<text>0</text>
|
||||||
</view>
|
</view>
|
||||||
<text>购物车</text>
|
<text>购物车</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -90,19 +90,37 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<sku-dialog ref='skuDialogRef' />
|
<sku-dialog ref='skuDialogRef' @bean='goodsBean' />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
import { goPath } from '@/utils';
|
|
||||||
import SkuDialog from '@/components/sku-dialog.vue';
|
import SkuDialog from '@/components/sku-dialog.vue';
|
||||||
|
import { goPath } from '@/utils';
|
||||||
|
import { getGoodsDetail, getGoodsList } from '@/api/goods';
|
||||||
|
import { GoodsBean } from '@/api/goods/types';
|
||||||
|
|
||||||
|
const goodsBean = ref<GoodsBean>();
|
||||||
|
const recommendList = ref<GoodsBean[]>();
|
||||||
|
|
||||||
const skuDialogRef = ref();
|
const skuDialogRef = ref();
|
||||||
|
|
||||||
const bannerList = ref([1, 2, 3, 4]);
|
const bannerList = ref([]);
|
||||||
const swiperIndex = ref(0);
|
const swiperIndex = ref(0);
|
||||||
|
|
||||||
|
onLoad(async (e: any) => {
|
||||||
|
goodsBean.value = await getGoodsDetail(e.goodsId);
|
||||||
|
const { rows } = await getGoodsList({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
bean: {
|
||||||
|
keyword: '',
|
||||||
|
typeIds: ['519334122586648576']
|
||||||
|
}
|
||||||
|
});
|
||||||
|
recommendList.value = rows;
|
||||||
|
});
|
||||||
|
|
||||||
const swiperChange = (e: any) => {
|
const swiperChange = (e: any) => {
|
||||||
swiperIndex.value = e.detail.current;
|
swiperIndex.value = e.detail.current;
|
||||||
};
|
};
|
||||||
@@ -263,7 +281,7 @@ const placeOrder = () => {
|
|||||||
|
|
||||||
view:nth-of-type(1) {
|
view:nth-of-type(1) {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
padding-top: 40rpx;
|
padding-top: 20rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,6 +419,7 @@ const placeOrder = () => {
|
|||||||
.goods-detail {
|
.goods-detail {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
|
|
||||||
text {
|
text {
|
||||||
margin: 20rpx 30rpx;
|
margin: 20rpx 30rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@@ -3,13 +3,13 @@
|
|||||||
<image v-if='item.status==0' :src='assetsUrl("bg_coupon.png")' />
|
<image v-if='item.status==0' :src='assetsUrl("bg_coupon.png")' />
|
||||||
<image v-else-if='item.status==1' :src='assetsUrl("bg_coupon_expired.png")' />
|
<image v-else-if='item.status==1' :src='assetsUrl("bg_coupon_expired.png")' />
|
||||||
<view class='left-content accent-text-color' :class='{"left-content-disabled": item.status==1}'>
|
<view class='left-content accent-text-color' :class='{"left-content-disabled": item.status==1}'>
|
||||||
<text>{{ item.price }}</text>
|
<text>{{ item.reduce }}</text>
|
||||||
<text>满{{ item.threshold }}元可用</text>
|
<text>满{{ item.threshold }}元可用</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='right-content accent-text-color' :class='{"right-content-disabled": item.status==1}'>
|
<view class='right-content accent-text-color' :class='{"right-content-disabled": item.status==1}'>
|
||||||
<text>{{ item?.title }}</text>
|
<text>{{ item?.name }}</text>
|
||||||
<text>有效期至{{ item.useTime }}</text>
|
<text>有效期至{{ dayjs(item.startTime).format("YYYY-MM-DD") }}</text>
|
||||||
<text class='btn-text' :class='{"btn-text-disabled": item.status==1}'>
|
<text class='btn-text' :class='{"btn-text-disabled": item.status==1}'>
|
||||||
立即使用
|
立即使用
|
||||||
</text>
|
</text>
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
item: Object
|
item: Object
|
||||||
@@ -76,7 +77,7 @@ defineProps({
|
|||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-left: 100rpx;
|
margin-left: 60rpx;
|
||||||
|
|
||||||
text:nth-of-type(1) {
|
text:nth-of-type(1) {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<tabbar :titles='["全部","未使用","已使用"]' :indicator-color='"#D95554"' @change='args => {}' />
|
<tabbar :titles='["全部","未使用","已使用"]' :indicator-color='"#D95554"' @change='tabChange' />
|
||||||
<scroll-view :scroll-y='true' class='content'>
|
<scroll-view :scroll-y='true' class='content' @loadmore='onLoadMore'>
|
||||||
<coupon-item v-for='item in coupons' :item='item' />
|
<coupon-item v-for='item in coupons' :item='item' />
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</template>
|
</template>
|
||||||
@@ -10,70 +10,38 @@
|
|||||||
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';
|
import { useUserStore } from '@/store';
|
||||||
|
import { getCompanyId } from '@/utils';
|
||||||
|
|
||||||
const store = useUserStore();
|
const store = useUserStore();
|
||||||
const { userInfo } = storeToRefs(store);
|
const { userInfo } = storeToRefs(store);
|
||||||
|
|
||||||
const coupons = ref([{
|
const coupons = ref([]);
|
||||||
id: 1,
|
|
||||||
title: '优惠券',
|
|
||||||
desc: '满100减10',
|
|
||||||
price: 100,
|
|
||||||
threshold: 10,
|
|
||||||
priceDesc: '满100减10',
|
|
||||||
useTime: '2021-12-31',
|
|
||||||
status: 1,
|
|
||||||
useStatus: '未使用'
|
|
||||||
}, {
|
|
||||||
id: 1,
|
|
||||||
title: '优惠券',
|
|
||||||
desc: '满100减10',
|
|
||||||
price: 200,
|
|
||||||
threshold: 80,
|
|
||||||
priceDesc: '满100减10',
|
|
||||||
useTime: '2021-01-01',
|
|
||||||
status: 1,
|
|
||||||
useStatus: '未使用'
|
|
||||||
}, {
|
|
||||||
id: 1,
|
|
||||||
title: '优惠券',
|
|
||||||
desc: '满100减10',
|
|
||||||
price: 300,
|
|
||||||
threshold: 60,
|
|
||||||
priceDesc: '满100减10',
|
|
||||||
useTime: '2023-12-31',
|
|
||||||
status: '0',
|
|
||||||
useStatus: '未使用'
|
|
||||||
}, {
|
|
||||||
id: 1,
|
|
||||||
title: '优惠券',
|
|
||||||
desc: '满100减10',
|
|
||||||
price: 50,
|
|
||||||
threshold: 50,
|
|
||||||
priceDesc: '满100减10',
|
|
||||||
useTime: '2021-10-31',
|
|
||||||
status: 0,
|
|
||||||
useStatus: '未使用'
|
|
||||||
}, {
|
|
||||||
id: 1,
|
|
||||||
title: '优惠券',
|
|
||||||
desc: '满1000减30',
|
|
||||||
price: 200,
|
|
||||||
threshold: 30,
|
|
||||||
priceDesc: '满100减10',
|
|
||||||
useTime: '2024-12-31',
|
|
||||||
status: 0,
|
|
||||||
useStatus: '未使用'
|
|
||||||
}]);
|
|
||||||
|
|
||||||
onLoad(async () => {
|
onLoad(async () => {
|
||||||
const { data } = await getCouponList({
|
fetchData(0);
|
||||||
obj: {
|
|
||||||
memberId: userInfo.value?.id, status: 0
|
|
||||||
}, pageNum: 1, pageSize: 1000
|
|
||||||
});
|
|
||||||
coupons.value = data.list;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const tabChange = (index: number) => {
|
||||||
|
fetchData(index);
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchData = async (status: number) => {
|
||||||
|
const { list } = await getCouponList({
|
||||||
|
companyId: getCompanyId(),
|
||||||
|
memberId: userInfo.value?.id,
|
||||||
|
status: status,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20
|
||||||
|
});
|
||||||
|
coupons.value = list;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onLoadMore = () => {
|
||||||
|
if(coupons.value.length >= 20) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fetchData(0);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<view class='member-info-view'>
|
<view class='member-info-view'>
|
||||||
<image :src='assetsUrl("ic_crown.png")' />
|
<image :src='assetsUrl("ic_crown.png")' />
|
||||||
<view class='flex flex-col'>
|
<view class='flex flex-col'>
|
||||||
<text>武汉白银会员</text>
|
<text>{{ userInfo.levelName}}</text>
|
||||||
<view />
|
<view />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -63,7 +63,6 @@ onLoad(() => {
|
|||||||
codeRefreshInterval.value -= 1;
|
codeRefreshInterval.value -= 1;
|
||||||
if(codeRefreshInterval.value == 0) {
|
if(codeRefreshInterval.value == 0) {
|
||||||
codeRefreshInterval.value = 30;
|
codeRefreshInterval.value = 30;
|
||||||
codeContent.value = Date.now().toFixed(0);
|
|
||||||
generateCode();
|
generateCode();
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
Reference in New Issue
Block a user