This commit is contained in:
2024-04-14 01:43:37 +08:00
parent b676a1acd9
commit 16dac8d97f
17 changed files with 60 additions and 32 deletions

View File

@@ -1,8 +1,8 @@
<script setup lang="ts">
<script setup lang='ts'>
import { mpUpdate } from '@/utils';
onLaunch(() => {
console.log('App Launch');
onLaunch((options) => {
console.log('App Launch options ', options);
// #ifdef MP
mpUpdate();
// #endif
@@ -15,7 +15,7 @@ onHide(() => {
});
</script>
<style lang="scss">
<style lang='scss'>
/* 每个页面公共css */
@import 'uview-plus/index.scss';
@import '@/static/styles/common.scss';

View File

@@ -2,7 +2,7 @@
<uni-popup ref='popupRef' type='bottom' :mask-click='false' @touchmove.stop.prevent=''>
<view class='content'>
<view class='c-flex-row' style='align-items: flex-start'>
<image class='goods-image' :src='goodsDetailBean?.images' />
<image class='goods-image' :src='goodsDetailBean?.images||defaultImage' />
<view class='c-flex-column' style='flex: 1'>
<text class='goods-name'>{{ goodsDetailBean?.name }}</text>
<text class='goods-price'>{{ flashPrice > 0 ? `${flashPrice}` : `${goodsDetailBean?.price}` || 0 }}</text>
@@ -54,7 +54,7 @@
<script lang='ts' setup>
import { PropType, ref } from 'vue';
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import { showToast } from '@/utils';
import { getGoodsDetail } from '@/api/goods';
import { GoodsBean, StockBean } from '@/api/goods/types';

View File

@@ -32,6 +32,12 @@
"style": {
"navigationBarTitleText": "我的"
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "肃客会员"
}
}
],
"subPackages": [

View File

@@ -3,7 +3,7 @@
<view class='swiper-container'>
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
<swiper-item v-for='(item,index) in bannerList' :key='index'>
<image :src='item' />
<image :src='item||defaultImage' />
</swiper-item>
</swiper>
<view class='indicator'>
@@ -129,7 +129,7 @@
</template>
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import dayjs from 'dayjs';
import { formatTimeWithZeroPad, goPath, isLogin } from '@/utils';
import SkuDialog from '@/components/sku-dialog.vue';

View File

@@ -10,7 +10,7 @@
<!-- <u-list-item v-for='(item,index) in groupbuyList' :key='index'>-->
<view class='c-flex-column' v-for='(item,index) in groupbuyList' :key='index'>
<view class='item c-flex-row' @click.stop='goPath(`/pages/common/groupbuy/detail?id=${item.id}`)'>
<image class='goods-image' :src='JSON.parse(item.content)[0].images' />
<image class='goods-image' :src='JSON.parse(item.content)[0].images||defaultImage' />
<view class='c-flex-column' style='flex: 1'>
<view class='goods-name'>{{ item.name }}</view>
<view class='middle-view c-flex-row'>
@@ -37,7 +37,7 @@
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import { getGroupBuyList } from '@/api/groupbuy';
import { goPath } from '@/utils';

View File

@@ -3,7 +3,7 @@
<view class='card-view'>
<template class='c-flex-row' v-for='item in orderBean?.orderGoods' :key='item.id'>
<image class='goods-image' :src='item?.images' />
<image class='goods-image' :src='item?.images||defaultImage' />
<view class='c-flex-column' style='flex: 1'>
<text class='goods-name'>{{ item?.goodsName || item?.goodsCode }}</text>
<text class='goods-sku'>{{ item?.stockStock?.colorName }} {{ item?.stockStock?.sizeName }}</text>
@@ -50,6 +50,7 @@ import { parseParameter, sortASCII } from '@/utils';
import { hexMD5 } from '@/utils/common/md5';
import { useUserStore } from '@/store';
import { handlePayResult } from '@/utils/order';
import { defaultImage } from '@/utils/assets';
const userState = useUserStore();
const { terminalInfo } = storeToRefs(userState);
@@ -79,7 +80,6 @@ const buildSqbParams = computed(() => {
});
const navigateTo = (e: any) => {
console.log('----------->>>>>navigateTo ', e);
handlePayResult(orderBean.value?.id, e, {
onSuccess: () => {
pay({

View File

@@ -3,7 +3,7 @@
<swiper class='swiper' :indicator-dots='true' :autoplay='true' :interval='3000' :duration='1000'
@change='swiperChange'>
<swiper-item v-for='(item, index) in companyConfigInfo?.bannerinx' :key='index'>
<image :src='item.src' mode='aspectFill' />
<image :src='item.src||defaultImage' mode='aspectFill' />
</swiper-item>
</swiper>
@@ -69,7 +69,7 @@
<script setup lang='ts'>
import { getCompanyList } from '@/api/company';
import { useUserStore } from '@/store';
import { assetsUrl, defaultAvatar } from '@/utils/assets';
import { assetsUrl, defaultAvatar, defaultImage } from '@/utils/assets';
import { getCompanyId, goPath, isLogin } from '@/utils';
import { storeToRefs } from 'pinia';

15
src/pages/index/index.vue Normal file
View File

@@ -0,0 +1,15 @@
<template>
</template>
<script lang='ts' setup>
onMounted(() => {
uni.reLaunch({
url: '/pages/home/index'
});
});
</script>
<style lang='scss' scoped>
</style>

View File

@@ -20,7 +20,7 @@
<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/detail?goodsId=${item.goodsId}`)'>
<image class='goods-image' :src='item.images' />
<image class='goods-image' :src='item.images||defaultImage' />
<text class='goods-name'>{{ item.goodsName }}</text>
<text class='goods-price'>¥{{ item.price }}</text>
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' @click.stop='addShoppingCart(item)' />
@@ -42,7 +42,7 @@
<script setup lang='ts'>
import SkuDialog from '@/components/sku-dialog.vue';
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import { goLogin, goPath, isLogin, showToast } from '@/utils';
import { getCategoryList, getGoodsList } from '@/api/goods';
import { CategoryBean, GoodsBean } from '@/api/goods/types';

View File

@@ -3,7 +3,7 @@
<view class='swiper-container'>
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
<swiper-item v-for='(item,index) in [goodsBean?.images]' :key='index'>
<image :src='item' />
<image :src='item||defaultImage' />
</swiper-item>
</swiper>
<view class='indicator' style='display: none'>
@@ -48,7 +48,7 @@
<view style='display: inline-block' v-for='(item, index) in recommendList'
:key='index'>
<view class='recommend-item c-flex-column'>
<image :src='item.images' />
<image :src='item.images||defaultImage' />
<text>{{ item.goodsName }}</text>
<text class='goods-price'>{{ item.price }}</text>
</view>
@@ -94,7 +94,7 @@
</template>
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import SkuDialog from '@/components/sku-dialog.vue';
import { goPath, showToast } from '@/utils';
import { getGoodsDetail, getGoodsList } from '@/api/goods';

View File

@@ -39,7 +39,7 @@
<view class='goods-info-view c-flex-column'>
<view class='c-flex-row' style='margin-bottom: 20rpx' v-for='(item,index) in orderBean?.orderGoods'
:key='index'>
<image class='goods-image' :src='item.images' />
<image class='goods-image' :src='item.images||defaultImage' />
<view class='c-flex-column' style='flex: 1;'>
<view class='c-flex-row'>
<text class='goods-name'>{{ item.name }}</text>
@@ -121,7 +121,7 @@
</template>
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import PaymentDialog from '@/components/payment-dialog.vue';
import CouponDialog from '@/pages/mall/subs/components/coupon-dialog.vue';
import { goPath, parseParameter, sortASCII } from '@/utils';
@@ -198,7 +198,6 @@ const navigateTo = (e: any) => {
};
const createOrder = async () => {
await uni.showLoading();
const params = {
// 'discount': 0,
// 'freePrice': 0,
@@ -227,11 +226,12 @@ const createOrder = async () => {
}
))
};
await uni.showLoading();
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);

View File

@@ -11,7 +11,7 @@
<grid-view :cross-axis-count='2'>
<view v-for='(item, index) in goodsList' :key='index' class='goods-item'
@click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'>
<image class='goods-image' :src='item.images' />
<image class='goods-image' :src='item.images||defaultImage' />
<text class='goods-name'>{{ item.goodsName }}</text>
<text class='goods-price'>¥{{ item.price }}</text>
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' @click.stop='addShoppingCart(item)' />
@@ -24,7 +24,7 @@
<script lang='ts' setup>
import SkuDialog from '@/components/sku-dialog.vue';
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import { goPath } from '@/utils';
import { getGoodsList } from '@/api/goods';
import useShoppingCartStore from '@/store/modules/shoppingcart';

View File

@@ -13,7 +13,7 @@
<image class='checkbox'
:src='assetsUrl(item.checked?"ic_checkbox_active_red.png":"ic_checkbox_normal.png")'
@click.stop='item.checked=!item.checked' />
<image class='goods-image' :src='item.images' />
<image class='goods-image' :src='item.images||defaultImage' />
<view class='c-flex-column'>
<text>{{ item.name }}</text>
<view class='c-flex-row'>
@@ -61,7 +61,7 @@
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import useShoppingCartStore from '@/store/modules/shoppingcart';
import { goPath, showToast } from '@/utils';
import { GoodsBean, StockBean } from '@/api/goods/types';

View File

@@ -1,7 +1,7 @@
<template>
<view class='card-view' @click.stop='goPath(`/pages/mine/subs/order/detail?orderId=${item?.id}`)'>
<view class='goods-info-view c-flex-row'>
<image class='goods-image' :src='item?.orderGoods[0].images' />
<image class='goods-image' :src='item?.orderGoods[0].images||defaultImage' />
<view class='c-flex-column' style='flex: 1;'>
<view class='c-flex-row'>
<text class='goods-name'>{{ item?.orderGoods[0].goodsName }}</text>
@@ -42,7 +42,7 @@
<script lang='ts' setup>
import { PropType } from 'vue';
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import { goPath } from '@/utils';
import { isPending } from '@/utils/order';
import { OrderBean } from '@/api/order/types';

View File

@@ -15,7 +15,8 @@
</view>
</view>
</view>
<view class='address-view c-flex-column' v-if='orderBean?.order?.address'>
<view class='address-view c-flex-column'
v-if='orderBean?.order?.address'>
<view class='user-info c-flex-row'>
<text v-if='orderBean.order.address.defaultstatus==1'>默认</text>
<text>{{ orderBean?.order?.address.name }}</text>
@@ -34,7 +35,7 @@
<view class='goods-info-view c-flex-column'>
<view class='c-flex-row' style='margin-bottom: 20rpx' v-for='(item,index) in orderBean?.order.orderGoods'
:key='index'>
<image class='goods-image' :src='item.stockStock.images' />
<image class='goods-image' :src='item.stockStock.images||defaultImage' />
<view class='c-flex-column' style='flex: 1;'>
<view class='c-flex-row'>
<text class='goods-name'>{{ item.goodsName }}</text>
@@ -112,7 +113,7 @@
</template>
<script lang='ts' setup>
import { assetsUrl } from '@/utils/assets';
import { assetsUrl, defaultImage } from '@/utils/assets';
import { getOrderDetail } from '@/api/order';
import { OrderBean } from '@/api/order/types';
import { parseParameter, sortASCII } from '@/utils';
@@ -140,6 +141,9 @@ onLoad(async (e: any) => {
const fetchData = async (orderId: string) => {
await uni.showLoading();
orderBean.value = await getOrderDetail(orderId);
if(orderBean.value?.order.address) {
orderBean.value.order.address = JSON.parse(orderBean?.value.order?.address);
}
uni.hideLoading();
};

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

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