Lufaneng 10 months ago
parent 33a9adfbef
commit 26be228f0a

@ -129,12 +129,12 @@
"selectedIconPath": "static/tabbar/order_HL.png",
"text": "订单"
},
{
"pagePath": "pages/consumption/consumption",
"iconPath": "static/tabbar/xiaofei.png",
"selectedIconPath": "static/tabbar/xiaofei_HL.png",
"text": "消费"
},
// {
// "pagePath": "pages/consumption/consumption",
// "iconPath": "static/tabbar/xiaofei.png",
// "selectedIconPath": "static/tabbar/xiaofei_HL.png",
// "text": "消费"
// },
{
"pagePath": "pages/mine/mine",
"iconPath": "static/tabbar/mine.png",

@ -1,7 +1,7 @@
<template>
<view class="container">
<!-- 顶部筛选标签 -->
<uv-sticky bgColor="#fff" offsetTop="0">
<uv-sticky bgColor="#fff" :offsetTop="isWeChatH5 ? -50 : 0">
<div class="tabBox">
<div class="tabItem" :class="{selected:active==='全部'}" @click="switchTab('全部')"></div>
<div class="tabItem" :class="{selected:active==='生成'}" @click="switchTab('生成')"></div>
@ -81,6 +81,13 @@
import RPC from "@/utils/request";
import dayjs from "dayjs";
const isWeChatH5 = ref(false)
// #ifdef H5
if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) {
isWeChatH5.value = true
}
// #endif
const authStore = useAuthStore();
const userStore = useUserStore();

