Merge branch 'dev' into 'master'

uniapp【修复】: 优化订单列表下单方式和修复个人中心修改资料选择生日

See merge request jianweie/coreshoppro!75
This commit is contained in:
bob bob
2024-11-09 11:02:18 +00:00
5 changed files with 45 additions and 35 deletions

View File

@@ -9,7 +9,7 @@
<view class="user-info">
<view class="img-box">
<image class="img"
:src="handleStaticResources(userInfoStore.userInfo?.avatarImage || '/static/images/common/empty.png')">
:src="userInfoStore.userInfo?.avatarImage || '/static/images/common/empty.png'">
</image>
</view>
<template v-if="userInfoStore.userInfo && Object.keys(userInfoStore.userInfo).length > 0">

View File

@@ -11,7 +11,7 @@
</uv-input>
</view>
<view class="store-box" v-if="state.storeList.length > 0">
<view class="item-box" v-for="item in state.storeList" :key="item.id">
<view class="item-box" v-for="item in state.storeList" :key="item.id" @click="handleSelectStore(item)">
<view class="img-box">
<image class="img" :src="item.logoImage"></image>
</view>
@@ -32,7 +32,7 @@
<view class="lab">距离</view>
<view class="val">
<text>{{ item.distanceStr }}</text>
<uv-tags text="选择" @click="handleSelectStore(item)" size="mini"
<uv-tags text="选择" size="mini"
type="success"></uv-tags>
</view>
</view>

View File

