feat:修复地址
This commit is contained in:
+68
-13
@@ -1,15 +1,15 @@
|
|||||||
<template>
|
<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_content_z_warp">
|
||||||
<view class="home_header_warp">
|
<view class="home_header_warp" :style="mpHeaderWarpStyle">
|
||||||
<view class="header_title_warp">
|
<view class="header_title_warp" :style="mpHeaderStyle">
|
||||||
<view class="language_warp" style="width: 100%; justify-content: flex-start" @click="jumpSearch">
|
<view class="language_warp" :style="mpLanguageStyle" style="width: 100%; justify-content: flex-start;" @click="jumpSearch">
|
||||||
<view style="margin-top: 10rpx">
|
<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"
|
<up-image src="https://static.tbmall.xin/static/home/search_b.png" width="20" height="20"
|
||||||
bgColor="#f1f6ff00"></up-image>
|
bgColor="#f1f6ff00"></up-image>
|
||||||
</view>
|
</view>
|
||||||
<text class="search_msg_warp">搜索</text>
|
<text class="search_msg_warp" :style="isMP ? 'line-height: 1;' : ''">搜索</text>
|
||||||
</view>
|
</view>
|
||||||
<image src="https://static.tbmall.xin/static/chart.png" class="chart_img" @click.stop="jumpNewSearch('list')">
|
<image src="https://static.tbmall.xin/static/chart.png" class="chart_img" @click.stop="jumpNewSearch('list')">
|
||||||
</image>
|
</image>
|
||||||
@@ -62,8 +62,10 @@
|
|||||||
<!-- <up-loading-icon :show="productLoading"></up-loading-icon> -->
|
<!-- <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" v-for="item in faddishProduct" :key="item.id" @click.stop="jumpInfo(item)">
|
||||||
<view class="yp_item_image_wrapper">
|
<view class="yp_item_image_wrapper">
|
||||||
<up-image :src="item.url" width="100%" height="88" bgColor="#f1f6ff00" shape="square"
|
<image :src="item.url" mode="aspectFill" class="yp_item_image" shape="square"
|
||||||
radius="15"></up-image>
|
radius="15"></image>
|
||||||
|
<!-- <up-image :src="item.url" width="100%" height="88" bgColor="#f1f6ff00" shape="square"
|
||||||
|
radius="15"></up-image> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="yp_item_info">
|
<view class="yp_item_info">
|
||||||
<view class="yp_item_name">{{ item.title }}</view>
|
<view class="yp_item_name">{{ item.title }}</view>
|
||||||
@@ -279,7 +281,11 @@ export default {
|
|||||||
], // 首页活动列表
|
], // 首页活动列表
|
||||||
activedTabId: "seckill", // 当前选中的活动类型
|
activedTabId: "seckill", // 当前选中的活动类型
|
||||||
attributes: {},
|
attributes: {},
|
||||||
seckillActivedType: 'seckill'
|
seckillActivedType: 'seckill',
|
||||||
|
isMP: false,
|
||||||
|
mpHeaderWarpStyle: {},
|
||||||
|
mpHeaderStyle: {},
|
||||||
|
mpLanguageStyle: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
@@ -315,13 +321,56 @@ export default {
|
|||||||
uni.hideTabBar({
|
uni.hideTabBar({
|
||||||
animation: false,
|
animation: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
/*#endif*/
|
/*#endif*/
|
||||||
// 不需要启动页,才渲染首页
|
|
||||||
this.pageReady = true;
|
// #ifdef MP
|
||||||
|
this.isMP = true;
|
||||||
|
this.initMPHeader();
|
||||||
|
// #endif
|
||||||
},
|
},
|
||||||
mounted() { },
|
mounted() { },
|
||||||
methods: {
|
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) {
|
jumpTab(item, type) {
|
||||||
if (this.activedTabId === type) return;
|
if (this.activedTabId === type) return;
|
||||||
@@ -339,7 +388,7 @@ export default {
|
|||||||
console.log("获取秒杀", res);
|
console.log("获取秒杀", res);
|
||||||
if (res.bizcode === 100) {
|
if (res.bizcode === 100) {
|
||||||
this.seckillGoodsList = [];
|
this.seckillGoodsList = [];
|
||||||
if(res.data.activityId){
|
if(res.data?.activityId){
|
||||||
this.onGetSeckillGoodsList(res.data.activityId, "seckillGoodsList");
|
this.onGetSeckillGoodsList(res.data.activityId, "seckillGoodsList");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -882,6 +931,12 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
.yp_item_image{
|
||||||
|
width: 100%;
|
||||||
|
height: 176rpx;
|
||||||
|
border-radius: 15rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.yp_item_info {
|
.yp_item_info {
|
||||||
|
|||||||
@@ -394,6 +394,7 @@ export default {
|
|||||||
}
|
}
|
||||||
const res = await editAddress(params);
|
const res = await editAddress(params);
|
||||||
if (res && res.bizcode === 100) {
|
if (res && res.bizcode === 100) {
|
||||||
|
uni.$emit("refreshAddressList");
|
||||||
this.$refs.uToastRef.show({
|
this.$refs.uToastRef.show({
|
||||||
type: "success",
|
type: "success",
|
||||||
message: params.id && params.id !== 0 ? "修改成功" : "添加成功",
|
message: params.id && params.id !== 0 ? "修改成功" : "添加成功",
|
||||||
|
|||||||
@@ -409,19 +409,19 @@ export default {
|
|||||||
if (option.sed) {
|
if (option.sed) {
|
||||||
this.isPoints = 1;
|
this.isPoints = 1;
|
||||||
this.sed = JSON.parse(option.sed);
|
this.sed = JSON.parse(option.sed);
|
||||||
await this.addressList();
|
await this.addressList();
|
||||||
// console.log('addressListOne',this.addressListOne)
|
// console.log('addressListOne',this.addressListOne)
|
||||||
// if(this.addressListOne && this.addressListOne.length){
|
// if(this.addressListOne && this.addressListOne.length){
|
||||||
// this.addressShow = true;
|
// this.addressShow = true;
|
||||||
// }
|
// }
|
||||||
this.getOrderTwo();
|
this.getOrderTwo();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option.ids) {
|
if (option.ids) {
|
||||||
this.ids = option.ids;
|
this.ids = option.ids;
|
||||||
this.getOrder();
|
this.getOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("参数---", option, this.defaultAddress);
|
console.log("参数---", option, this.defaultAddress);
|
||||||
|
|
||||||
const addressShowPop = option.addressShow;
|
const addressShowPop = option.addressShow;
|
||||||
@@ -491,16 +491,16 @@ export default {
|
|||||||
},
|
},
|
||||||
onCancel() {
|
onCancel() {
|
||||||
if (this.type == "2") {
|
if (this.type == "2") {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: "/pages/rwa_package/setting/forgot-pass?type=1",
|
url: "/pages/rwa_package/forgotPass/forgotPass?type=1",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.tipsShow = false;
|
this.tipsShow = false;
|
||||||
},
|
},
|
||||||
onConfirm() {
|
onConfirm() {
|
||||||
if (this.type == "1") {
|
if (this.type == "1") {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: "/pages/rwa_package/setting/forgot-pass?type=1",
|
url: "/pages/rwa_package/forgotPass/forgotPass?type=1",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.tipsShow = false;
|
this.tipsShow = false;
|
||||||
@@ -562,6 +562,14 @@ export default {
|
|||||||
this.wayOption = data.filter((item) => item.type !== "vcoin");
|
this.wayOption = data.filter((item) => item.type !== "vcoin");
|
||||||
this.couponData = data.filter((item) => item.type === "vcoin")[0] || {};
|
this.couponData = data.filter((item) => item.type === "vcoin")[0] || {};
|
||||||
console.log("getWayOption", this.wayOption, this.couponData);
|
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() {
|
async getOrder() {
|
||||||
@@ -882,12 +890,33 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async passPay() {
|
async passPay() {
|
||||||
const params = {
|
let params = {
|
||||||
addrId: this.orderInfo.address.id, // 收货地址ID
|
addrId: this.orderInfo.address.id, // 收货地址ID
|
||||||
//结算的购物车ID,多个以逗号分割,ALL表示全选
|
//结算的购物车ID,多个以逗号分割,ALL表示全选
|
||||||
payway: this.orderInfo.paymentMethod, // 支付方式:1-微信,2-支付宝
|
payway: this.orderInfo.paymentMethod, // 支付方式:1-微信,2-支付宝
|
||||||
remark: JSON.stringify(this.getRemark()), //备注信息'[{"sid":"店铺ID","rmk":"备注内容"},{"sid":"店铺ID","rmk":"备注内容"}]'
|
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;
|
let resp = null;
|
||||||
console.log("orderInfo----", this.sed);
|
console.log("orderInfo----", this.sed);
|
||||||
if (this.sed) {
|
if (this.sed) {
|
||||||
@@ -926,7 +955,8 @@ export default {
|
|||||||
|
|
||||||
// 提交订单成功,就唤起支付
|
// 提交订单成功,就唤起支付
|
||||||
if (resp && resp.bizcode === 100) {
|
if (resp && resp.bizcode === 100) {
|
||||||
const item = resp.data;
|
console.log("提交订单成功", resp.data);
|
||||||
|
const item = resp.data;
|
||||||
if (item.status === 1) {
|
if (item.status === 1) {
|
||||||
jumpWayOk();
|
jumpWayOk();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user