feat: ✨ 优化在微信小程序中接口返回的错误信息 会被uni.hideLoading取消展示错误信息问题
parent
c070ed01f7
commit
2bdb8682e1
|
@ -98,7 +98,7 @@
|
|||
}) : "",
|
||||
getAllCoupons(submitData)
|
||||
.then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 200) {
|
||||
// 如果请求成功,展示数据并进行展示
|
||||
|
@ -113,7 +113,7 @@
|
|||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
|
|
@ -217,7 +217,7 @@ export default {
|
|||
this.navList[index].dataList.push(...data);
|
||||
}
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@
|
|||
// 初始化支付签名
|
||||
await API_Trade.initiatePay(paymentMethod, paymentClient, params).then(
|
||||
(signXml) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
//如果支付异常
|
||||
if (!signXml.data.success) {
|
||||
uni.showToast({
|
||||
|
@ -334,7 +334,7 @@
|
|||
}
|
||||
}
|
||||
);
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
} else {
|
||||
window.location.href = JSON.parse(response.result).h5_url;
|
||||
const searchParams = {
|
||||
|
@ -352,7 +352,7 @@
|
|||
})
|
||||
},3000)
|
||||
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
}
|
||||
} else if (paymentMethod === "WALLET") {
|
||||
uni.showToast({
|
||||
|
|
|
@ -204,7 +204,7 @@ export default {
|
|||
this.goodsDetail = response.data.result.data;
|
||||
this.selectedGoods = response.data.result.data;
|
||||
this.goodsSpec = response.data.result.specs;
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
this.PromotionList = response.data.result.promotionMap;
|
||||
|
||||
// 判断是否拼团活动 如果有则显示拼团活动信息
|
||||
|
|
|
@ -133,7 +133,7 @@ export default {
|
|||
this.form.consigneeAddressPath = val.data.result.name; //地址名称, ','分割
|
||||
this.form.lat = val.latitude; //纬度
|
||||
this.form.lon = val.longitude; //经度
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
}
|
||||
|
||||
this.mapFlag = !this.mapFlag; //关闭地图
|
||||
|
@ -276,10 +276,10 @@ export default {
|
|||
params.___path = params.consigneeAddressPath;
|
||||
this.$set(this, "form", params);
|
||||
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
},
|
||||
// 初始化rules必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
|
|
|
@ -101,7 +101,7 @@ export default {
|
|||
this.addressList = res.data.result.records;
|
||||
console.log(this.addressList);
|
||||
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
//删除地址
|
||||
|
|
|
@ -103,7 +103,7 @@ export default {
|
|||
});
|
||||
this.addressList = res.data.result.records;
|
||||
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
//删除地址
|
||||
|
|
|
@ -76,7 +76,7 @@ export default {
|
|||
this.storeAddressList = res.data.result.records;
|
||||
console.log(this.storeAddressList);
|
||||
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -96,7 +96,7 @@ export default {
|
|||
this.status = "nomore";
|
||||
this.empty = true;
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
// 初始化提现历史
|
||||
|
@ -111,7 +111,7 @@ export default {
|
|||
this.status = "nomore";
|
||||
this.empty = true;
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -78,7 +78,7 @@ export default {
|
|||
if (res.data.result) {
|
||||
this.distributionData = res.data.result;
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -75,7 +75,7 @@ export default {
|
|||
if (res.data.result) {
|
||||
this.distributionData = res.data.result;
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -110,7 +110,7 @@ export default {
|
|||
title: "加载中",
|
||||
});
|
||||
getTalkList(params).then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
if (res.data.success) {
|
||||
this.talkList = res.data.result;
|
||||
console.log(this.talkList, 'this.talkListthis.talkList');
|
||||
|
|
|
@ -58,7 +58,7 @@ export default {
|
|||
title:"加载中"
|
||||
})
|
||||
API_Message.getLogisticsMessages(this.params).then(async response => {
|
||||
uni.hideLoading()
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() }
|
||||
const { data } = response
|
||||
if (!data || !data.length) {
|
||||
this.messageList.push(...data.data)
|
||||
|
|
|
@ -59,7 +59,7 @@ export default {
|
|||
title: "加载中"
|
||||
});
|
||||
API_Message.getMessages(this.params).then(async response => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
const { data } = response;
|
||||
if (!data || !data.length) {
|
||||
this.messageList.push(...data.data);
|
||||
|
|
|
@ -197,7 +197,7 @@
|
|||
title: "加载中",
|
||||
});
|
||||
getGoodsCollection(this.navList[0].params, "GOODS").then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.success) {
|
||||
let data = res.data.result;
|
||||
|
@ -225,7 +225,7 @@
|
|||
title: "加载中",
|
||||
});
|
||||
getGoodsCollection(this.navList[1].params, "store").then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.success) {
|
||||
let data = res.data.result;
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
});
|
||||
myTrackList(this.params).then((res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
if (res.statusCode == 200) {
|
||||
res.data.result.records.length &&
|
||||
res.data.result.records.forEach((item) => {
|
||||
|
|
|
@ -72,7 +72,7 @@ export default {
|
|||
title: "加载中",
|
||||
});
|
||||
getPointsData(params).then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
if (res.data.success) {
|
||||
let data = res.data.result.records;
|
||||
if (data.length < 10) {
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
title: "正在获取验证码",
|
||||
});
|
||||
sendMobile(this.codeForm.mobile, "FIND_USER").then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
// 这里此提示会被this.start()方法中的提示覆盖
|
||||
if (res.data.success) {
|
||||
this.$refs.uCode.start();
|
||||
|
|
|
@ -636,7 +636,7 @@ export default {
|
|||
this.goodsList.push(...goodsList.data.result.records);
|
||||
|
||||
this.initSortGoods();
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
},
|
||||
|
||||
//高亮关键字
|
||||
|
|
|
@ -309,7 +309,7 @@ export default {
|
|||
mask: true,
|
||||
});
|
||||
getOrderList(this.params).then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
const orderList = res.data.result.records;
|
||||
if (orderList.length > 0) {
|
||||
this.orderList = this.orderList.concat(orderList);
|
||||
|
@ -345,7 +345,7 @@ export default {
|
|||
this.orderList = [];
|
||||
this.searchOrderList(this.current);
|
||||
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -224,7 +224,7 @@ export default {
|
|||
this.reasonList = action;
|
||||
}
|
||||
});
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
},
|
||||
//打开地区选择器
|
||||
showCitySelect() {
|
||||
|
@ -288,7 +288,7 @@ export default {
|
|||
this.form.applyRefundPrice = this.applyInfo.applyRefundPrice;
|
||||
|
||||
applyReturn(this.sn, this.form).then((resp) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
if (resp.data.success) {
|
||||
this.$refs.uToast.show({ title: "提交成功", type: "success" });
|
||||
uni.redirectTo({
|
||||
|
|
|
@ -128,7 +128,7 @@ export default {
|
|||
});
|
||||
delete this.form.courierCompany;
|
||||
fillShipInfo(this.serviceDetail.sn, this.form).then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
if (res.statusCode === 200) {
|
||||
this.$refs.uToast.show({
|
||||
title: "提交成功",
|
||||
|
|
|
@ -352,7 +352,7 @@ export default {
|
|||
title: "加载中",
|
||||
});
|
||||
getServiceDetail(this.sn).then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
this.serviceDetail = res.data.result;
|
||||
if (
|
||||
this.serviceDetail.serviceType == "RETURN_GOODS" ||
|
||||
|
|
|
@ -178,7 +178,7 @@ export default {
|
|||
this.order = order.order;
|
||||
this.orderGoodsList = order.orderItems;
|
||||
this.orderDetail = res.data.result;
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ export default {
|
|||
icon: "none",
|
||||
});
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -140,7 +140,7 @@ export default {
|
|||
} else {
|
||||
this.empty = true;
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
},
|
||||
|
|
|
@ -202,7 +202,7 @@ export default {
|
|||
title: "加载中",
|
||||
});
|
||||
getOrderList(this.params).then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
const orderList = res.data.result.records;
|
||||
if (orderList.length < 10) {
|
||||
this.params.loadStatus = "noMore";
|
||||
|
@ -234,7 +234,7 @@ export default {
|
|||
title: "加载中",
|
||||
});
|
||||
getComments(this.params).then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
let orderList = res.data.result.records;
|
||||
if (orderList.length < 10) {
|
||||
this.params.loadStatus = "noMore";
|
||||
|
|
|
@ -137,7 +137,7 @@ export default {
|
|||
title: "加载中",
|
||||
});
|
||||
commentsMemberOrder(this.form).then((res) => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
if (res.data.success) {
|
||||
uni.showToast({
|
||||
title: "发布评价成功",
|
||||
|
|
|
@ -373,7 +373,7 @@ export default {
|
|||
});
|
||||
await this.getOrderList();
|
||||
await this.getDistribution();
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
if (this.routerVal.way == "PINTUAN") {
|
||||
this.isAssemble = true;
|
||||
this.routerVal.parentOrder = JSON.parse(
|
||||
|
|
|
@ -392,7 +392,7 @@ export default {
|
|||
if (res.data.result.length >= 1) {
|
||||
this.cancelList = res.data.result;
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -473,7 +473,7 @@ export default {
|
|||
});
|
||||
setTimeout(() => {
|
||||
this.navList[this.tabCurrentIndex].orderList.splice(index, 1);
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
}, 600);
|
||||
},
|
||||
//取消订单
|
||||
|
@ -493,7 +493,7 @@ export default {
|
|||
let list = this.navList[1].orderList;
|
||||
let index = list.findIndex((val) => val.id === item.id);
|
||||
index !== -1 && list.splice(index, 1);
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
}, 600);
|
||||
},
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ export default {
|
|||
if (this.order.deliveryMethod === 'LOGISTICS') {
|
||||
this.loadLogistics(sn)
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
|
||||
},
|
||||
|
@ -413,7 +413,7 @@ export default {
|
|||
});
|
||||
setTimeout(() => {
|
||||
this.navList[this.tabCurrentIndex].orderList.splice(index, 1);
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
}, 600);
|
||||
},
|
||||
//取消订单
|
||||
|
@ -427,7 +427,7 @@ export default {
|
|||
if (res.data.result.length >= 1) {
|
||||
this.cancelList = res.data.result;
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
|
||||
this.cancelShow = true;
|
||||
|
|
|
@ -321,7 +321,7 @@
|
|||
// 向后端请求验证码
|
||||
uni.showLoading({});
|
||||
let res = await sendMobile(this.mobile);
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
// 这里此提示会被this.start()方法中的提示覆盖
|
||||
if (res.data.success) {
|
||||
this.current = 1;
|
||||
|
@ -708,7 +708,7 @@
|
|||
clearInterval(timer);
|
||||
}, 100);
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
}
|
||||
if (!this.flage) {
|
||||
this.$refs.verification.error(); //发送
|
||||
|
|
|
@ -70,7 +70,7 @@ export default {
|
|||
title: "请填写内容!",
|
||||
icon: "none",
|
||||
});
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
return false;
|
||||
}
|
||||
API_MEM.consultating(
|
||||
|
@ -86,11 +86,11 @@ export default {
|
|||
});
|
||||
this.askValue = "";
|
||||
}
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
});
|
||||
},
|
||||
radioGroupChange(e) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="wrapper">
|
||||
<!-- 空白页-->
|
||||
<view v-if="cartDetail.cartList == '' || cartDetail.cartList == [] || !cartDetail" class="empty">
|
||||
<view v-if="!loading && (cartDetail.cartList == '' || cartDetail.cartList == [] || !cartDetail)" class="empty">
|
||||
<image src="/static/emptyCart.png" mode="aspectFit"></image>
|
||||
<view class="empty-tips">
|
||||
空空如也
|
||||
|
@ -184,6 +184,7 @@ import { debounce } from "@/utils/tools.js";
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading:false,
|
||||
lightColor: this.$lightColor,
|
||||
discountDetailsFlag: false, //优惠明细开关
|
||||
// 商品栏右侧滑动按钮
|
||||
|
@ -508,6 +509,7 @@ export default {
|
|||
});
|
||||
API_Trade.getCarts()
|
||||
.then((result) => {
|
||||
this.loading = false;
|
||||
uni.stopPullDownRefresh();
|
||||
if (result.data.success) {
|
||||
this.cartDetail = result.data.result;
|
||||
|
@ -541,10 +543,10 @@ export default {
|
|||
uni.stopPullDownRefresh();
|
||||
}
|
||||
})
|
||||
.catch((err) => {});
|
||||
uni.hideLoading();
|
||||
.catch((err) => {this.loading = false;});
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
})
|
||||
this.params.keyword = this.goods.goodsName;
|
||||
getGoodsList(this.params).then(res => {
|
||||
uni.hideLoading()
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() }
|
||||
if (res.statusCode == 200) {
|
||||
let data = res.data;
|
||||
if (data.data_total == 0) {
|
||||
|
|
|
@ -6,6 +6,7 @@ Vue.use(Vuex);
|
|||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
isShowToast:false, // 是否在展示Toast中
|
||||
shareLink:"", //分享链接
|
||||
verificationKey: "", //获取key表示验证通过
|
||||
distributionId:"", //分销员Id 如果当前账户从未登录过时记录
|
||||
|
|
|
@ -11,7 +11,7 @@ import api from "@/config/api.js";
|
|||
|
||||
import uuid from "@/utils/uuid.modified.js";
|
||||
import jwt from '@/js_sdk/t-jwt/jwt.js'
|
||||
|
||||
import store from "../store";
|
||||
|
||||
|
||||
let isNavigateTo = false
|
||||
|
@ -131,7 +131,7 @@ http.interceptors.response.use(
|
|||
// cleanStorage();
|
||||
// isRefreshing = false;
|
||||
// }
|
||||
|
||||
uni.showLoading() ? uni.hideLoading() : ''
|
||||
let token = storage.getAccessToken();
|
||||
if (
|
||||
(token && response.statusCode === 403) ||
|
||||
|
@ -196,6 +196,15 @@ http.interceptors.response.use(
|
|||
title: response.data.message,
|
||||
icon: "none",
|
||||
duration: 1500,
|
||||
success: function () {
|
||||
store.state.isShowToast = true;
|
||||
},
|
||||
fail: function () {
|
||||
store.state.isShowToast = false;
|
||||
},
|
||||
complete: function () {
|
||||
store.state.isShowToast = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -417,7 +417,7 @@ export default {
|
|||
this.uploadError(index, e);
|
||||
},
|
||||
complete: res => {
|
||||
uni.hideLoading();
|
||||
if (this.$store.state.isShowToast){ uni.hideLoading() };
|
||||
this.uploading = false;
|
||||
this.uploadFile(index + 1);
|
||||
this.$emit('on-change', res, index, this.lists);
|
||||
|
|
Loading…
Reference in New Issue