@@ -99,8 +99,8 @@
min-width: 40rpx;
}
.no-store {
margin: auto;
font-size: 28rpx;
color: #aaaaaa;
}
.store-address-box {
.store-address {

View File

@@ -33,16 +33,15 @@
请添加收货地址
</view>
<view class="icon">
<uv-icon name="arrow-right" color="#2C2C2B" size="20"></uv-icon>
<uv-icon name="arrow-right" color="#aaaaaa" size="20"></uv-icon>
</view>
</view>
<view class="address-line"></view>
</view>
<!-- 门店自提 -->
<view class="store-pickup-box" v-if="state.tabSelectType === OrderDistributionEnum.selfDelivery">
<view class="pickup-box">
<view class="store-box" v-if="Object.keys(state.store).length > 0"
@click="handleRouteNavigateTo(`/pages/order/storeList/storeList`)">
<view class="pickup-box" @click="handleRouteNavigateTo(`/pages/order/storeList/storeList`)">
<view class="store-box" v-if=" state.store && Object.keys(state.store).length > 0">
<view class="store-address-box">
<view class="store-address">
<text class="name">{{ state.store?.storeName }}</text>
@@ -51,11 +50,12 @@
<view class="street">{{ state.store?.address }}</view>
</view>
<view class="icon">
<uv-icon name="arrow-right" color="#2C2C2B" size="20"></uv-icon>
<uv-icon name="arrow-right" color="#aaaaaa" size="20"></uv-icon>
</view>
</view>
<view class="store-box" v-else>
<view class="no-store">暂无门店</view>
<view class="no-store">请选择门店</view>
<uv-icon name="arrow-right" color="#aaaaaa" size="18"></uv-icon>
</view>
<view class="address-line"></view>
</view>
@@ -261,19 +261,19 @@
success : Function,
file : Function,
}
interface TabList {
name : string,
type : OrderDistributionEnum;
show : boolean;
}
/** 获取项目配置 */
const shopConfigStore : ShopConfigStoreType = useShopConfigStore();
const state = reactive<{
orderType : PaymentTypeEnum; // 订单类型
tabList : Array<TabList>; // 送达方式
tabSelectType : OrderDistributionEnum; // 送达方式类型
tabSelectType ?: OrderDistributionEnum; // 送达方式类型
userDefaultShip : AddressType; // 默认地址数据
leaveMsg : string; // 卖家留言
cartData : any; // 商品购物车数据
@@ -293,11 +293,11 @@
}>({
orderType: PaymentTypeEnum.common,
tabList: [
{ name: '快递物流', type: OrderDistributionEnum.mailing, show: true, },
{ name: '同城配送', type: OrderDistributionEnum.homeDelivery, show: true, },
{ name: '门店自提', type: OrderDistributionEnum.selfDelivery, show: true, }
{ name: '快递物流', type: OrderDistributionEnum.mailing, show: false, },
{ name: '同城配送', type: OrderDistributionEnum.homeDelivery, show: false, },
{ name: '门店自提', type: OrderDistributionEnum.selfDelivery, show: false, }
],
tabSelectType: OrderDistributionEnum.mailing,
tabSelectType: null,
userDefaultShip: {},
leaveMsg: "",
cartData: {},
@@ -320,7 +320,7 @@
const loadingPage = ref(true);
const handleSubmit = useLoadingFn(onSubmit, loading);
const handleGetOrderDetail = useLoadingFn(getOrderDetail, loadingPage);
/** 是否显示积分兑换价合计 */
const isShowPointRedemptionPrice = computed(() => {
return shopConfigStore.config.pointSwitch == OpenPointEnum.yes &&
@@ -466,14 +466,25 @@
const orderDistribution : Response<any> = await queryOrderDistributionModel({
id: state.orderType,
});
if (!orderDistribution?.data || Object.keys(orderDistribution?.data).length === 0) {
handleShowToast('暂无下单配送方式');
return;
}
const { isOpenMailing, isOpenHomeDelivery, isOpenSelfDelivery } = orderDistribution?.data;
if (!isOpenMailing && !isOpenHomeDelivery && !isOpenSelfDelivery) {
handleShowToast('暂无下单配送方式');
return;
}
/** 物流快递 */
state.tabList[0].show = orderDistribution?.data?.isOpenMailing;
state.tabList[0].show = isOpenMailing;
/** 同城配送 */
state.tabList[1].show = orderDistribution?.data?.isOpenHomeDelivery;
state.tabList[1].show = isOpenHomeDelivery;
/** 门店自提 */
state.tabList[2].show = orderDistribution?.data?.isOpenSelfDelivery;
state.tabSelectType = (state.tabList.find((item:TabList)=> item.show)).type || OrderDistributionEnum.mailing ;
state.tabList[2].show = isOpenSelfDelivery;
state.tabSelectType = (state.tabList.find((item : TabList) => item.show))?.type || OrderDistributionEnum.mailing;
}
/** 获取用户默认地址 */
@@ -542,10 +553,8 @@
/** 获取默认店铺 */
const getDefaultStore = async () => {
const defaultStore : Response<StoreListType> = await queryDefaultStore();
if (defaultStore.status) {
if (defaultStore.status && defaultStore.data) {
state.store = defaultStore.data;
} else {
handleShowToast('商家未配置默认自提店铺!');
}
}
@@ -577,6 +586,10 @@
/** 立即购买 */
async function onSubmit() {
let delivery : any = {};
if (!state.tabSelectType) {
handleShowToast('请选择下单配送方式');
return;
}
/** 如果是快递物流 / 同城送货 */
if (state.tabSelectType === OrderDistributionEnum.mailing || state.tabSelectType == OrderDistributionEnum.homeDelivery) {
if (!state.userDefaultShip.id || !state.userDefaultShip.areaId) {

View File

@@ -75,7 +75,7 @@
nickname : string;
radiolist : Array<{ [key : string] : any }>;
sex : string;
birthdayTemporary : string;
birthdayTemporary : number;
birthday : string;
avatar : string;
userInfo : UserInfoType,
@@ -86,7 +86,7 @@
avatar: "",
nickname: "",
sex: "",
birthdayTemporary: "",
birthdayTemporary: null,
birthday: "",
submitStatus: true,
radiolist: [{
@@ -143,7 +143,7 @@
/** 修改昵称 */
const hanldeChangeNickName= (e:any)=>{
state.nickname = e.detail.value;
state.nickname = e.detail?.value?.trim();
}
/** 获取用户信息 */
@@ -152,12 +152,12 @@
state.userInfo = userInfo?.data;
if (userInfo?.data?.birthday) {
state.percentage += 25;
state.birthdayTemporary = String(new Date(userInfo?.data?.birthday).getTime());
state.birthdayTemporary =new Date(userInfo.data.birthday).getTime();
state.birthday = timeFormat(userInfo?.data?.birthday, 'yyyy-mm-dd');
}
if (userInfo?.data?.nickName) {
state.percentage += 25;
state.nickname = userInfo?.data?.nickName;
state.nickname = userInfo?.data?.nickName?.trim();
}
if (userInfo?.data?.avatarImage) {
state.percentage += 25;
@@ -204,10 +204,7 @@
}
if (!state.nickname) {
handleShowToast('请输入昵称'); return;
}
if (state.nickname.length < 2 || state.nickname.length > 16) {
handleShowToast('称长度在2到16个长度'); return;
}
}
if (!state.sex) {
handleShowToast('请选择性别'); return;
}