i
This commit is contained in:
@@ -1,31 +1,154 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
import { showToast, useLoad, getStorageSync } from "@tarojs/taro";
|
||||
import { getIntegralDetail, getBeanDetail } from "@/api/user";
|
||||
|
||||
const tabValue = ref(0);
|
||||
|
||||
const tabsList = ref([
|
||||
{
|
||||
title: "积分明细",
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
title: "豆子明细",
|
||||
value: 1,
|
||||
},
|
||||
]);
|
||||
|
||||
const tabChange = (index: number) => {
|
||||
tabValue.value = index;
|
||||
getList();
|
||||
};
|
||||
|
||||
const data = ref([]);
|
||||
|
||||
const userInfo = ref<any>({});
|
||||
|
||||
useLoad(() => {
|
||||
getList();
|
||||
userInfo.value = getStorageSync("userInfo");
|
||||
});
|
||||
|
||||
const page = ref({
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
ItemCount: 0,
|
||||
});
|
||||
|
||||
const pageChange = (e: number) => {
|
||||
page.value.PageNum = e;
|
||||
getList();
|
||||
};
|
||||
|
||||
const getList = async () => {
|
||||
try {
|
||||
let res: any;
|
||||
if (tabValue.value === 0) {
|
||||
res = await getBeanDetail({
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
});
|
||||
} else {
|
||||
res = await getIntegralDetail({
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
});
|
||||
}
|
||||
data.value = res.data.data || [];
|
||||
page.value.ItemCount = res.data.count;
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<view class="card">
|
||||
<view class="greeting">Hello! YuanHuakk</view>
|
||||
<!-- <view class="greeting">Hello! YuanHuakk</view> -->
|
||||
<view class="info">
|
||||
<view class="left">
|
||||
<view>
|
||||
<view class="num">豆子:188888</view>
|
||||
<view class="num">豆子: {{ userInfo.pulse }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="num">积分:188888</view>
|
||||
<view class="num">积分: {{ userInfo.integral }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/>
|
||||
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="tabs-box">
|
||||
<view
|
||||
v-for="item in tabsList"
|
||||
:key="item.value"
|
||||
@click="tabChange(item.value)"
|
||||
>
|
||||
<view class="text">{{ item.title }}</view>
|
||||
<view
|
||||
class="line"
|
||||
:class="{ lineColor: item.value === tabValue }"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="data.length > 0">
|
||||
<view v-if="tabValue === 0">
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<view>购买商品:{{ item.goods_name }}</view>
|
||||
<view>支付时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view style="color: green"
|
||||
>-<text>{{ item.number }}积分</text></view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<view>购买商品:{{ item.goods_name }}</view>
|
||||
<view>支付金额:{{ item.order_number }}元</view>
|
||||
<view>支付时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view style="color: red"
|
||||
>+<text>{{ item.number }}</text
|
||||
>豆子</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-pagination
|
||||
v-model="page.PageNum"
|
||||
:total-items="page.ItemCount"
|
||||
:items-per-page="page.PageSize"
|
||||
@change="pageChange"
|
||||
/>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无明细"></nut-empty>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
//background-color: #111;
|
||||
.nut-pagination {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 90%;
|
||||
height: 300px;
|
||||
@@ -35,7 +158,7 @@ page {
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
margin: 10px auto;
|
||||
color: #D0A568;
|
||||
color: #d0a568;
|
||||
padding: 20px;
|
||||
|
||||
.greeting {
|
||||
@@ -50,7 +173,8 @@ page {
|
||||
.left {
|
||||
height: 300px;
|
||||
width: 50%;
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
margin-left: 50px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
@@ -67,7 +191,42 @@ page {
|
||||
height: 270px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
.tabs-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
height: auto;
|
||||
background-color: #fff;
|
||||
padding: 0 20px;
|
||||
text-align: center;
|
||||
|
||||
.text {
|
||||
margin: 10px 20px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.line {
|
||||
margin: 0 auto;
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
border-radius: 30px;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.lineColor {
|
||||
background-color: #ff0000;
|
||||
}
|
||||
}
|
||||
.card-list {
|
||||
margin: 10px 20px;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
3
src/pages/users/distribution/index.config.ts
Normal file
3
src/pages/users/distribution/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "我的推广",
|
||||
});
|
||||
105
src/pages/users/distribution/index.vue
Normal file
105
src/pages/users/distribution/index.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="card-list">
|
||||
<view
|
||||
class="item"
|
||||
v-for="(item, index) in list"
|
||||
:key="index"
|
||||
@click="clickItem(item)"
|
||||
>
|
||||
<view class="text">
|
||||
<IconFont :name="item.icon" color="red" size="30" />
|
||||
<view>{{ item.label }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: 45%;"></view>
|
||||
</view>
|
||||
<!-- 二维码弹窗 -->
|
||||
<nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show">
|
||||
<view class="popup">
|
||||
<view>推荐人二维码绑定</view>
|
||||
<image :src="urlCode" />
|
||||
</view>
|
||||
</nut-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { IconFont } from "@nutui/icons-vue-taro";
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
const show = ref(false);
|
||||
|
||||
const urlCode = ref("");
|
||||
|
||||
const list = ref([
|
||||
{
|
||||
id: 1,
|
||||
icon: "scan",
|
||||
label: "推广名片",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
icon: "date",
|
||||
label: "积分明细",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
icon: "my2",
|
||||
label: "推广用户",
|
||||
},
|
||||
]);
|
||||
|
||||
const clickItem = (item: any) => {
|
||||
if (item.id === 1) {
|
||||
urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
|
||||
"token"
|
||||
)}`;
|
||||
show.value = true;
|
||||
} else if (item.id === 2) {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/distribution/integral/index",
|
||||
});
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/distribution/userlist/index",
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.card-list {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.item {
|
||||
width: 45%;
|
||||
height: 200px;
|
||||
background-color: #fff;
|
||||
border-radius: 20px;
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
|
||||
.text {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.popup {
|
||||
text-align: center;
|
||||
|
||||
image {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
3
src/pages/users/distribution/integral/index.config.ts
Normal file
3
src/pages/users/distribution/integral/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "积分明细",
|
||||
});
|
||||
85
src/pages/users/distribution/integral/index.vue
Normal file
85
src/pages/users/distribution/integral/index.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="data.length > 0">
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<view>昵称:{{ item.nick_name }}</view>
|
||||
<view>购买商品:{{ item.goods_name }}</view>
|
||||
<view>支付时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view style="color: red"
|
||||
>+<text>{{ item.number }}积分</text></view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<nut-pagination
|
||||
v-model="page.PageNum"
|
||||
:total-items="page.ItemCount"
|
||||
:items-per-page="page.PageSize"
|
||||
@change="pageChange"
|
||||
/>
|
||||
</view>
|
||||
<view v-else>
|
||||
<nut-empty description="暂无积分明细" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useLoad, showToast } from "@tarojs/taro";
|
||||
import { ref } from "vue";
|
||||
import { getTGIntegralDetail } from "../../../../api/user";
|
||||
|
||||
const data = ref([]);
|
||||
|
||||
useLoad(() => {
|
||||
getData();
|
||||
});
|
||||
|
||||
const page = ref({
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
ItemCount: 0,
|
||||
});
|
||||
|
||||
const pageChange = (e: number) => {
|
||||
page.value.PageNum = e;
|
||||
getData();
|
||||
};
|
||||
|
||||
const getData = async () => {
|
||||
try {
|
||||
const res = await getTGIntegralDetail({
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
});
|
||||
data.value = res.data.data || [];
|
||||
page.value.ItemCount = res.data.count;
|
||||
} catch (error) {
|
||||
showToast({ title: error.msg, icon: "none" });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.card-list {
|
||||
margin: 10px 20px;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.nut-pagination {
|
||||
position: absolute;
|
||||
margin-top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
</style>
|
||||
3
src/pages/users/distribution/userlist/index.config.ts
Normal file
3
src/pages/users/distribution/userlist/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "推广人统计",
|
||||
});
|
||||
93
src/pages/users/distribution/userlist/index.vue
Normal file
93
src/pages/users/distribution/userlist/index.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="data.length > 0">
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<image :src="item.avatarUrl" />
|
||||
<view class="text">
|
||||
<view>{{ item.nickName }}</view>
|
||||
<view>{{ item.phone }}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="right"></view>
|
||||
</view>
|
||||
<nut-pagination
|
||||
v-model="page.PageNum"
|
||||
:total-items="page.ItemCount"
|
||||
:items-per-page="page.PageSize"
|
||||
@change="pageChange"
|
||||
/>
|
||||
</view>
|
||||
<view v-else>
|
||||
<nut-empty description="暂无明细"></nut-empty>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { useLoad, showToast } from "@tarojs/taro";
|
||||
import { getTGUserList } from "../../../../api/user";
|
||||
|
||||
useLoad(() => {
|
||||
getData();
|
||||
});
|
||||
|
||||
const data = ref([]);
|
||||
|
||||
const page = ref({ PageNum: 1, PageSize: 10, ItemCount: 0 });
|
||||
|
||||
const pageChange = (e: number) => {
|
||||
page.value.PageNum = e;
|
||||
getData();
|
||||
};
|
||||
|
||||
const getData = async () => {
|
||||
try {
|
||||
const res = await getTGUserList({
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
});
|
||||
data.value = res.data.data || [];
|
||||
page.value.ItemCount = res.data.count;
|
||||
} catch (error) {
|
||||
showToast({ title: error.msg, icon: "none" });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.nut-pagination {
|
||||
position: absolute;
|
||||
margin-top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.card-list {
|
||||
width: 700px;
|
||||
background-color: #fff;
|
||||
margin: 10px auto;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
image {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
9
src/pages/users/order_list/index.js
Normal file
9
src/pages/users/order_list/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const obj = {
|
||||
a: 1,
|
||||
b: 3,
|
||||
c: 10,
|
||||
};
|
||||
|
||||
Object.keys(obj).forEach((item, index) => {
|
||||
console.log(obj[item]);
|
||||
});
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
} from "@tarojs/taro";
|
||||
import Pay from "@/components/Pay.vue";
|
||||
import { getIntegralOrderList } from "@/api/user";
|
||||
import { deleteJfOrder } from "@/api/goods";
|
||||
import { getOrderStatistics } from "@/api/order";
|
||||
|
||||
const tabValue = ref(0);
|
||||
|
||||
@@ -18,7 +20,7 @@ const tabsList = ref([
|
||||
{
|
||||
title: "全部",
|
||||
value: 0,
|
||||
num: 3,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "待付款",
|
||||
@@ -28,23 +30,24 @@ const tabsList = ref([
|
||||
{
|
||||
title: "待使用",
|
||||
value: 2,
|
||||
num: 1,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "已使用",
|
||||
value: 3,
|
||||
num: 1,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "已失效",
|
||||
value: 4,
|
||||
num: 1,
|
||||
num: 0,
|
||||
},
|
||||
]);
|
||||
|
||||
const jfInfo = ref({});
|
||||
|
||||
interface OrderList {
|
||||
oid: string;
|
||||
add_time: string;
|
||||
status: number;
|
||||
BindGoods: {
|
||||
@@ -68,6 +71,7 @@ const getList = async () => {
|
||||
const res = await getIntegralOrderList({
|
||||
status: tabValue.value,
|
||||
});
|
||||
|
||||
console.log(res);
|
||||
orderList.value = res.data.data;
|
||||
} catch (error) {
|
||||
@@ -76,6 +80,7 @@ const getList = async () => {
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
getTj();
|
||||
};
|
||||
|
||||
const tabChange = (index: number) => {
|
||||
@@ -88,9 +93,8 @@ useReachBottom(() => {
|
||||
});
|
||||
|
||||
const openPay = (item: OrderList) => {
|
||||
console.log("openPay", item);
|
||||
isShowPay.value = true;
|
||||
jfInfo.value = item;
|
||||
jfInfo.value = [item];
|
||||
};
|
||||
|
||||
const errPay = () => {
|
||||
@@ -100,6 +104,7 @@ const errPay = () => {
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
getList();
|
||||
};
|
||||
const closePay = () => {
|
||||
isShowPay.value = false;
|
||||
@@ -108,6 +113,7 @@ const closePay = () => {
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
getList();
|
||||
};
|
||||
|
||||
const toDetail = (item: any) => {
|
||||
@@ -116,6 +122,40 @@ const toDetail = (item: any) => {
|
||||
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
|
||||
});
|
||||
};
|
||||
|
||||
const delOrder = async (oid: string) => {
|
||||
try {
|
||||
const res = await deleteJfOrder({ oid });
|
||||
console.log(res);
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
getList();
|
||||
};
|
||||
|
||||
const countInfo = ref<any>({});
|
||||
|
||||
const getTj = async () => {
|
||||
try {
|
||||
const res = await getOrderStatistics({
|
||||
type: 2,
|
||||
});
|
||||
countInfo.value = res.data.data;
|
||||
tabsList.value[0].num = countInfo.value.A || 0;
|
||||
tabsList.value[1].num = countInfo.value.B || 0;
|
||||
tabsList.value[2].num = countInfo.value.C || 0;
|
||||
tabsList.value[3].num = countInfo.value.D || 0;
|
||||
tabsList.value[4].num = countInfo.value.F || 0;
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -124,7 +164,7 @@ const toDetail = (item: any) => {
|
||||
<view>
|
||||
<view style="font-weight: bold">订单信息</view>
|
||||
<view style="font-size: 15px"
|
||||
>消费订单:{{ 10 || 0 }} 总消费积分:{{ 12312 || 0 }}
|
||||
>总消费积分:{{ countInfo.Total || 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<image src="../static/user/order_list_top.png" />
|
||||
@@ -167,17 +207,17 @@ const toDetail = (item: any) => {
|
||||
<image :src="item.BindGoods.cover" />
|
||||
<view class="title">{{ item.BindGoods.name }} </view>
|
||||
<view class="right">
|
||||
<view>{{ item.BindGoods.number }}</view>
|
||||
<view>{{ item.number }}</view>
|
||||
<view>x{{ item.count }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
<!-- <view
|
||||
class="bom"
|
||||
style="text-align: right; font-size: 13px"
|
||||
>
|
||||
共{{ item.count }}件商品,实付积分:
|
||||
<text style="color: red">{{ item.number }}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="btn">
|
||||
@@ -186,6 +226,7 @@ const toDetail = (item: any) => {
|
||||
plain
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="delOrder(item.oid)"
|
||||
>取消订单
|
||||
</nut-button>
|
||||
<nut-button
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
>{{ goodInfo.BindGoods.name }}
|
||||
</view>
|
||||
<view class="right">
|
||||
<view>{{ goodInfo.BindGoods.number }}</view>
|
||||
<view>{{ goodInfo.number }}</view>
|
||||
<view>x{{ goodInfo.count }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -59,6 +59,15 @@
|
||||
title="下单时间:"
|
||||
:desc="goodInfo.add_time.slice(0, 19)"
|
||||
></nut-cell>
|
||||
<nut-cell
|
||||
v-if="goodInfo.expires !== 0"
|
||||
title="商品过期时间:"
|
||||
:desc="
|
||||
dayjs
|
||||
.unix(goodInfo.expires)
|
||||
.format('YYYY-MM-DD HH:mm:ss')
|
||||
"
|
||||
></nut-cell>
|
||||
<nut-cell
|
||||
title="支付状态:"
|
||||
:desc="
|
||||
@@ -72,14 +81,14 @@
|
||||
"
|
||||
></nut-cell>
|
||||
<nut-cell
|
||||
title="商品总价(积分):"
|
||||
:title="`商品总价(${type === '1' ? '元' : '积分'}):`"
|
||||
:desc="goodInfo.number"
|
||||
></nut-cell>
|
||||
<nut-cell>
|
||||
<template #default>
|
||||
<view style="text-align: right; width: 100%">
|
||||
<view
|
||||
>实付款(积分):
|
||||
>实付款({{ type === "1" ? "元" : "积分" }}):
|
||||
<nut-price
|
||||
:price="goodInfo.number"
|
||||
size="normal"
|
||||
@@ -91,13 +100,13 @@
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
<view class="btn">
|
||||
<nut-button
|
||||
<!-- <nut-button
|
||||
plain
|
||||
v-if="goodInfo.status === 0"
|
||||
size="small"
|
||||
type="primary"
|
||||
>取消订单
|
||||
</nut-button>
|
||||
</nut-button> -->
|
||||
<nut-button
|
||||
v-if="goodInfo.status === 0"
|
||||
style="margin-left: 5px"
|
||||
@@ -130,6 +139,13 @@
|
||||
<image class="qrcode" :src="url"></image>
|
||||
</view>
|
||||
</nut-popup>
|
||||
<pay
|
||||
:isShowPay="isShowPay"
|
||||
:payType="type === '1' ? 'wx' : 'jf'"
|
||||
@errPay="errPay"
|
||||
@closePay="closePay"
|
||||
:jfInfo="jfInfo"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -139,9 +155,11 @@ import {
|
||||
getStorageSync,
|
||||
makePhoneCall,
|
||||
openLocation,
|
||||
showToast,
|
||||
} from "@tarojs/taro";
|
||||
import { Service, Find } from "@nutui/icons-vue-taro";
|
||||
import { ref } from "vue";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const goodInfo = ref<any>({});
|
||||
|
||||
@@ -165,11 +183,15 @@ const statusList = ref([
|
||||
]);
|
||||
|
||||
const isShowCode = ref(false);
|
||||
const isShowPay = ref(false);
|
||||
const jfInfo = ref<any>({});
|
||||
|
||||
const type = ref("");
|
||||
|
||||
const url = ref("");
|
||||
|
||||
useLoad((options) => {
|
||||
console.log("options", options);
|
||||
type.value = options.type;
|
||||
goodInfo.value = getStorageSync("item");
|
||||
});
|
||||
|
||||
@@ -187,7 +209,27 @@ const toAdder = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const openPay = () => {};
|
||||
const openPay = () => {
|
||||
isShowPay.value = true;
|
||||
jfInfo.value = getStorageSync("item");
|
||||
};
|
||||
|
||||
const errPay = () => {
|
||||
isShowPay.value = false;
|
||||
showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
};
|
||||
const closePay = () => {
|
||||
isShowPay.value = false;
|
||||
showToast({
|
||||
title: "支付取消",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
};
|
||||
|
||||
const openCode = () => {
|
||||
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`;
|
||||
|
||||
@@ -1,213 +1,388 @@
|
||||
<script lang="ts" setup>
|
||||
import Taro from '@tarojs/taro'
|
||||
import {ref} from 'vue'
|
||||
import {getVerifyCode, applyMer, getMerTypeList} from '@/api/user'
|
||||
import Taro from "@tarojs/taro";
|
||||
import { ref } from "vue";
|
||||
import { getVerifyCode, applyMer, getMerTypeList } from "@/api/user";
|
||||
import Upload from "@/components/Upload.vue";
|
||||
|
||||
const visible = ref(false)
|
||||
const visible = ref(false);
|
||||
|
||||
const merType = ref(false)
|
||||
const merType = ref(false);
|
||||
|
||||
|
||||
const merGooType = ref(false)
|
||||
const merGooType = ref(false);
|
||||
|
||||
// 验证码按钮文字
|
||||
const smsStr = ref('获取验证码')
|
||||
const smsStr = ref("获取验证码");
|
||||
|
||||
// 验证码按钮是否禁用
|
||||
const smsDisabled = ref(false)
|
||||
const smsDisabled = ref(false);
|
||||
|
||||
// 表单数据
|
||||
const formValue = ref({
|
||||
name: '',
|
||||
userName: '',
|
||||
phone: '',
|
||||
code: '',
|
||||
bType: '',
|
||||
merTypeStr: '',
|
||||
classId: '',
|
||||
merGooTypeStr: ''
|
||||
})
|
||||
const formValue = ref<any>({
|
||||
name: "",
|
||||
userName: "",
|
||||
phone: "",
|
||||
code: "",
|
||||
bType: "",
|
||||
merTypeStr: "",
|
||||
classId: "",
|
||||
merGooTypeStr: "",
|
||||
license: [],
|
||||
front: [],
|
||||
back: [],
|
||||
head_photo: [],
|
||||
img: [],
|
||||
});
|
||||
|
||||
const merGooList = ref([])
|
||||
const merGooList = ref([]);
|
||||
|
||||
const merList = ref([])
|
||||
const merList = ref([]);
|
||||
|
||||
// 表单校验
|
||||
const ruleForm = ref<any>(null)
|
||||
const ruleForm = ref<any>(null);
|
||||
|
||||
Taro.useLoad(() => {
|
||||
getMerType()
|
||||
})
|
||||
getMerType();
|
||||
});
|
||||
|
||||
// 获取商户类型
|
||||
const getMerType = async () => {
|
||||
try {
|
||||
const res = await getMerTypeList()
|
||||
console.log(res)
|
||||
const res = await getMerTypeList();
|
||||
console.log(res);
|
||||
merList.value = res.data.type.map((item: any) => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.ID
|
||||
}
|
||||
})
|
||||
value: item.ID,
|
||||
};
|
||||
});
|
||||
merGooList.value = res.data.class.map((item: any) => {
|
||||
return {
|
||||
text: item.name,
|
||||
value: item.ID
|
||||
}
|
||||
})
|
||||
value: item.ID,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 关闭弹窗
|
||||
const onOk = async () => {
|
||||
try {
|
||||
const res = await applyMer(formValue.value)
|
||||
const data = {
|
||||
...formValue.value,
|
||||
license: formValue.value.license[0]?.url,
|
||||
front: formValue.value.front[0]?.url,
|
||||
back: formValue.value.back[0]?.url,
|
||||
head_photo: formValue.value.head_photo[0]?.url,
|
||||
img: formValue.value.img.map((item: any) => item.url),
|
||||
};
|
||||
const res = await applyMer(data);
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
icon: "none",
|
||||
});
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
visible.value = false
|
||||
}
|
||||
visible.value = false;
|
||||
};
|
||||
|
||||
// 打开弹窗
|
||||
const open = () => {
|
||||
console.log('open')
|
||||
visible.value = true
|
||||
}
|
||||
// const open = () => {
|
||||
// console.log("open");
|
||||
// visible.value = true;
|
||||
// };
|
||||
|
||||
// 获取验证码
|
||||
const getSmsCode = () => {
|
||||
ruleForm.value.validate('phone').then(async ({valid}: any) => {
|
||||
ruleForm.value.validate("phone").then(async ({ valid }: any) => {
|
||||
if (valid) {
|
||||
try {
|
||||
await getVerifyCode({
|
||||
phone: formValue.value.phone.toString()
|
||||
})
|
||||
smsDisabled.value = true
|
||||
let time = 10
|
||||
phone: formValue.value.phone.toString(),
|
||||
});
|
||||
smsDisabled.value = true;
|
||||
let time = 60;
|
||||
const timer = setInterval(() => {
|
||||
time--
|
||||
smsStr.value = `${time}s`
|
||||
time--;
|
||||
smsStr.value = `${time}s`;
|
||||
if (time === 0) {
|
||||
clearInterval(timer)
|
||||
smsDisabled.value = false
|
||||
smsStr.value = '获取验证码'
|
||||
clearInterval(timer);
|
||||
smsDisabled.value = false;
|
||||
smsStr.value = "获取验证码";
|
||||
}
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.message,
|
||||
icon: 'none'
|
||||
})
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 选择商户类型
|
||||
const confirmMerType = (e: any) => {
|
||||
formValue.value.merTypeStr = e.selectedOptions[0].text
|
||||
formValue.value.bType = e.selectedOptions[0].value
|
||||
merType.value = false
|
||||
}
|
||||
formValue.value.merTypeStr = e.selectedOptions[0].text;
|
||||
formValue.value.bType = e.selectedOptions[0].value;
|
||||
merType.value = false;
|
||||
};
|
||||
|
||||
// 选择经营类目
|
||||
const confirmGooType = (e: any) => {
|
||||
formValue.value.merGooTypeStr = e.selectedOptions[0].text
|
||||
formValue.value.classId = e.selectedOptions[0].value
|
||||
merGooType.value = false
|
||||
}
|
||||
formValue.value.merGooTypeStr = e.selectedOptions[0].text;
|
||||
formValue.value.classId = e.selectedOptions[0].value;
|
||||
merGooType.value = false;
|
||||
};
|
||||
|
||||
// 提交
|
||||
const submit = () => {
|
||||
ruleForm.value.validate().then(({valid, errors}: any) => {
|
||||
ruleForm.value.validate().then(({ valid, errors }: any) => {
|
||||
if (valid) {
|
||||
console.log('success', formValue.value)
|
||||
visible.value = true
|
||||
console.log("success", formValue.value);
|
||||
visible.value = true;
|
||||
} else {
|
||||
console.log('error submit!!', errors)
|
||||
console.log("error submit!!", errors);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<nut-form ref="ruleForm" class="form" :model-value="formValue">
|
||||
<nut-form-item required label="商户名称" prop="name" :rules="[{
|
||||
required: true,
|
||||
message: '请输入商户名称',
|
||||
}]">
|
||||
<input type="text" v-model="formValue.name" placeholder="请输入商户名称"/>
|
||||
<nut-form-item
|
||||
required
|
||||
label="商户名称"
|
||||
prop="name"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请输入商户名称',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
v-model="formValue.name"
|
||||
placeholder="请输入商户名称"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item required label="用户姓名" prop="userName" :rules="[{
|
||||
required: true,
|
||||
message: '请输入用户姓名',
|
||||
}]">
|
||||
<input type="text" v-model="formValue.userName" placeholder="请输入真实姓名"/>
|
||||
<nut-form-item
|
||||
required
|
||||
label="用户姓名"
|
||||
prop="userName"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请输入用户姓名',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
v-model="formValue.userName"
|
||||
placeholder="请输入真实姓名"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item required label="联系电话" prop="phone" :rules="[{
|
||||
required: true,
|
||||
message: '请输入正确的电话号码',
|
||||
regex: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
|
||||
}]">
|
||||
<input type="text" :maxlength="11" v-model="formValue.phone" placeholder="请输入联系电话"/>
|
||||
<nut-form-item
|
||||
required
|
||||
label="联系电话"
|
||||
prop="phone"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请输入正确的电话号码',
|
||||
regex: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
|
||||
},
|
||||
]"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
:maxlength="11"
|
||||
v-model="formValue.phone"
|
||||
placeholder="请输入联系电话"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item required label="验证码" prop="code" :rules="[{
|
||||
required: true,
|
||||
message: '请输入验证码',
|
||||
}]">
|
||||
<nut-form-item
|
||||
required
|
||||
label="验证码"
|
||||
prop="code"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请输入验证码',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<view class="yanCode">
|
||||
<input type="text" :maxlength="6" v-model="formValue.code" placeholder="请输入验证码"/>
|
||||
<nut-button style="width: 100px; padding: 3px" plain type="primary" size="mini"
|
||||
:disabled="smsDisabled" round
|
||||
@click="getSmsCode">
|
||||
<input
|
||||
type="text"
|
||||
:maxlength="6"
|
||||
v-model="formValue.code"
|
||||
placeholder="请输入验证码"
|
||||
/>
|
||||
<nut-button
|
||||
style="width: 100px; padding: 3px"
|
||||
plain
|
||||
type="primary"
|
||||
size="mini"
|
||||
:disabled="smsDisabled"
|
||||
round
|
||||
@click="getSmsCode"
|
||||
>
|
||||
{{ smsStr }}
|
||||
</nut-button>
|
||||
</view>
|
||||
</nut-form-item>
|
||||
<nut-form-item required label="商户类型" prop="merTypeStr" :rules="[{
|
||||
required: true,
|
||||
message: '请选择商户类型',
|
||||
}]">
|
||||
<input type="text" :disabled="true" v-model="formValue.merTypeStr" placeholder="请选择商户类型"
|
||||
@click="merType = true"/>
|
||||
<nut-form-item
|
||||
required
|
||||
label="商户类型"
|
||||
prop="merTypeStr"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择商户类型',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
:disabled="true"
|
||||
v-model="formValue.merTypeStr"
|
||||
placeholder="请选择商户类型"
|
||||
@click="merType = true"
|
||||
/>
|
||||
<nut-popup position="bottom" v-model:visible="merType">
|
||||
<nut-picker :columns="merList" title="商户类型" @confirm="confirmMerType"
|
||||
@cancel="merType = false"></nut-picker>
|
||||
<nut-picker
|
||||
:columns="merList"
|
||||
title="商户类型"
|
||||
@confirm="confirmMerType"
|
||||
@cancel="merType = false"
|
||||
></nut-picker>
|
||||
</nut-popup>
|
||||
</nut-form-item>
|
||||
<nut-form-item required label="经营类目" prop="merGooTypeStr" :rules="[{
|
||||
required: true,
|
||||
message: '请选择经营类目',
|
||||
}]">
|
||||
<input type="text" :disabled="true" v-model="formValue.merGooTypeStr" placeholder="请选择经营类目"
|
||||
@click="merGooType = true"/>
|
||||
<nut-form-item
|
||||
required
|
||||
label="经营类目"
|
||||
prop="merGooTypeStr"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择经营类目',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
:disabled="true"
|
||||
v-model="formValue.merGooTypeStr"
|
||||
placeholder="请选择经营类目"
|
||||
@click="merGooType = true"
|
||||
/>
|
||||
<nut-popup position="bottom" v-model:visible="merGooType">
|
||||
<nut-picker :columns="merGooList" title="商户类型" @confirm="confirmGooType"
|
||||
@cancel="merGooType = false"></nut-picker>
|
||||
<nut-picker
|
||||
:columns="merGooList"
|
||||
title="商户类型"
|
||||
@confirm="confirmGooType"
|
||||
@cancel="merGooType = false"
|
||||
></nut-picker>
|
||||
</nut-popup>
|
||||
</nut-form-item>
|
||||
<!-- <nut-form-item label="资质上传" prop="img">-->
|
||||
<!-- <nut-uploader url="www.baidu.com"></nut-uploader>-->
|
||||
<!-- </nut-form-item>-->
|
||||
<nut-form-item
|
||||
required
|
||||
label="营业执照"
|
||||
prop="license"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请上传营业执照',
|
||||
validator: (value) => {
|
||||
return value.length > 0;
|
||||
},
|
||||
},
|
||||
]"
|
||||
>
|
||||
<Upload v-model:list="formValue.license" />
|
||||
</nut-form-item>
|
||||
<nut-form-item
|
||||
required
|
||||
label="法人身份证(正面)"
|
||||
prop="front"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '法人身份证(正面)',
|
||||
validator: (value) => {
|
||||
return value.length > 0;
|
||||
},
|
||||
},
|
||||
]"
|
||||
>
|
||||
<Upload v-model:list="formValue.front" />
|
||||
</nut-form-item>
|
||||
<nut-form-item
|
||||
required
|
||||
label="法人身份证(反面)"
|
||||
prop="back"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '法人身份证(反面)',
|
||||
validator: (value) => {
|
||||
return value.length > 0;
|
||||
},
|
||||
},
|
||||
]"
|
||||
>
|
||||
<Upload v-model:list="formValue.back" />
|
||||
</nut-form-item>
|
||||
<nut-form-item
|
||||
required
|
||||
label="门头照"
|
||||
prop="head_photo"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请上传门头照',
|
||||
validator: (value) => {
|
||||
return value.length > 0;
|
||||
},
|
||||
},
|
||||
]"
|
||||
>
|
||||
<Upload v-model:list="formValue.head_photo" />
|
||||
</nut-form-item>
|
||||
<nut-form-item
|
||||
required
|
||||
label="店内照"
|
||||
prop="img"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '请上传店内照至少3张',
|
||||
validator: (value) => {
|
||||
return value.length >= 3;
|
||||
},
|
||||
},
|
||||
]"
|
||||
>
|
||||
<Upload v-model:list="formValue.img" :max="5" />
|
||||
</nut-form-item>
|
||||
|
||||
<view class="btn">
|
||||
<nut-button block type="primary" round @click="submit()">提交</nut-button>
|
||||
<nut-button block type="primary" round @click="submit()"
|
||||
>提交</nut-button
|
||||
>
|
||||
</view>
|
||||
|
||||
</nut-form>
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<nut-dialog
|
||||
@@ -226,14 +401,15 @@ const submit = () => {
|
||||
page {
|
||||
background-image: url("~@/static/merchantBg.jpg");
|
||||
background-size: 100%;
|
||||
background-color: #E93423;
|
||||
background-color: #e93423;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
|
||||
.form {
|
||||
position: relative;
|
||||
top: 300px;
|
||||
top: 200px;
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
|
||||
.btn {
|
||||
padding: 20px;
|
||||
@@ -247,4 +423,4 @@ page {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,94 +1,218 @@
|
||||
<script lang="ts" setup>
|
||||
import Taro from '@tarojs/taro'
|
||||
import Taro from "@tarojs/taro";
|
||||
import { ref } from "vue";
|
||||
import { getPersonalInfo, editPersonalInfo, getPhone } from "@/api/user";
|
||||
import { View } from "@tarojs/components";
|
||||
import { BASE_URL } from "@/utils/request";
|
||||
|
||||
const toPage = (e: string) => {
|
||||
}
|
||||
// const toPage = (e: string) => {};
|
||||
|
||||
const userInfo = ref<any>({});
|
||||
|
||||
Taro.useLoad(() => {
|
||||
const data = Taro.getStorageSync("userInfo");
|
||||
userInfo.value = data;
|
||||
});
|
||||
|
||||
const logOut = () => {
|
||||
Taro.showModal({
|
||||
title: '提示',
|
||||
content: '确定退出登录吗?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
Taro.removeStorageSync('token')
|
||||
Taro.removeStorageSync('userInfo')
|
||||
Taro.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
Taro.showModal({
|
||||
title: "提示",
|
||||
content: "确定退出登录吗?",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
Taro.removeStorageSync("token");
|
||||
Taro.removeStorageSync("userInfo");
|
||||
Taro.reLaunch({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
console.log("用户点击取消");
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const chooseavatar = (e: any) => {
|
||||
Taro.uploadFile({
|
||||
url: `${BASE_URL}/app/upload`,
|
||||
filePath: e.detail.avatarUrl,
|
||||
name: "file",
|
||||
header: {
|
||||
token: Taro.getStorageSync("token"),
|
||||
},
|
||||
success: function (res) {
|
||||
const data = JSON.parse(res.data);
|
||||
userInfo.value.avatarUrl = data.data.data;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const subUser = async () => {
|
||||
try {
|
||||
const reg =
|
||||
/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
|
||||
if (!reg.test(userInfo.value.phone))
|
||||
return Taro.showToast({
|
||||
title: "请输入正确的手机号码",
|
||||
icon: "none",
|
||||
});
|
||||
const res = await editPersonalInfo(userInfo.value);
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
});
|
||||
Taro.switchTab({
|
||||
url: "/pages/user/index",
|
||||
});
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const getUserInfo = async () => {
|
||||
try {
|
||||
const res = await getPersonalInfo();
|
||||
userInfo.value = res.data.data;
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="app">
|
||||
<view class="user-card">
|
||||
<view>管理我的账号</view>
|
||||
<view class="avatar-card">
|
||||
<view class="left">
|
||||
<nut-avatar size="large">
|
||||
<img
|
||||
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
|
||||
/>
|
||||
</nut-avatar>
|
||||
<view class="name">微信用户</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-cell-group>
|
||||
<nut-cell title="昵称" desc="微信用户" is-link></nut-cell>
|
||||
<nut-cell title="ID" desc="1" is-link></nut-cell>
|
||||
<nut-cell title="手机号码" desc="18888888888" is-link></nut-cell>
|
||||
<nut-cell title="登录密码" desc="修改登录密码" is-link></nut-cell>
|
||||
<nut-cell title="注销账号" desc="账号注销后不能恢复" is-link></nut-cell>
|
||||
</nut-cell-group>
|
||||
<view class="btn">
|
||||
<nut-button block type="primary" @click="logOut">退出登录</nut-button>
|
||||
</view>
|
||||
<view class="app">
|
||||
<view class="user-card">
|
||||
<view>管理我的账号</view>
|
||||
<!-- {{ userInfo }} -->
|
||||
<view class="avatar-card">
|
||||
<view class="left">
|
||||
<nut-button
|
||||
open-type="chooseAvatar"
|
||||
@chooseavatar="chooseavatar"
|
||||
>
|
||||
<nut-avatar size="large">
|
||||
<img
|
||||
style="border-radius: 50%"
|
||||
:src="userInfo.avatarUrl"
|
||||
/>
|
||||
</nut-avatar>
|
||||
</nut-button>
|
||||
|
||||
</view>
|
||||
<view class="name">{{ userInfo.nickName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-cell-group>
|
||||
<!-- :desc="userInfo.nickName" -->
|
||||
<nut-cell title="昵称">
|
||||
<template v-slot:link>
|
||||
<nut-input
|
||||
v-model="userInfo.nickName"
|
||||
:border="false"
|
||||
input-align="right"
|
||||
placeholder="请输入昵称"
|
||||
/> </template
|
||||
></nut-cell>
|
||||
<nut-cell title="手机号码">
|
||||
<template v-slot:link>
|
||||
<nut-input
|
||||
v-model="userInfo.phone"
|
||||
:border="false"
|
||||
input-align="right"
|
||||
disabled
|
||||
/>
|
||||
</template>
|
||||
</nut-cell>
|
||||
<nut-cell title="登录密码">
|
||||
<template v-slot:link>
|
||||
<nut-input
|
||||
v-model="userInfo.password"
|
||||
:border="false"
|
||||
input-align="right"
|
||||
placeholder="修改登录密码"
|
||||
/>
|
||||
</template>
|
||||
</nut-cell>
|
||||
<nut-cell title="注销账号" desc="账号注销后不能恢复" is-link>
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
<view class="btn">
|
||||
<nut-button block @click="subUser">保存信息</nut-button>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<nut-button block type="primary" @click="logOut"
|
||||
>退出登录</nut-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.user-card {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
margin: auto;
|
||||
position: relative;
|
||||
top: 10px;
|
||||
padding: 30px;
|
||||
|
||||
.avatar-card {
|
||||
background-color: rgba(255, 0, 0, 0.1);
|
||||
margin: 20px auto;
|
||||
border-radius: 20px;
|
||||
border: 1px solid #ff0000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30px;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
margin: auto;
|
||||
position: relative;
|
||||
top: 10px;
|
||||
padding: 30px;
|
||||
|
||||
.left {
|
||||
margin-left: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
justify-content: space-between;
|
||||
.avatar-card {
|
||||
background-color: rgba(255, 0, 0, 0.1);
|
||||
margin: 20px auto;
|
||||
border-radius: 20px;
|
||||
border: 1px solid #ff0000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30px;
|
||||
position: relative;
|
||||
|
||||
.name {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.left {
|
||||
margin-left: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
justify-content: space-between;
|
||||
|
||||
.name {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.nut-button {
|
||||
margin: 0 auto;
|
||||
width: 125px;
|
||||
height: 125px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 0 40px;
|
||||
padding: 0 40px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
.nut-input {
|
||||
width: 400px !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.nut-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.phoneBtn {
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
background-color: transparent !important;
|
||||
border: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user