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

This commit is contained in:
21世纪小八路
2024-11-09 00:02:38 +08:00
parent 56dc7c9d3a
commit 380bb582e4
4 changed files with 32 additions and 22 deletions

View File

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

View File

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

View File

@@ -33,7 +33,7 @@
请添加收货地址 请添加收货地址
</view> </view>
<view class="icon"> <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> </view>
<view class="address-line"></view> <view class="address-line"></view>
@@ -41,7 +41,7 @@
<!-- 门店自提 --> <!-- 门店自提 -->
<view class="store-pickup-box" v-if="state.tabSelectType === OrderDistributionEnum.selfDelivery"> <view class="store-pickup-box" v-if="state.tabSelectType === OrderDistributionEnum.selfDelivery">
<view class="pickup-box" @click="handleRouteNavigateTo(`/pages/order/storeList/storeList`)"> <view class="pickup-box" @click="handleRouteNavigateTo(`/pages/order/storeList/storeList`)">
<view class="store-box" v-if="Object.keys(state.store).length > 0"> <view class="store-box" v-if=" state.store && Object.keys(state.store).length > 0">
<view class="store-address-box"> <view class="store-address-box">
<view class="store-address"> <view class="store-address">
<text class="name">{{ state.store?.storeName }}</text> <text class="name">{{ state.store?.storeName }}</text>
@@ -50,11 +50,12 @@
<view class="street">{{ state.store?.address }}</view> <view class="street">{{ state.store?.address }}</view>
</view> </view>
<view class="icon"> <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> </view>
<view class="store-box" v-else> <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>
<view class="address-line"></view> <view class="address-line"></view>
</view> </view>
@@ -292,9 +293,9 @@
}>({ }>({
orderType: PaymentTypeEnum.common, orderType: PaymentTypeEnum.common,
tabList: [ tabList: [
{ name: '快递物流', type: OrderDistributionEnum.mailing, show: true, }, { name: '快递物流', type: OrderDistributionEnum.mailing, show: false, },
{ name: '同城配送', type: OrderDistributionEnum.homeDelivery, show: true, }, { name: '同城配送', type: OrderDistributionEnum.homeDelivery, show: false, },
{ name: '门店自提', type: OrderDistributionEnum.selfDelivery, show: true, } { name: '门店自提', type: OrderDistributionEnum.selfDelivery, show: false , }
], ],
tabSelectType: OrderDistributionEnum.mailing, tabSelectType: OrderDistributionEnum.mailing,
userDefaultShip: {}, userDefaultShip: {},
@@ -465,14 +466,25 @@
const orderDistribution : Response<any> = await queryOrderDistributionModel({ const orderDistribution : Response<any> = await queryOrderDistributionModel({
id: state.orderType, id: state.orderType,
}); });
/** 物流快递 */
state.tabList[0].show = orderDistribution?.data?.isOpenMailing;
/** 同城配送 */
state.tabList[1].show = orderDistribution?.data?.isOpenHomeDelivery;
/** 门店自提 */
state.tabList[2].show = orderDistribution?.data?.isOpenSelfDelivery;
state.tabSelectType = (state.tabList.find((item:TabList)=> item.show)).type || OrderDistributionEnum.mailing ; 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 = isOpenMailing;
/** 同城配送 */
state.tabList[1].show = isOpenHomeDelivery;
/** 门店自提 */
state.tabList[2].show = isOpenSelfDelivery;
state.tabSelectType = (state.tabList.find((item : TabList) => item.show))?.type || OrderDistributionEnum.mailing;
} }
/** 获取用户默认地址 */ /** 获取用户默认地址 */
@@ -543,8 +555,6 @@
const defaultStore : Response<StoreListType> = await queryDefaultStore(); const defaultStore : Response<StoreListType> = await queryDefaultStore();
if (defaultStore.status && defaultStore.data) { if (defaultStore.status && defaultStore.data) {
state.store = defaultStore.data; state.store = defaultStore.data;
} else {
handleShowToast('商家未配置默认自提店铺!');
} }
} }

View File

@@ -75,7 +75,7 @@
nickname : string; nickname : string;
radiolist : Array<{ [key : string] : any }>; radiolist : Array<{ [key : string] : any }>;
sex : string; sex : string;
birthdayTemporary : string; birthdayTemporary : number;
birthday : string; birthday : string;
avatar : string; avatar : string;
userInfo : UserInfoType, userInfo : UserInfoType,
@@ -86,7 +86,7 @@
avatar: "", avatar: "",
nickname: "", nickname: "",
sex: "", sex: "",
birthdayTemporary: "", birthdayTemporary: null,
birthday: "", birthday: "",
submitStatus: true, submitStatus: true,
radiolist: [{ radiolist: [{
@@ -152,7 +152,7 @@
state.userInfo = userInfo?.data; state.userInfo = userInfo?.data;
if (userInfo?.data?.birthday) { if (userInfo?.data?.birthday) {
state.percentage += 25; 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'); state.birthday = timeFormat(userInfo?.data?.birthday, 'yyyy-mm-dd');
} }
if (userInfo?.data?.nickName) { if (userInfo?.data?.nickName) {