刘翔宇-旅管家 3 years ago
parent 73c1ac919e
commit 70ec63f416

@ -650,21 +650,31 @@
}
},
utilFail: res => {
console.log(res)
uni.showToast({
title: res,
duration: 5000
})
console.log(res);
}
})
}
},
utilFail: r => {
uni.showToast({
title: r,
duration: 5000
uni.showModal({
title: '',
content: r,
showCancel: false,
success() {
if (r == "重复购买") {
uni.redirectTo({
url: "../../../packageOrder/pages/myOrder/myOrder"
})
console.log(r);
}
}
});
}
})

@ -19,13 +19,14 @@ const formatTime = date => {
// 其他更多是格式化有如下:
// yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd') {try {
function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd') {
try {
// 如果为null,则格式化当前时间
if (!dateTime) dateTime = Number(new Date());
// 如果dateTime长度为10或者13则为秒和毫秒的时间戳如果超过13位则为其他的时间格式
if (dateTime.toString().length == 10) dateTime *= 1000;
if (dateTime.toString().indexOf("-")>-1) dateTime= dateTime.replace(/-/g,'/')
if (dateTime.toString().indexOf("-") > -1) dateTime = dateTime.replace(/-/g, '/')
let date = new Date(dateTime);
let ret;
@ -45,7 +46,7 @@ function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd') {try {
};
};
return fmt;
}catch(e){
} catch (e) {
console.log(e)
}
}
@ -135,6 +136,7 @@ const request = options => {
uni.request({
...options,
success: function(res) {
uni.hideLoading();
if (res.statusCode != 200) {
if (options.utilFail != undefined) {
if (res.statusCode == 401) {
@ -160,11 +162,14 @@ const request = options => {
}
}
},
fail: options.utilFail,
fail: function(res) {
uni.hideLoading();
options.utilFail(res);
},
complete: function(res) {
if (!options.customLoading) {
uni.hideNavigationBarLoading();
uni.hideLoading();
} else {
// 当前页面请求数量-1
if (options.bindThis) {
@ -265,7 +270,7 @@ const payOrder = (orderID, orderType, success, fail) => {
const getRegions = () => {
request({
api: 'api/get-regions',
customLoading:true,
customLoading: true,
utilSuccess: function(res) {
var r = res[0];
r.latitude = 31.53908730560652; //res.latitude;31.536744,120.40841
@ -357,16 +362,16 @@ const getfile = (id, success, fail) => {
const openid_info_key = "openid_info"
const user_info_key = 'user_info_key'
const solgn="无锡新吴欢迎您";
const solgn = "无锡新吴欢迎您";
const shareInfo=(type)=>{
const shareInfo = (type) => {
return {
title:solgn
title: solgn
}
}
const getOpenidInfo= (cb, refresh) => {
const getOpenidInfo = (cb, refresh) => {
cb = cb || function() {}
refresh = refresh || false
if (!refresh) {
@ -395,9 +400,9 @@ const getOpenidInfo= (cb, refresh) => {
});
}
});
}
}
const getUserProfile=(cb) => {
const getUserProfile = (cb) => {
cb = cb || function() {}
wx.getUserProfile({
@ -407,11 +412,11 @@ const getOpenidInfo= (cb, refresh) => {
cb(res.userInfo)
}
})
}
}
const getUserInfoCache= () => {
const getUserInfoCache = () => {
return uni.getStorageSync(user_info_key)
}
}
//获取订单详情
@ -792,9 +797,9 @@ module.exports = {
getOrderItemInfo: getOrderItemInfo,
stateArr: stateArr,
getRegions: getRegions,
getOpenidInfo:getOpenidInfo,
getUserProfile:getUserProfile,
getUserInfoCache:getUserInfoCache,
timeFormat:timeFormat,
shareInfo:shareInfo
getOpenidInfo: getOpenidInfo,
getUserProfile: getUserProfile,
getUserInfoCache: getUserInfoCache,
timeFormat: timeFormat,
shareInfo: shareInfo
};

Loading…
Cancel
Save