This commit is contained in:
2025-12-19 15:18:37 +08:00
3 changed files with 659 additions and 671 deletions

9
.gitignore vendored
View File

@@ -3,3 +3,12 @@
node_modules/ node_modules/
.vscode/ .vscode/
.hbuilderx/ .hbuilderx/
/.idea/inspectionProfiles/Project_Default.xml
/.idea/.gitignore
/.idea/cashier_wx.iml
/.idea/jsLibraryMappings.xml
/.idea/misc.xml
/.idea/modules.xml
/.idea/uniappSupport.xml
/.idea/UniappTool.xml
/.idea/vcs.xml

View File

@@ -31,6 +31,14 @@ export const APIuser = (data) => {
}) })
} }
export const updateUserInfoReq = (data) => {
return request({
url: url + '/user',
method: 'put',
data: data
})
}
//获取手机号 //获取手机号
export const APIuserphone = (data) => { export const APIuserphone = (data) => {
return request({ return request({

View File

@@ -1,52 +1,38 @@
<template> <template>
<view class="container"> <view class="container">
<image <image class="topBack" :src="
class="topBack"
:src="
userInfo.shopExtendList userInfo.shopExtendList
? userInfo.shopExtendList[1].value ? userInfo.shopExtendList[1].value
? userInfo.shopExtendList[1].value ? userInfo.shopExtendList[1].value
: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png' : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'
: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png' : 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'
" " mode="aspectFill"></image>
mode="aspectFill"
></image>
<view class="myContent"> <view class="myContent">
<view class="my_info flex-between"> <view class="my_info flex-between">
<view class="my_info_left"> <view class="my_info_left">
<image <!-- #ifdef MP-WEIXIN -->
class="my_info_left_head" <button class="atatar-btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
:src="userInfo.headImg" <image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image>
mode="aspectFill" </button>
></image> <!-- <view class="name">{{ userInfo.nickName }}</view> -->
<input type="nickname" class="name" v-model="userInfo.nickName" placeholder="输入昵称"
@blur="onNicknameInput" />
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<image class="my_info_left_head" :src="userInfo.headImg" mode="aspectFill"></image>
<view class="name">{{ userInfo.nickName }}</view> <view class="name">{{ userInfo.nickName }}</view>
<!-- #endif -->
</view> </view>
<view class="right-icons"> <view class="right-icons">
<image <image class="my_info_right_qr" src="/static/icon/code.png" mode="aspectFill"></image>
class="my_info_right_qr"
src="/static/icon/code.png"
mode="aspectFill"
></image>
<view class="msg-view" @click="viewUserMsgList"> <view class="msg-view" @click="viewUserMsgList">
<view class="msg-icon-wrapper"> <view class="msg-icon-wrapper">
<image <image v-if="unreadMsgCount > 0" class="my-msg-icon" src="/static/mine/msg_select.png"
v-if="unreadMsgCount > 0" mode="aspectFill"></image>
class="my-msg-icon" <image v-else class="my-msg-icon" src="/static/mine/msg.png" mode="aspectFill"></image>
src="/static/mine/msg_select.png"
mode="aspectFill"
></image>
<image
v-else
class="my-msg-icon"
src="/static/mine/msg.png"
mode="aspectFill"
></image>
<!-- 角标 --> <!-- 角标 -->
<view <view v-if="unreadMsgCount > 0" class="badge">
v-if="unreadMsgCount > 0"
class="badge"
>
<text class="badge-text">{{ unreadMsgCount > 99 ? '99+' : unreadMsgCount }}</text> <text class="badge-text">{{ unreadMsgCount > 99 ? '99+' : unreadMsgCount }}</text>
</view> </view>
</view> </view>
@@ -69,11 +55,9 @@
<view class="amount"> <view class="amount">
<view class="u-flex u-flex-between u-m-t-20"> <view class="u-flex u-flex-between u-m-t-20">
<view class="u-flex"> <view class="u-flex">
<image <image style="width: 50rpx; height: 37rpx"
style="width: 50rpx; height: 37rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png"
mode="aspectFill" mode="aspectFill"></image>
></image>
<text class="color-333 font-14 u-m-l-20">储值</text> <text class="color-333 font-14 u-m-l-20">储值</text>
</view> </view>
<view class="u-flex color-666" @click="toChargeList"> <view class="u-flex color-666" @click="toChargeList">
@@ -83,18 +67,9 @@
</view> </view>
<view class="card-list"> <view class="card-list">
<view <view class="card-list-item" v-for="(item, index) in rechargeList" :key="index"
class="card-list-item" @click="toCharge(item)">
v-for="(item, index) in rechargeList" <up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image>
:key="index"
@click="toCharge(item)"
>
<up-image
radius="20rpx"
width="182rpx"
height="182rpx"
:src="item.logo"
></up-image>
<view class="info text-center"> <view class="info text-center">
<view class="color-333 u-m-t-14"> <view class="color-333 u-m-t-14">
<text class="font-10">¥</text> <text class="font-10">¥</text>
@@ -107,12 +82,8 @@
}}</view> }}</view>
</view> </view>
</view> </view>
<view <view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="rechargeList.length"
class="u-flex u-flex-column u-flex-center" @click="toChargeList">
style="width: 12px"
v-if="rechargeList.length"
@click="toChargeList"
>
<view class="text-center color-333 font-12">查看全部</view> <view class="text-center color-333 font-12">查看全部</view>
</view> </view>
</view> </view>
@@ -120,11 +91,8 @@
<view class="vip u-m-t-40"> <view class="vip u-m-t-40">
<view class="u-flex u-flex-between u-m-t-20"> <view class="u-flex u-flex-between u-m-t-20">
<view class="u-flex"> <view class="u-flex">
<image <image style="width: 50rpx; height: 40rpx" src="/static/icon/vip.png" mode="aspectFill">
style="width: 50rpx; height: 40rpx" </image>
src="/static/icon/vip.png"
mode="aspectFill"
></image>
<text class="color-333 font-14 u-m-l-20">会员</text> <text class="color-333 font-14 u-m-l-20">会员</text>
</view> </view>
<view class="u-flex color-666" @click="tomemberList"> <view class="u-flex color-666" @click="tomemberList">
@@ -134,43 +102,26 @@
</view> </view>
<view class="card-list"> <view class="card-list">
<view <view class="card-list-item" v-for="(item, index) in memberList" :key="index"
class="card-list-item" @click="tomember(item)">
v-for="(item, index) in memberList" <up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image>
:key="index"
@click="tomember(item)"
>
<up-image
radius="20rpx"
width="182rpx"
height="182rpx"
:src="item.logo"
></up-image>
<view class="info text-center"> <view class="info text-center">
<view class="font-12 color-666 u-m-t-14 u-line-1">{{ <view class="font-12 color-666 u-m-t-14 u-line-1">{{
item.shopName item.shopName
}}</view> }}</view>
</view> </view>
</view> </view>
<view <view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="memberList.length">
class="u-flex u-flex-column u-flex-center" <view class="text-center color-333 font-12" @click="tomemberList">查看全部</view>
style="width: 12px"
v-if="memberList.length"
>
<view class="text-center color-333 font-12" @click="tomemberList"
>查看全部</view
>
</view> </view>
</view> </view>
</view> </view>
<view class="amount"> <view class="amount">
<view class="u-flex u-flex-between u-m-t-20"> <view class="u-flex u-flex-between u-m-t-20">
<view class="u-flex"> <view class="u-flex">
<image <image style="width: 50rpx; height: 44rpx"
style="width: 50rpx; height: 44rpx" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png" mode="aspectFill">
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png" </image>
mode="aspectFill"
></image>
<text class="color-333 font-14 u-m-l-20">积分</text> <text class="color-333 font-14 u-m-l-20">积分</text>
</view> </view>
<view class="u-flex color-666" @click="toCoin"> <view class="u-flex color-666" @click="toCoin">
@@ -180,18 +131,9 @@
</view> </view>
<view class="card-list"> <view class="card-list">
<view <view class="card-list-item" v-for="(item, index) in coinList" :key="index"
class="card-list-item" @click="toCoin(item)">
v-for="(item, index) in coinList" <up-image radius="20rpx" width="182rpx" height="182rpx" :src="item.logo"></up-image>
:key="index"
@click="toCoin(item)"
>
<up-image
radius="20rpx"
width="182rpx"
height="182rpx"
:src="item.logo"
></up-image>
<view class="info text-center"> <view class="info text-center">
<view class="color-333 u-m-t-14"> <view class="color-333 u-m-t-14">
<text class="font-10">¥</text> <text class="font-10">¥</text>
@@ -204,12 +146,8 @@
}}</view> }}</view>
</view> </view>
</view> </view>
<view <view class="u-flex u-flex-column u-flex-center" style="width: 12px" v-if="coinList.length"
class="u-flex u-flex-column u-flex-center" @click="toCoin">
style="width: 12px"
v-if="coinList.length"
@click="toCoin"
>
<view class="text-center color-333 font-12">查看全部</view> <view class="text-center color-333 font-12">查看全部</view>
</view> </view>
</view> </view>
@@ -217,18 +155,10 @@
</view> </view>
<view class="my_item my_fun u-m-t-30"> <view class="my_item my_fun u-m-t-30">
<view class="my_fun_list"> <view class="my_fun_list">
<view <view class="my_list_item" v-for="(item, index) in myFunList" :key="index"
class="my_list_item" @click="clickTo(item, index)">
v-for="(item, index) in myFunList"
:key="index"
@click="clickTo(item, index)"
>
<view class="my_list_item_left"> <view class="my_list_item_left">
<image <image class="my_list_item_icon" :src="item.icon" mode="aspectFill"></image>
class="my_list_item_icon"
:src="item.icon"
mode="aspectFill"
></image>
<view class="my_list_item_name">{{ item.name }}</view> <view class="my_list_item_name">{{ item.name }}</view>
</view> </view>
<view class="my_list_item_right u-flex"> <view class="my_list_item_right u-flex">
@@ -237,34 +167,19 @@
}}</text> }}</text>
<!-- <text v-else-if="item.type=='my_coupon'" class="font-12 ">{{userInfo.couponNum || 0}}</text> --> <!-- <text v-else-if="item.type=='my_coupon'" class="font-12 ">{{userInfo.couponNum || 0}}</text> -->
<text class="font-12 color-999" v-else>查看</text> <text class="font-12 color-999" v-else>查看</text>
<u-icon <u-icon class="u-m-t-2" name="arrow-right" color="#999999" size="12"></u-icon>
class="u-m-t-2"
name="arrow-right"
color="#999999"
size="12"
></u-icon>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- <l-qrcode :value="wechatAcQrcode" @complete="e=>qrcodeResult(e)"/> --> <!-- <l-qrcode :value="wechatAcQrcode" @complete="e=>qrcodeResult(e)"/> -->
<view <view class="qrcode u-flex u-col-center justify-between" v-if="showQrcode">
class="qrcode u-flex u-col-center justify-between"
v-if="showQrcode"
>
<view> <view>
<view class="color-000 font-14 font-bold">扫码关注公众号</view> <view class="color-000 font-14 font-bold">扫码关注公众号</view>
<view class="u-m-t-16 color-999 font-12" <view class="u-m-t-16 color-999 font-12">长按识别关注更多优惠不能错过</view>
>长按识别关注更多优惠不能错过</view
>
</view> </view>
<up-image <up-image width="178rpx" height="178rpx" :show-menu-by-longpress="true" :src="qrcode"></up-image>
width="178rpx"
height="178rpx"
:show-menu-by-longpress="true"
:src="qrcode"
></up-image>
</view> </view>
</view> </view>
@@ -276,25 +191,47 @@
</template> </template>
<script setup> <script setup>
import weQrcode from "@/components/wechat-ac-qrcode.vue"; import weQrcode from "@/components/wechat-ac-qrcode.vue";
import devetools from "@/components/devetools.vue"; import devetools from "@/components/devetools.vue";
import { ref, computed, onMounted, reactive, watch } from "vue"; import {
import { onLoad, onReady, onShow } from "@dcloudio/uni-app"; ref,
import { productStore } from "@/stores/user.js"; computed,
import * as vipApi from "@/common/api/account/vip.js"; onMounted,
import * as rechargeApi from "@/common/api/market/recharge.js"; reactive,
import { pointsShopList } from '@/common/api/market/points.js' watch
import { getUnReadCountReq } from "../../common/api/account/message"; } from "vue";
import {
onLoad,
onReady,
onShow
} from "@dcloudio/uni-app";
import {
productStore
} from "@/stores/user.js";
import * as vipApi from "@/common/api/account/vip.js";
import * as rechargeApi from "@/common/api/market/recharge.js";
import {
pointsShopList
} from '@/common/api/market/points.js'
import {
getUnReadCountReq
} from "../../common/api/account/message";
import {
updateUserInfoReq
} from "../../common/api/api";
import {
uploadFile
} from '@/common/api/upload.js';
function qrcodeResult(res) { function qrcodeResult(res) {
qrcode.value = res; qrcode.value = res;
} }
const store = productStore(); const store = productStore();
const myFunList = ref([ const myFunList = ref([
// { // {
// name: "积分", // name: "积分",
// type: "score", // type: "score",
@@ -333,26 +270,26 @@ const myFunList = ref([
// icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_member.png" // icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_member.png"
// }, // },
// { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"}, // { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"},
]); ]);
const userInfo = reactive({}); const userInfo = reactive({});
const ShopId = ref(uni.cache.get("shopId")); const ShopId = ref(uni.cache.get("shopId"));
console.log("ShopId", uni.cache.get("shopId")); console.log("ShopId", uni.cache.get("shopId"));
function tomemberList() { function tomemberList() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/member/list", url: "/pages/user/member/list",
}); });
} }
function tomember(item) { function tomember(item) {
uni.navigateTo({ uni.navigateTo({
url: "/user/vip/vip?shopId=" + item.shopId, url: "/user/vip/vip?shopId=" + item.shopId,
}); });
} }
const clickEvent = () => { const clickEvent = () => {
if (ShopId.value) { if (ShopId.value) {
if (!userInfo.isVip) { if (!userInfo.isVip) {
uni.navigateTo({ uni.navigateTo({
@@ -380,10 +317,10 @@ const clickEvent = () => {
type: "user_payCode", type: "user_payCode",
}); });
} }
}; };
// 我的资产 // 我的资产
const Myassets = () => { const Myassets = () => {
if (uni.cache.get("shopId")) { if (uni.cache.get("shopId")) {
uni.pro.navigateTo("user/member/memberdetails", { uni.pro.navigateTo("user/member/memberdetails", {
shopId: uni.cache.get("shopId"), shopId: uni.cache.get("shopId"),
@@ -395,21 +332,21 @@ const Myassets = () => {
type: "index", type: "index",
}); });
} }
}; };
function toCharge(item) { function toCharge(item) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/member/czzx?shopId=" + item.shopId, url: "/pages/user/member/czzx?shopId=" + item.shopId,
}); });
} }
function toChargeList() { function toChargeList() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/member/amount-list", url: "/pages/user/member/amount-list",
}); });
} }
const clickTo = (item, index) => { const clickTo = (item, index) => {
if (item.url) { if (item.url) {
uni.navigateTo({ uni.navigateTo({
url: item.url, url: item.url,
@@ -419,7 +356,9 @@ const clickTo = (item, index) => {
let shopId = null; let shopId = null;
switch (item.type) { switch (item.type) {
case "msg": case "msg":
uni.navigateTo({ url: "/pageChat/index" }); uni.navigateTo({
url: "/pageChat/index"
});
break; break;
case "my_order": case "my_order":
uni.pro.switchTab("order/index"); uni.pro.switchTab("order/index");
@@ -473,16 +412,16 @@ const clickTo = (item, index) => {
}); });
break; break;
} }
}; };
const memberList = ref([]); const memberList = ref([]);
const rechargeList = ref([]); const rechargeList = ref([]);
const memberTotal = ref(0); const memberTotal = ref(0);
const rechargeTotal = ref(0); const rechargeTotal = ref(0);
const coinTotal = ref(0); const coinTotal = ref(0);
const coinList = ref([]); const coinList = ref([]);
async function getData() { async function getData() {
const res = await vipApi.list(); const res = await vipApi.list();
memberTotal.value = res.length; memberTotal.value = res.length;
memberList.value = res.slice(0, 3); memberList.value = res.slice(0, 3);
@@ -493,17 +432,17 @@ async function getData() {
const res3 = await pointsShopList(); const res3 = await pointsShopList();
coinTotal.value = res3.length; coinTotal.value = res3.length;
coinList.value = res3; coinList.value = res3;
} }
function toCoin() { function toCoin() {
uni.navigateTo({ uni.navigateTo({
url: "/user/score/list", url: "/user/score/list",
}); });
} }
const unreadMsgCount = ref(0); const unreadMsgCount = ref(0);
const getUnReadMsgCount = async () => { const getUnReadMsgCount = async () => {
let res = await getUnReadCountReq() let res = await getUnReadCountReq()
let badge = Number(res) let badge = Number(res)
@@ -519,16 +458,24 @@ const getUnReadMsgCount = async () => {
} }
unreadMsgCount.value = badge unreadMsgCount.value = badge
} }
const viewUserMsgList = () => { const viewUserMsgList = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/message/index" url: "/pages/user/message/index"
}) })
} }
onShow(() => { onShow(() => {
store.actionsAPIuser(); loadUserInfo()
console.log("userInfo", userInfo);
getData();
getUnReadMsgCount()
});
const loadUserInfo = async () => {
await store.actionsAPIuser();
if (uni.cache.get("shopId")) { if (uni.cache.get("shopId")) {
Object.assign(userInfo, uni.cache.get("orderVIP")); Object.assign(userInfo, uni.cache.get("orderVIP"));
} else { } else {
@@ -537,29 +484,44 @@ onShow(() => {
...uni.cache.get("userInfo").assetsSummary, ...uni.cache.get("userInfo").assetsSummary,
}); });
} }
console.log("userInfo", userInfo); }
getData();
getUnReadMsgCount() const qrcode = ref("");
}); const showQrcode = computed(() => {
const qrcode = ref("");
const showQrcode = computed(() => {
const followIndex = uni.cache.get("followIndex"); const followIndex = uni.cache.get("followIndex");
if (followIndex == "mine" && qrcode.value) { if (followIndex == "mine" && qrcode.value) {
return true; return true;
} }
}); });
const onChooseAvatar = async (e) => {
const fileRes = await uploadFile(e.detail.avatarUrl)
updateUserInfo({
"headImg": fileRes
})
}
const onNicknameInput = (e) => {
updateUserInfo({
"nickName": e.detail.value
})
}
const updateUserInfo = async (param) => {
await updateUserInfoReq(param)
loadUserInfo()
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.topBack { .topBack {
width: 100%; width: 100%;
height: 400rpx; height: 400rpx;
position: absolute; position: absolute;
} }
.myContent { .myContent {
position: relative; position: relative;
z-index: 1; z-index: 1;
padding: 298rpx 0 60rpx 0; padding: 298rpx 0 60rpx 0;
@@ -574,6 +536,13 @@ const showQrcode = computed(() => {
display: flex; display: flex;
align-items: center; align-items: center;
.atatar-btn {
padding: 0;
background: transparent;
border: none;
border-radius: 50%;
}
.my_info_left_head { .my_info_left_head {
width: 84rpx; width: 84rpx;
height: 84rpx; height: 84rpx;
@@ -694,9 +663,9 @@ const showQrcode = computed(() => {
} }
} }
} }
} }
.card-list { .card-list {
display: grid; display: grid;
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(4, 1fr);
column-gap: 40rpx; column-gap: 40rpx;
@@ -713,19 +682,21 @@ const showQrcode = computed(() => {
overflow: hidden; overflow: hidden;
} }
} }
} }
.qrcode {
.qrcode {
padding: 24rpx; padding: 24rpx;
margin: 60rpx 32rpx 60rpx 32rpx; margin: 60rpx 32rpx 60rpx 32rpx;
border-radius: 18rpx; border-radius: 18rpx;
border: 2rpx solid #d9d9d9; border: 2rpx solid #d9d9d9;
} }
.qrcode-box {
.qrcode-box {
position: fixed; position: fixed;
transform: translateX(200vw, 200vh); transform: translateX(200vw, 200vh);
} }
.right-icons { .right-icons {
display: flex; display: flex;
.my_info_right_qr { .my_info_right_qr {
@@ -766,5 +737,5 @@ const showQrcode = computed(() => {
text-align: center; text-align: center;
} }
} }
} }
</style> </style>