@ -19,7 +19,7 @@
手机号
</div>
<uv-input v-model="userInfo.phone" color="#000" border="bottom"
:placeholderStyle="{ color: '#666778' }" placeholder="请输入用户名"></uv-input>
:placeholderStyle="{ color: '#666778' }" placeholder="请输入手机号"></uv-input>
</uv-form-item>
<uv-form-item prop="password">
<div class="formLabel">
@ -29,7 +29,7 @@
<uv-input v-model="userInfo.password" color="#000" border="bottom"
:placeholderStyle="{ color: '#666778' }" placeholder="请输入验证码">
<template v-slot:suffix>
<uv-code ref="codeRef" @change="codeChange" seconds="20" changeText="X秒重新获取"></uv-code>
<uv-code ref="codeRef" @change="codeChange" seconds="60" changeText="X秒重新获取"></uv-code>
<text style="color: #4d82fd" @click="getCode">{{ tips }}</text>
</template>
</uv-input>
@ -85,9 +85,10 @@
</view>
</view>
</uv-popup>
<a style="display: none;" ref="ToLoginRef" href="weixin://dl/business/?appid=wxc504638e03981812&path=pages/login/login?from=h5ToWechat">
打开小程序并登录
</a>
<!-- <a style="display: none;" ref="ToLoginRef"
href="weixin://dl/business/?appid=wxc504638e03981812&path=pages/login/login?from=h5ToWechat">
打开小程序并登录
</a> -->
</view>
</template>
@ -156,9 +157,17 @@
};
const codeRef = ref(null);
const getCode = () => {
if (!userInfo.phone) {
if (!userInfo.value.phone) {
uni.showToast({
title: "请填写手机号",
title: "请输入手机号",
icon: "none",
});
return;
}
if (!/^1[3-9]\d{9}$/.test(userInfo.value.phone)) {
uni.showToast({
title: "请输入正确的手机号",
icon: "none",
});
return;
@ -168,16 +177,22 @@
uni.showLoading({
title: "正在获取验证码",
});
setTimeout(() => {
uni.hideLoading();
// this.start()
RPC.post('/login/phone/send_code', {
phone: userInfo.value.phone,
}).then(() => {
uni.hideLoading()
uni.showToast({
title: "验证码已发送",
icon: "none",
});
//
codeRef.value.start();
}, 2000);
title: '验证码已发送',
icon: 'success'
})
codeRef.value.start()
}).catch(() => {
uni.hideLoading()
uni.showToast({
title: '发送失败,请重试',
icon: 'none'
})
})
} else {
uni.showToast({
title: "倒计时结束后再发送",
@ -212,9 +227,10 @@
let redirect = HOME_PATH;
onLoad((options) => {
if (options.redirect && removeQueryString(options.redirect) !== LOGIN_PATH) {
if(decodeURIComponent(options.redirect) && decodeURIComponent(options.redirect) != 'undefined')
redirect = decodeURIComponent(options.redirect);
}
if(options.from && options.from === 'h5ToWechat') {
if (options.from && options.from === 'h5ToWechat') {
XcxLogin()
}
});
@ -228,9 +244,9 @@
// #ifdef H5
// H5
const ua = navigator.userAgent.toLowerCase();
const isWechat = ua.indexOf("micromessenger") !== -1;
showWechatLogin.value = isWechat;
// const ua = navigator.userAgent.toLowerCase();
// const isWechat = ua.indexOf("micromessenger") !== -1;
// showWechatLogin.value = isWechat;
// #endif
// #ifdef APP-PLUS
@ -250,18 +266,22 @@
js_code: loginRes.code
}).then(res => {
console.log('phonelogin', res)
authStore.setAccessToken(res.token)
userStore.setUserInfo(res.user)
if(!res.user.phone) {
if (res.user.phone) {
authStore.setAccessToken(res.token)
userStore.setUserInfo(res.user)
uni.showToast({
title: "登录成功",
icon: "success",
});
uni.$uv.route({
type: isTabBarPath(redirect) ? "switchTab" : "redirectTo",
url: redirect,
type: isTabBarPath(redirect || HOME_PATH) ? "switchTab" :
"redirectTo",
url: redirect || HOME_PATH,
});
} else {
accessToken.value = res.token
accessUserInfo.value = res.user
uni.hideLoading()
popup.value.open()
}
}).catch(() => {
@ -324,35 +344,28 @@
uni.showLoading({
title: "正在获取验证码",
});
// API
// RPC.post('/api/sms/send', {
// phone: bindPhoneInfo.value.phone,
// type: 'bind'
// }).then(() => {
// uni.hideLoading()
// uni.showToast({
// title: '',
// icon: 'success'
// })
// bindCodeRef.value.start()
// }).catch(() => {
// uni.hideLoading()
// uni.showToast({
// title: '',
// icon: 'none'
// })
// })
//
setTimeout(() => {
uni.hideLoading();
RPC.post('/user/bind_phone/send_code', {
phone: bindPhoneInfo.value.phone,
token: accessToken.value
}, {
custom: {
customToken: accessToken.value
}
}).then(() => {
uni.hideLoading()
uni.showToast({
title: "验证码已发送",
icon: "success",
});
bindCodeRef.value.start();
}, 1500);
title: '验证码已发送',
icon: 'success'
})
bindCodeRef.value.start()
}).catch(() => {
uni.hideLoading()
uni.showToast({
title: '发送失败,请重试',
icon: 'none'
})
})
} else {
uni.showToast({
title: "倒计时结束后再发送",
@ -399,6 +412,9 @@
// #endif
};
const accessToken = ref('')
const accessUserInfo = ref({})
// H5
const handleWechatH5Callback = async (code) => {
// #ifdef H5
@ -415,18 +431,20 @@
js_code: loginRes.code
}).then(res => {
console.log('phonelogin', res)
authStore.setAccessToken(res.token)
userStore.setUserInfo(res.user)
if(!res.user.phone) {
if (res.user.phone) {
authStore.setAccessToken(res.token)
userStore.setUserInfo(res.user)
uni.showToast({
title: "登录成功",
icon: "success",
});
uni.$uv.route({
type: isTabBarPath(redirect) ? "switchTab" : "redirectTo",
url: redirect,
type: isTabBarPath(redirect || HOME_PATH) ? "switchTab" : "redirectTo",
url: redirect || HOME_PATH,
});
} else {
accessToken.value = res.token
accessUserInfo.value = res.user
popup.value.open()
}
}).catch(() => {
@ -507,35 +525,32 @@
bindingPhone.value = true;
// API
// const result = await RPC.post('/api/wechat/bind-phone', {
// phone: bindPhoneInfo.value.phone,
// code: bindPhoneInfo.value.code,
// wechatCode: wechatLoginCode // code
// })
//
setTimeout(() => {
RPC.post('/user/bind_phone', {
phone: bindPhoneInfo.value.phone,
code: bindPhoneInfo.value.code,
token: accessToken.value
},{
custom: {
customToken: accessToken.value
}
}).then((res) => {
console.log('bind_phone', res)
bindingPhone.value = false;
authStore.setAccessToken(accessToken.value)
userStore.setUserInfo(accessUserInfo.value)
uni.showToast({
title: "绑定成功",
icon: "success",
});
//
authStore.setAccessToken("wechat_access_token");
// userStore.setUserInfo(result.userInfo)
closeBindPhoneModal();
//
setTimeout(() => {
closeBindPhoneModal()
uni.$uv.route({
type: isTabBarPath(redirect) ? "switchTab" : "redirectTo",
url: redirect,
type: isTabBarPath(redirect || HOME_PATH) ? "switchTab" :
"redirectTo",
url: redirect || HOME_PATH,
});
}, 1000);
}, 2000);
}, 500);
})
} catch (error) {
console.error("绑定手机号失败:", error);
bindingPhone.value = false;
@ -571,9 +586,9 @@
// url: redirect,
// });
// })
RPC.post('/login', {
username: userInfo.value.phone,
password: userInfo.value.password,
RPC.post('/login/phone', {
phone: userInfo.value.phone,
code: userInfo.value.password,
}, {
custom: {
loading: true,
@ -588,8 +603,8 @@
.then((res) => {
userStore.setUserInfo(res)
uni.$uv.route({
type: isTabBarPath(redirect) ? "switchTab" : "redirectTo",
url: redirect,
type: isTabBarPath(redirect || HOME_PATH) ? "switchTab" : "redirectTo",
url: redirect || HOME_PATH,
});
})
.finally(() => {

@ -546,6 +546,7 @@
getPlanList()
// getBalance()
getMemberInfo()
uni.stopPullDownRefresh();
});
</script>

@ -1,8 +1,9 @@
<template>
<view class="container">
<uv-sticky bgColor="#fff" offsetTop="0">
<uv-sticky bgColor="#fff" :offsetTop="isWeChatH5 ? -50 : 0">
<div class="tabBox">
<div class="tabItem" :class="{selected:active==='全部'}" @click="switchTab('全部')"></div>
<div class="tabItem" :class="{selected:active==='图纸生成'}" @click="switchTab('图纸生成')"></div>
<div class="tabItem" :class="{selected:active==='会员购买'}" @click="switchTab('会员购买')"></div>
<div class="tabItem" :class="{selected:active==='钱包充值'}" @click="switchTab('钱包充值')"></div>
</div>
@ -53,17 +54,18 @@
<template v-if="order.pay_channel === 'alipay'"></template>
</text>
</view>
<!-- <view class="detail-row" v-if="order.discount > 0">
<!-- <view class="detail-row" v-if="order.discount > 0">
<text class="label">折扣金额:</text>
<text class="value discount">-¥{{ order.discount }}</text>
</view> -->
<!-- <view class="detail-row">
<!-- <view class="detail-row">
<text class="label">实付金额:</text>
<text class="value final-price">¥{{ order.finalAmount }}</text>
</view> -->
<view class="detail-row">
<text class="label">创建时间</text>
<text class="value">{{ order.created_at ? dayjs(order.created_at * 1000).format('YYYY-MM-DD HH:mm:ss') :'' }}</text>
<text
class="value">{{ order.created_at ? dayjs(order.created_at * 1000).format('YYYY-MM-DD HH:mm:ss') :'' }}</text>
</view>
</view>
@ -82,7 +84,7 @@
去支付
</uv-button>
</template>
<!-- <template v-else>
<!-- <template v-else>
<uv-button type="default" size="small" @click="deleteOrder(order)">
删除订单
@ -123,21 +125,28 @@
import RPC from "@/utils/request";
import dayjs from "dayjs";
const isWeChatH5 = ref(false)
// #ifdef H5
if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) {
isWeChatH5.value = true
}
// #endif
const active = ref('全部')
const authStore = useAuthStore()
const userStore = useUserStore()
const copyOrderNo = (orderNo) => {
uni.setClipboardData({
data: orderNo,
success: () => {
uni.showToast({
title: '订单号已复制',
icon: 'success'
})
}
})
uni.setClipboardData({
data: orderNo,
success: () => {
uni.showToast({
title: '订单号已复制',
icon: 'success'
})
}
})
}
const list = ref([{
@ -193,7 +202,7 @@
list.value = []
active.value = tab
page.value = 1
if(tab === '全部') {
if (tab === '全部') {
typeParams.value = ''
} else {
typeParams.value = tab
@ -217,7 +226,9 @@
if (res.confirm) {
try {
// API
await RPC.post('/membership/order/cancel', { order_no: order.order_no })
await RPC.post('/membership/order/cancel', {
order_no: order.order_no
})
//
const index = list.value.findIndex(item => item.id === order.id)
@ -413,7 +424,9 @@
console.log('paymentResult', paymentResult)
} else if (res.cancel) {
console.log('用户点击了取消');
paymentResult = { success: false }
paymentResult = {
success: false
}
}
}
@ -475,16 +488,16 @@
uni.showLoading();
RPC.post('/membership/order/list', {
user_id: userStore.userInfo.id,
page:page.value,
order_type:typeParams.value,
size:20
page: page.value,
order_type: typeParams.value,
size: 20
}).then(res => {
list.value = [...list.value, ...res.list];
count.value = res.total;
if (list.value.length >= count.value) {
loadingStatus.value = "nomore";
loadingStatus.value = "nomore";
} else {
loadingStatus.value = "loadmore";
loadingStatus.value = "loadmore";
}
}).catch(() => {
loadingStatus.value = "loadmore";
@ -498,12 +511,12 @@
})
onReachBottom(() => {
if (list.value.length >= count.value || loadingStatus.value === "loading")
return;
console.log("上拉加载:");
loadingStatus.value = "loading";
page.value = ++page.value;
getList();
if (list.value.length >= count.value || loadingStatus.value === "loading")
return;
console.log("上拉加载:");
loadingStatus.value = "loading";
page.value = ++page.value;
getList();
});
onShow(() => {
@ -543,6 +556,7 @@
}
}
}
.order-list {
padding: 16px;

File diff suppressed because it is too large Load Diff

@ -130,13 +130,14 @@ $uv.http.interceptors.request.use(
// #endif
// config.url = useUserStore().adressIp + '/jsonrpc'
const params = config.data
console.log('config',config)
const customToken = config.custom.customToken
config.data = {
id: guid(),
jsonrpc: '2.0',
method,
params,
session: useAuthStore().accessToken,
// session:'8ef0a67e75d4ebbcbc5bc897024ea160',
session:customToken || useAuthStore().accessToken,
timestampin: Date.now().toString()
}

Loading…
Cancel
Save