This commit is contained in:
2023-09-06 03:49:21 +08:00
parent 8b5de95140
commit b6ca53f70e
39 changed files with 2146 additions and 679 deletions

View File

@@ -3,24 +3,33 @@
<view
class="user-center-card__header__transparent"
v-if="isLogin"
:style="{width: isLogin ? '100%' : '70%'}"
:style="{ width: isLogin ? '100%' : '70%' }"
>
<view class="user-center-card__header__avatar">
<nut-avatar size="large">
<img
:src="userInfo.avatarUrl"
/>
<img :src="userInfo.avatarUrl" />
</nut-avatar>
</view>
<view class="user-center-card__header__info">
<view class="user-center-card__header__info__name">{{ userInfo.nickName }}</view>
<view class="user-center-card__header__info__desc"
>ID:{{ userInfo.ID }}
</view
>
<view class="user-center-card__header__info__name">{{
userInfo.nickName
}}</view>
<view v-if="!userInfo.phone">
<nut-button
size="mini"
open-type="getPhoneNumber"
@getphonenumber="getphonenumber"
>点击绑定手机号
</nut-button>
</view>
</view>
<view class="rightIcon">
<Setting @click="toSetting" size="22"/>
<Scan style="margin-right: 20px" @click="scanCode" size="22" />
<Setting
style="margin-right: 20px"
@click="toSetting"
size="22"
/>
</view>
</view>
<view v-else class="user-center-card__header__transparent">
@@ -35,9 +44,8 @@
<view
class="user-center-card__header__info__name"
@tap="clickLogin"
>点击立即授权
</view
>
>点击立即授权
</view>
</view>
</view>
<view class="container">
@@ -47,24 +55,40 @@
<view>我的订单</view>
<view class="sub" @click="toOrderList(0)">
<view>全部订单</view>
<ArrowRight/>
<ArrowRight />
</view>
</view>
<view class="center">
<view class="center-t" @click="toOrderList(1)">
<Order size="25px"/>
<!-- <Order size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
size="40"
/>
<view class="center-text">待付款</view>
</view>
<view class="center-t" @click="toOrderList(2)">
<Clock size="25px"/>
<!-- <Clock size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/002434c9ed4774cb732517eb27e0ff547a41c606.png"
size="40"
/>
<view class="center-text">待使用</view>
</view>
<view class="center-t" @click="toOrderList(3)">
<Shop size="25px"/>
<!-- <Shop size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/7c2ca0228180fe5f3b1d74b0043d80e76c42eb7d.png"
size="40"
/>
<view class="center-text">已使用</view>
</view>
<view class="center-t" @click="toOrderList(4)">
<Del size="25px"/>
<!-- <Del size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/c4f4e069dddfa7104f794a46a759a7ed478b81ea.png"
size="40"
/>
<view class="center-text">已失效</view>
</view>
</view>
@@ -89,7 +113,7 @@
</view>
<!-- 商家管理 -->
<view class="mer-box" v-if="userInfo.bid !== 0">
<view class="mer-box" v-if="userInfo.bid">
<nut-grid :gutter="10" :border="false">
<nut-grid-item
:border="false"
@@ -101,12 +125,12 @@
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
<nut-grid-item text="订单统计">
<!-- <nut-grid-item text="订单统计">
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
</nut-grid-item> -->
</nut-grid>
</view>
@@ -114,73 +138,85 @@
<!--<view class="copy">© 2023 </view>-->
</view>
<!-- 登录 -->
<Auth :visible="isShowLogin" @update:visible="cancelLogin" @ok="getUserInfo"/>
<Auth
:visible="isShowLogin"
@update:visible="cancelLogin"
@ok="getUserInfo"
/>
</view>
</template>
<script lang="ts" setup>
import {ref} from 'vue'
import {
ArrowRight,
Order,
Del,
Clock,
Shop,
Setting,
IconFont
} from '@nutui/icons-vue-taro'
import Taro from '@tarojs/taro'
import Auth from '@/components/Auth.vue'
import {getPersonalInfo} from '@/api/user'
import { ref } from "vue";
import { ArrowRight, Setting, IconFont, Scan } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import Auth from "@/components/Auth.vue";
import { getPersonalInfo, getPhone, bindParent } from "@/api/user";
const isShowLogin = ref(false)
const isShowLogin = ref(false);
const isLogin = ref(false)
const isLogin = ref(false);
interface UserInfo {
nickName?: string
avatarUrl?: string
ID?: string
bid?: number
nickName?: string;
avatarUrl?: string;
ID?: string;
bid?: string;
phone?: string;
uid?: string;
}
const userInfo = ref<UserInfo>({})
const userInfo = ref<UserInfo>({});
Taro.useLoad(() => {
const token = Taro.getStorageSync('token')
Taro.useDidShow(() => {
const token = Taro.getStorageSync("token");
if (token) {
getUserInfo()
getUserInfo();
}
})
});
const cancelLogin = () => {
isShowLogin.value = false
}
isShowLogin.value = false;
};
const getUserInfo = async () => {
Taro.showLoading({
title: '加载中'
})
const res = await getPersonalInfo()
userInfo.value = res.data.data
Taro.setStorageSync('userInfo', res.data.data)
isLogin.value = true
cancelLogin()
Taro.hideLoading()
}
title: "加载中",
});
const res = await getPersonalInfo();
userInfo.value = res.data.data;
Taro.setStorageSync("userInfo", res.data.data);
Taro.setStorageSync("mer_type", res.data.store_type);
isLogin.value = true;
cancelLogin();
Taro.hideLoading();
};
const getphonenumber = async (e: any) => {
await getPhone({
uid: userInfo.value.uid,
code: e.detail.code,
});
getUserInfo();
};
const toOrderList = (e: number) => {
if (!isLogin)
return Taro.showToast({
title: "请先登录",
icon: "none",
});
Taro.navigateTo({
url: `/pages/users/order_list/index?type=${e}`
})
}
url: `/pages/users/order_list/index?type=${e}`,
});
};
const userMenuList = ref([
{
id: 1,
label: '我的账户',
url: '/pages/users/account/index',
icon: 'http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png'
label: "我的账户",
url: "/pages/users/account/index",
icon: "http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png",
},
// {
// id: 2,
@@ -190,40 +226,62 @@ const userMenuList = ref([
// },
{
id: 3,
label: '分销中心',
url: '',
icon: 'http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png'
label: "我的推广",
url: "/pages/users/distribution/index",
icon: "http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png",
},
{
id: 4,
label: '关注商家',
url: '',
icon: 'http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png'
label: "关注商家",
url: "",
icon: "http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png",
},
{
id: 5,
label: '问题反馈',
url: '',
icon: 'http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png'
}
])
label: "问题反馈",
url: "",
icon: "http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png",
},
]);
const toSetting = () => {
Taro.navigateTo({
url: '/pages/users/setting/index'
})
}
url: "/pages/users/setting/index",
});
};
const clickLogin = () => {
isShowLogin.value = true
}
isShowLogin.value = true;
};
const toPage = (url: string) => {
console.log(url)
Taro.navigateTo({
url: url
})
}
url: url,
});
};
const scanCode = () => {
Taro.scanCode({
onlyFromCamera: true,
scanType: ["qrCode"],
success: async (data) => {
try {
await bindParent({
uid: data.result,
});
Taro.showToast({
title: "绑定成功",
icon: "none",
});
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
},
});
};
</script>
<style lang="scss">
@@ -307,7 +365,7 @@ const toPage = (url: string) => {
align-items: center;
.center-text {
margin-top: 20px;
margin-top: 15px;
}
}
}