Lufaneng 10 months ago
parent 33a9adfbef
commit 26be228f0a

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

@ -1,7 +1,7 @@
<template> <template>
<view class="container"> <view class="container">
<!-- 顶部筛选标签 --> <!-- 顶部筛选标签 -->
<uv-sticky bgColor="#fff" offsetTop="0"> <uv-sticky bgColor="#fff" :offsetTop="isWeChatH5 ? -50 : 0">
<div class="tabBox"> <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>
@ -79,7 +79,14 @@
} from "@/store"; } from "@/store";
import HeaderCustom from "/components/HeaderCustom/HeaderCustom.vue"; import HeaderCustom from "/components/HeaderCustom/HeaderCustom.vue";
import RPC from "@/utils/request"; import RPC from "@/utils/request";
import dayjs from "dayjs"; 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 authStore = useAuthStore();
const userStore = useUserStore(); const userStore = useUserStore();

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

@ -545,7 +545,8 @@
onPullDownRefresh(() => { onPullDownRefresh(() => {
getPlanList() getPlanList()
// getBalance() // getBalance()
getMemberInfo() getMemberInfo()
uni.stopPullDownRefresh();
}); });
</script> </script>

@ -1,8 +1,9 @@
<template> <template>
<view class="container"> <view class="container">
<uv-sticky bgColor="#fff" offsetTop="0"> <uv-sticky bgColor="#fff" :offsetTop="isWeChatH5 ? -50 : 0">
<div class="tabBox"> <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 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> </div>
@ -53,17 +54,18 @@
<template v-if="order.pay_channel === 'alipay'"></template> <template v-if="order.pay_channel === 'alipay'"></template>
</text> </text>
</view> </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="label">折扣金额:</text>
<text class="value discount">-¥{{ order.discount }}</text> <text class="value discount">-¥{{ order.discount }}</text>
</view> --> </view> -->
<!-- <view class="detail-row"> <!-- <view class="detail-row">
<text class="label">实付金额:</text> <text class="label">实付金额:</text>
<text class="value final-price">¥{{ order.finalAmount }}</text> <text class="value final-price">¥{{ order.finalAmount }}</text>
</view> --> </view> -->
<view class="detail-row"> <view class="detail-row">
<text class="label">创建时间</text> <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>
</view> </view>
@ -82,7 +84,7 @@
去支付 去支付
</uv-button> </uv-button>
</template> </template>
<!-- <template v-else> <!-- <template v-else>
<uv-button type="default" size="small" @click="deleteOrder(order)"> <uv-button type="default" size="small" @click="deleteOrder(order)">
删除订单 删除订单
@ -122,22 +124,29 @@
import HeaderCustom from '/components/HeaderCustom/HeaderCustom.vue' import HeaderCustom from '/components/HeaderCustom/HeaderCustom.vue'
import RPC from "@/utils/request"; import RPC from "@/utils/request";
import dayjs from "dayjs"; 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 active = ref('全部')
const authStore = useAuthStore() const authStore = useAuthStore()
const userStore = useUserStore() const userStore = useUserStore()
const copyOrderNo = (orderNo) => { const copyOrderNo = (orderNo) => {
uni.setClipboardData({ uni.setClipboardData({
data: orderNo, data: orderNo,
success: () => { success: () => {
uni.showToast({ uni.showToast({
title: '订单号已复制', title: '订单号已复制',
icon: 'success' icon: 'success'
}) })
} }
}) })
} }
const list = ref([{ const list = ref([{
@ -193,7 +202,7 @@
list.value = [] list.value = []
active.value = tab active.value = tab
page.value = 1 page.value = 1
if(tab === '全部') { if (tab === '全部') {
typeParams.value = '' typeParams.value = ''
} else { } else {
typeParams.value = tab typeParams.value = tab
@ -217,7 +226,9 @@
if (res.confirm) { if (res.confirm) {
try { try {
// API // 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) const index = list.value.findIndex(item => item.id === order.id)
@ -377,7 +388,7 @@
// //
let paymentResult; let paymentResult;
if (order.pay_channel === "wxpay") { if (order.pay_channel === "wxpay") {
const res = await uni.login({ const res = await uni.login({
provider: 'weixin' provider: 'weixin'
@ -413,13 +424,15 @@
console.log('paymentResult', paymentResult) console.log('paymentResult', paymentResult)
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击了取消'); console.log('用户点击了取消');
paymentResult = { success: false } paymentResult = {
success: false
}
} }
} }
uni.hideLoading(); uni.hideLoading();
console.log('paymentResult', paymentResult) console.log('paymentResult', paymentResult)
// //
if (paymentResult?.success) { if (paymentResult?.success) {
if (paymentResult.redirect) { if (paymentResult.redirect) {
@ -466,7 +479,7 @@
}); });
} }
} }
const page = ref(1) const page = ref(1)
const typeParams = ref('') const typeParams = ref('')
const loadingStatus = ref('loadmore') const loadingStatus = ref('loadmore')
@ -475,16 +488,16 @@
uni.showLoading(); uni.showLoading();
RPC.post('/membership/order/list', { RPC.post('/membership/order/list', {
user_id: userStore.userInfo.id, user_id: userStore.userInfo.id,
page:page.value, page: page.value,
order_type:typeParams.value, order_type: typeParams.value,
size:20 size: 20
}).then(res => { }).then(res => {
list.value = [...list.value, ...res.list]; list.value = [...list.value, ...res.list];
count.value = res.total; count.value = res.total;
if (list.value.length >= count.value) { if (list.value.length >= count.value) {
loadingStatus.value = "nomore"; loadingStatus.value = "nomore";
} else { } else {
loadingStatus.value = "loadmore"; loadingStatus.value = "loadmore";
} }
}).catch(() => { }).catch(() => {
loadingStatus.value = "loadmore"; loadingStatus.value = "loadmore";
@ -494,16 +507,16 @@
} }
onMounted(() => { onMounted(() => {
}) })
onReachBottom(() => { onReachBottom(() => {
if (list.value.length >= count.value || loadingStatus.value === "loading") if (list.value.length >= count.value || loadingStatus.value === "loading")
return; return;
console.log("上拉加载:"); console.log("上拉加载:");
loadingStatus.value = "loading"; loadingStatus.value = "loading";
page.value = ++page.value; page.value = ++page.value;
getList(); getList();
}); });
onShow(() => { onShow(() => {
@ -523,12 +536,12 @@
padding-bottom: 50px; padding-bottom: 50px;
background-color: #f8f8f8; background-color: #f8f8f8;
} }
.tabBox { .tabBox {
height: 50px; height: 50px;
background-color: #fff; background-color: #fff;
display: flex; display: flex;
.tabItem { .tabItem {
height: 100%; height: 100%;
font-weight: 600; font-weight: 600;
@ -536,13 +549,14 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex: 1; flex: 1;
&.selected { &.selected {
color: #5479ED; color: #5479ED;
border-bottom: 1px solid #5479ED; border-bottom: 1px solid #5479ED;
} }
} }
} }
.order-list { .order-list {
padding: 16px; padding: 16px;

File diff suppressed because it is too large Load Diff

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

Loading…
Cancel
Save