feat:修复地址

This commit is contained in:
2026-07-16 22:08:56 +08:00
parent a879198143
commit 16fef18079
3 changed files with 112 additions and 26 deletions
+68 -13
View File
@@ -1,15 +1,15 @@
<template>
<view v-if="pageReady" class="home_warp" :class="platformType ? '' : 'iosplatformType'">
<view class="home_warp" :class="platformType ? '' : 'iosplatformType'">
<!-- 带背景的头部 -->
<view class="home_content_z_warp">
<view class="home_header_warp">
<view class="header_title_warp">
<view class="language_warp" style="width: 100%; justify-content: flex-start" @click="jumpSearch">
<view style="margin-top: 10rpx">
<view class="home_header_warp" :style="mpHeaderWarpStyle">
<view class="header_title_warp" :style="mpHeaderStyle">
<view class="language_warp" :style="mpLanguageStyle" style="width: 100%; justify-content: flex-start;" @click="jumpSearch">
<view :style="isMP ? 'display: flex; align-items: center;' : 'margin-top: 10rpx;'">
<up-image src="https://static.tbmall.xin/static/home/search_b.png" width="20" height="20"
bgColor="#f1f6ff00"></up-image>
</view>
<text class="search_msg_warp">搜索</text>
<text class="search_msg_warp" :style="isMP ? 'line-height: 1;' : ''">搜索</text>
</view>
<image src="https://static.tbmall.xin/static/chart.png" class="chart_img" @click.stop="jumpNewSearch('list')">
</image>
@@ -62,8 +62,10 @@
<!-- <up-loading-icon :show="productLoading"></up-loading-icon> -->
<view class="yp_item" v-for="item in faddishProduct" :key="item.id" @click.stop="jumpInfo(item)">
<view class="yp_item_image_wrapper">
<up-image :src="item.url" width="100%" height="88" bgColor="#f1f6ff00" shape="square"
radius="15"></up-image>
<image :src="item.url" mode="aspectFill" class="yp_item_image" shape="square"
radius="15"></image>
<!-- <up-image :src="item.url" width="100%" height="88" bgColor="#f1f6ff00" shape="square"
radius="15"></up-image> -->
</view>
<view class="yp_item_info">
<view class="yp_item_name">{{ item.title }}</view>
@@ -279,7 +281,11 @@ export default {
], // 首页活动列表
activedTabId: "seckill", // 当前选中的活动类型
attributes: {},
seckillActivedType: 'seckill'
seckillActivedType: 'seckill',
isMP: false,
mpHeaderWarpStyle: {},
mpHeaderStyle: {},
mpLanguageStyle: {},
};
},
onShow() {
@@ -315,13 +321,56 @@ export default {
uni.hideTabBar({
animation: false,
});
/*#endif*/
// 不需要启动页,才渲染首页
this.pageReady = true;
// #ifdef MP
this.isMP = true;
this.initMPHeader();
// #endif
},
mounted() { },
methods: {
initMPHeader() {
try {
const menuButton = uni.getMenuButtonBoundingClientRect();
const systemInfo = uni.getSystemInfoSync();
const statusBarHeight = systemInfo.statusBarHeight || 0;
const menuButtonHeight = menuButton.height;
const menuButtonTop = menuButton.top;
const menuButtonLeft = menuButton.left;
const windowWidth = systemInfo.windowWidth;
// Calculate padding-right to avoid the capsule button (add extra margin of 10px)
const paddingRight = windowWidth - menuButtonLeft + 10;
// Dynamic styles for MP
this.mpHeaderStyle = {
paddingTop: `${menuButtonTop}px`,
paddingRight: `${paddingRight}px`,
paddingBottom: '10px',
paddingLeft: '15px',
height: `${menuButtonHeight}px`,
boxSizing: 'content-box',
display: 'flex',
alignItems: 'center'
};
this.mpLanguageStyle = {
height: `${menuButtonHeight}px`,
boxSizing: 'border-box',
display: 'flex',
alignItems: 'center'
};
const warpPaddingTop = menuButtonTop + menuButtonHeight + 15;
this.mpHeaderWarpStyle = {
paddingTop: `${warpPaddingTop}px`
};
} catch (e) {
console.error("initMPHeader error:", e);
}
},
// 切换活动类型
jumpTab(item, type) {
if (this.activedTabId === type) return;
@@ -339,7 +388,7 @@ export default {
console.log("获取秒杀", res);
if (res.bizcode === 100) {
this.seckillGoodsList = [];
if(res.data.activityId){
if(res.data?.activityId){
this.onGetSeckillGoodsList(res.data.activityId, "seckillGoodsList");
}
}
@@ -882,6 +931,12 @@ export default {
width: 100%;
display: flex;
justify-content: center;
.yp_item_image{
width: 100%;
height: 176rpx;
border-radius: 15rpx;
}
}
.yp_item_info {
@@ -394,6 +394,7 @@ export default {
}
const res = await editAddress(params);
if (res && res.bizcode === 100) {
uni.$emit("refreshAddressList");
this.$refs.uToastRef.show({
type: "success",
message: params.id && params.id !== 0 ? "修改成功" : "添加成功",
@@ -409,19 +409,19 @@ export default {
if (option.sed) {
this.isPoints = 1;
this.sed = JSON.parse(option.sed);
await this.addressList();
// console.log('addressListOne',this.addressListOne)
// if(this.addressListOne && this.addressListOne.length){
// this.addressShow = true;
// }
await this.addressList();
// console.log('addressListOne',this.addressListOne)
// if(this.addressListOne && this.addressListOne.length){
// this.addressShow = true;
// }
this.getOrderTwo();
}
if (option.ids) {
this.ids = option.ids;
this.getOrder();
}
console.log("参数---", option, this.defaultAddress);
const addressShowPop = option.addressShow;
@@ -491,16 +491,16 @@ export default {
},
onCancel() {
if (this.type == "2") {
uni.redirectTo({
url: "/pages/rwa_package/setting/forgot-pass?type=1",
uni.redirectTo({
url: "/pages/rwa_package/forgotPass/forgotPass?type=1",
});
}
this.tipsShow = false;
},
onConfirm() {
if (this.type == "1") {
uni.redirectTo({
url: "/pages/rwa_package/setting/forgot-pass?type=1",
uni.redirectTo({
url: "/pages/rwa_package/forgotPass/forgotPass?type=1",
});
} else {
this.tipsShow = false;
@@ -562,6 +562,14 @@ export default {
this.wayOption = data.filter((item) => item.type !== "vcoin");
this.couponData = data.filter((item) => item.type === "vcoin")[0] || {};
console.log("getWayOption", this.wayOption, this.couponData);
//当前是微信小程序不显示支付宝支付
// #ifdef MP-WEIXIN
this.wayOption = this.wayOption.filter(
(item) => item.type !== "alipay"
);
// #endif
console.log("getWayOption", this.wayOption);
}
},
async getOrder() {
@@ -882,12 +890,33 @@ export default {
}
},
async passPay() {
const params = {
let params = {
addrId: this.orderInfo.address.id, // 收货地址ID
//结算的购物车ID,多个以逗号分割,ALL表示全选
payway: this.orderInfo.paymentMethod, // 支付方式:1-微信,2-支付宝
remark: JSON.stringify(this.getRemark()), //备注信息'[{"sid":"店铺ID","rmk":"备注内容"},{"sid":"店铺ID","rmk":"备注内容"}]'
};
if (params.payway == "wechat") {
// #ifdef MP-WEIXIN
params["payway"] = "wechatMiniProgram";
params["code"] = await new Promise((resolve) => {
uni.login({
provider: "weixin",
onlyAuthorize: true,
success: function (loginRes) {
resolve(loginRes.code);
},
fail: (err) => {
resolve(""); // 登录失败时返回空字符串,避免后续流程中断
},
});
});
// #endif
}
console.log("收货地址ID--params", params);
let resp = null;
console.log("orderInfo----", this.sed);
if (this.sed) {
@@ -926,7 +955,8 @@ export default {
// 提交订单成功,就唤起支付
if (resp && resp.bizcode === 100) {
const item = resp.data;
console.log("提交订单成功", resp.data);
const item = resp.data;
if (item.status === 1) {
jumpWayOk();
return;