build(custom): 修正提交规范

This commit is contained in:
2023-11-09 19:49:24 +08:00
parent 76d57cea37
commit 29c1d4280f
105 changed files with 29374 additions and 18618 deletions

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '我的账户'
})
navigationBarTitleText: "我的账户",
});

View File

@@ -1,316 +1,306 @@
<script lang="ts" setup>
import {computed, ref} from "vue";
import {showToast, useLoad, getStorageSync} from "@tarojs/taro";
import {getIntegralDetail, getBeanDetail, getGiftRecord} from "@/api/user";
import { computed, ref } from "vue";
import { showToast, useLoad, getStorageSync } from "@tarojs/taro";
import { getIntegralDetail, getBeanDetail, getGiftRecord } from "@/api/user";
const tabValue = ref(1);
const tabsList = ref([
{
title: "兑换明细",
value: 1,
},
{
title: "赠送明细",
value: 3,
},
{
title: "豆子明细",
value: 2,
},
{
title: "活动赠送",
value: 4,
}
{
title: "兑换明细",
value: 1,
},
{
title: "赠送明细",
value: 3,
},
{
title: "豆子明细",
value: 2,
},
{
title: "活动赠送",
value: 4,
},
]);
const computerType = computed(() => {
return (val: number) => {
switch (val) {
case 5:
return '注册赠送';
case 6:
return '签到赠送';
case 7:
return '系统赠送';
}
return (val: number) => {
switch (val) {
case 5:
return "注册赠送";
case 6:
return "签到赠送";
case 7:
return "系统赠送";
}
})
};
});
const tabChange = (index: number) => {
tabValue.value = index;
data.value = [];
getList();
page.value.PageNum = 1;
tabValue.value = index;
data.value = [];
getList();
page.value.PageNum = 1;
};
const data = ref([]);
const data = ref<any>([]);
const userInfo = ref<any>({});
useLoad(() => {
getList();
userInfo.value = getStorageSync("userInfo");
getList();
userInfo.value = getStorageSync("userInfo");
});
const page = ref({
PageNum: 1,
PageSize: 10,
ItemCount: 0,
PageNum: 1,
PageSize: 10,
ItemCount: 0,
});
const pageChange = (e: number) => {
page.value.PageNum = e;
getList();
page.value.PageNum = e;
getList();
};
const getList = async () => {
try {
let res: any;
const newData = {
PageNum: page.value.PageNum,
PageSize: page.value.PageSize,
Type: tabValue.value,
};
if (tabValue.value === 1 || tabValue.value === 3) {
res = await getBeanDetail(newData);
} else if (tabValue.value === 2) {
delete data.Type;
res = await getIntegralDetail(newData);
} else {
res = await getGiftRecord(newData);
}
console.log(res);
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
try {
let res: any;
const newData = {
PageNum: page.value.PageNum,
PageSize: page.value.PageSize,
Type: tabValue.value,
};
if (tabValue.value === 1 || tabValue.value === 3) {
res = await getBeanDetail(newData);
} else if (tabValue.value === 2) {
// delete data.value.Type;
Reflect.deleteProperty(data.value, "Type");
res = await getIntegralDetail(newData);
} else {
res = await getGiftRecord(newData);
}
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="info">
<view class="left">
<view>
<view class="num">豆子: {{ userInfo.pulse }}</view>
</view>
<view>
<view class="num">积分: {{ userInfo.integral }}</view>
</view>
</view>
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
</view>
<view>
<view class="card">
<!-- <view class="greeting">Hello! YuanHuakk</view> -->
<view class="info">
<view class="left">
<view>
<view class="num">豆子: {{ userInfo.pulse }}</view>
</view>
<view>
<view class="num">积分: {{ userInfo.integral }}</view>
</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 === 1 || tabValue === 3">
<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 v-if="tabValue === 1" style="color: green"
>-
<text>{{ item.number }}积分</text>
</view
>
<view v-if="tabValue === 3" style="color: red"
>+
<text>{{ item.number }}
</text
>
积分
</view
>
</view>
</view>
</view>
<view v-else-if="tabValue === 2">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view class="text">商品{{ 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>
<view v-else-if="tabValue === 4">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view class="text">类型{{ computerType(item.type) }}</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>
<!-- <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 === 1 || tabValue === 3">
<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 v-if="tabValue === 1" style="color: green"
>-
<text>{{ item.number }}积分</text>
</view>
<view v-if="tabValue === 3" style="color: red"
>+
<text>{{ item.number }} </text>
积分
</view>
</view>
</view>
</view>
<view v-else-if="tabValue === 2">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view class="text">商品{{ 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>
<view v-else-if="tabValue === 4">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view class="text">类型{{ computerType(item.type) }}</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">
.nut-pagination {
position: absolute;
left: 50%;
transform: translateX(-50%);
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.card {
width: 90%;
height: 300px;
border-radius: 20px;
background-color: #282828;
box-shadow: 0 0 10px rgba(40, 40, 40, 0.1);
background-size: 100% 100%;
background-repeat: no-repeat;
margin: 10px auto;
color: #d0a568;
padding: 20px;
width: 90%;
height: 300px;
border-radius: 20px;
background-color: #282828;
box-shadow: 0 0 10px rgba(40, 40, 40, 0.1);
background-size: 100% 100%;
background-repeat: no-repeat;
margin: 10px auto;
color: #d0a568;
padding: 20px;
.greeting {
font-size: 35px;
.greeting {
font-size: 35px;
font-weight: bold;
}
.info {
display: flex;
justify-content: space-between;
.left {
height: 300px;
width: 50%;
text-align: left;
margin-left: 50px;
display: flex;
flex-direction: column;
justify-content: center;
.num {
font-size: 40px;
font-weight: bold;
margin-top: 10px;
}
}
.info {
display: flex;
justify-content: space-between;
.left {
height: 300px;
width: 50%;
text-align: left;
margin-left: 50px;
display: flex;
flex-direction: column;
justify-content: center;
.num {
font-size: 40px;
font-weight: bold;
margin-top: 10px;
}
}
.img {
width: 380px;
height: 270px;
}
.img {
width: 380px;
height: 270px;
}
}
}
.tabs-box {
display: flex;
flex-direction: row;
justify-content: space-evenly;
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;
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;
}
.line {
margin: 0 auto;
width: 50px;
height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.lineColor {
background-color: #ff0000;
}
.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;
margin: 10px 20px;
background-color: #fff;
display: flex;
border-radius: 10px;
padding: 20px;
justify-content: space-between;
align-items: center;
.left {
width: 500px;
.left {
width: 500px;
.text {
text-align: left;
width: 100%;
// 超出一行隐藏
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
}
.text {
text-align: left;
width: 100%;
// 超出一行隐藏
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
}
}
.right {
flex: 1;
text-align: right;
}
.right {
flex: 1;
text-align: right;
}
}
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '手机号登录'
})
navigationBarTitleText: "手机号登录",
});

View File

@@ -5,12 +5,12 @@ import { getVerifyCode, phoneLogin } from "@/api/user";
import logoImg from "../../../static/logo.jpg";
Taro.useLoad((options) => {
console.log(options);
console.log(options);
});
const basicData = ref({
phone: "",
code: "",
phone: "",
code: "",
});
const smsDisabled = ref(false);
@@ -19,148 +19,146 @@ const smsStr = ref("获取验证码");
// 获取验证码
const getSmsCode = async () => {
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
await getVerifyCode({
phone: basicData.value.phone.toString(),
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
smsDisabled.value = true;
let time = 60;
const timer = setInterval(() => {
time--;
smsStr.value = `${time}s`;
if (time === 0) {
clearInterval(timer);
smsDisabled.value = false;
smsStr.value = "获取验证码";
}
}, 1000);
await getVerifyCode({
phone: basicData.value.phone.toString(),
});
smsDisabled.value = true;
let time = 60;
const timer = setInterval(() => {
time--;
smsStr.value = `${time}s`;
if (time === 0) {
clearInterval(timer);
smsDisabled.value = false;
smsStr.value = "获取验证码";
}
}, 1000);
};
const login = async () => {
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
if (!basicData.value.code)
return Taro.showToast({
title: "请输入验证码",
icon: "none",
});
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
if (!basicData.value.code)
return Taro.showToast({
title: "请输入验证码",
icon: "none",
});
const res = await phoneLogin({
Phone: basicData.value.phone,
Code: basicData.value.code,
Referee: Taro.getStorageSync("bind_id") || "",
const res = await phoneLogin({
Phone: basicData.value.phone,
Code: basicData.value.code,
Referee: Taro.getStorageSync("bind_id") || "",
});
Taro.showToast({
title: res.msg,
icon: "success",
duration: 2000,
});
Taro.setStorageSync("token", res.data.token);
setTimeout(() => {
Taro.removeStorageSync("bind_id");
Taro.switchTab({
url: "/pages/user/index",
});
Taro.showToast({
title: res.msg,
icon: "success",
duration: 2000,
});
Taro.setStorageSync("token", res.data.token);
setTimeout(() => {
Taro.removeStorageSync("bind_id");
Taro.switchTab({
url: "/pages/user/index",
});
}, 2000);
}, 2000);
};
</script>
<template>
<view class="wrapper">
<image src="../../../static/wechat_login.jpg" />
<view class="logo">
<image :src="logoImg" />
<view>捷兑通</view>
</view>
<view class="center">
<nut-form :model-value="basicData" ref="RefForm">
<nut-form-item label="手机号码:">
<nut-input
v-model="basicData.phone"
class="nut-input-text"
placeholder="请输入手机号码"
type="text"
/>
</nut-form-item>
<nut-form-item label="验证码:">
<view style="display: flex">
<nut-input
v-model="basicData.code"
class="nut-input-text"
placeholder="请输入验证码"
type="text"
/>
<nut-button
size="mini"
style="margin-left: 10px"
@click="getSmsCode"
:disabled="smsDisabled"
>{{ smsStr }}</nut-button
>
</view>
</nut-form-item>
<nut-form-item>
<nut-button type="primary" block @click="login"
>登录</nut-button
>
</nut-form-item>
</nut-form>
</view>
<view class="wrapper">
<image src="../../../static/wechat_login.jpg" />
<view class="logo">
<image :src="logoImg" />
<view>捷兑通</view>
</view>
<view class="center">
<nut-form :model-value="basicData" ref="RefForm">
<nut-form-item label="手机号码:">
<nut-input
v-model="basicData.phone"
class="nut-input-text"
placeholder="请输入手机号码"
type="text"
/>
</nut-form-item>
<nut-form-item label="验证码:">
<view style="display: flex">
<nut-input
v-model="basicData.code"
class="nut-input-text"
placeholder="请输入验证码"
type="text"
/>
<nut-button
size="mini"
style="margin-left: 10px"
@click="getSmsCode"
:disabled="smsDisabled"
>{{ smsStr }}</nut-button
>
</view>
</nut-form-item>
<nut-form-item>
<nut-button type="primary" block @click="login">登录</nut-button>
</nut-form-item>
</nut-form>
</view>
</view>
</template>
<style lang="scss">
page {
background: #fff;
background: #fff;
}
.wrapper {
position: relative;
position: relative;
image {
width: 100%;
height: 838px;
}
.logo {
position: absolute;
top: 35%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 35px;
line-height: 70px;
image {
width: 100%;
height: 838px;
width: 200px;
height: 200px;
border-radius: 50%;
}
}
.logo {
position: absolute;
top: 35%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 35px;
line-height: 70px;
image {
width: 200px;
height: 200px;
border-radius: 50%;
}
}
.center {
position: absolute;
top: 55%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 0px 10px;
}
.center {
position: absolute;
top: 55%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 0px 10px;
}
}
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "我的推广",
navigationBarTitleText: "我的推广",
});

View File

@@ -1,27 +1,27 @@
<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>
<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>
<!-- 二维码弹窗 -->
<nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show">
<view class="popup">
<view>推荐人二维码绑定</view>
<image style="margin-top: 10px" :src="urlCode" />
</view>
</nut-popup>
</view>
<view style="width: 45%"></view>
</view>
<!-- 二维码弹窗 -->
<nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show">
<view class="popup">
<view>推荐人二维码绑定</view>
<image style="margin-top: 10px" :src="urlCode" />
</view>
</nut-popup>
</view>
</template>
<script setup lang="ts">
@@ -35,79 +35,79 @@ 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: "推广用户",
},
{
id: 1,
icon: "scan",
label: "推广名片",
},
{
id: 2,
icon: "date",
label: "积分明细",
},
{
id: 3,
icon: "my2",
label: "推广用户",
},
]);
const clickItem = async (item: any) => {
if (item.id === 1) {
// urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
// "token"
// )}`;
Taro.showLoading({
title: "加载中",
mask: true,
});
const res = await getRefereeCode();
urlCode.value = `data:image/png;base64,${res.data.data}`;
show.value = true;
Taro.hideLoading();
} else if (item.id === 2) {
Taro.navigateTo({
url: "/pages/users/distribution/integral/index",
});
} else {
Taro.navigateTo({
url: "/pages/users/distribution/userlist/index",
});
}
if (item.id === 1) {
// urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
// "token"
// )}`;
Taro.showLoading({
title: "加载中",
mask: true,
});
const res = await getRefereeCode();
urlCode.value = `data:image/png;base64,${res.data.data}`;
show.value = true;
Taro.hideLoading();
} 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;
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;
.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%);
}
.text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
}
.popup {
text-align: center;
text-align: center;
image {
width: 300px;
height: 300px;
}
image {
width: 300px;
height: 300px;
}
}
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "积分明细",
navigationBarTitleText: "积分明细",
});

View File

@@ -1,38 +1,38 @@
<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
>订单价格<text style="color: red">{{
item.order_number
}}</text></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-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
>订单价格<text style="color: red">{{
item.order_number
}}</text></view
>
<view>购买时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view v-else>
<nut-empty description="暂无积分明细" />
<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">
@@ -43,48 +43,48 @@ import { getTGIntegralDetail } from "../../../../api/user";
const data = ref([]);
useLoad(() => {
getData();
getData();
});
const page = ref({
PageNum: 1,
PageSize: 10,
ItemCount: 0,
PageNum: 1,
PageSize: 10,
ItemCount: 0,
});
const pageChange = (e: number) => {
page.value.PageNum = e;
getData();
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" });
}
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;
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%);
position: absolute;
margin-top: 10px;
left: 50%;
transform: translateX(-50%);
}
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "推广人统计",
navigationBarTitleText: "推广人统计",
});

View File

@@ -1,32 +1,31 @@
<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 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">
@@ -35,7 +34,7 @@ import { useLoad, showToast } from "@tarojs/taro";
import { getTGUserList } from "../../../../api/user";
useLoad(() => {
getData();
getData();
});
const data = ref([]);
@@ -43,51 +42,51 @@ const data = ref([]);
const page = ref({ PageNum: 1, PageSize: 10, ItemCount: 0 });
const pageChange = (e: number) => {
page.value.PageNum = e;
getData();
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" });
}
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%);
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;
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;
}
.left {
display: flex;
align-items: center;
image {
width: 100px;
height: 100px;
border-radius: 50%;
}
.text {
margin-left: 20px;
}
}
}
</style>

View File

@@ -1,4 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '登录',
navigationStyle: 'custom'
})
navigationBarTitleText: "登录",
navigationStyle: "custom",
});

View File

@@ -7,83 +7,83 @@ import logoImg from "../../../static/logo.jpg";
const isShow = ref(false);
const getCode = () => {
Taro.showLoading({
title: "授权中...",
mask: true,
});
Taro.login({
success: (res) => {
console.log(res);
Taro.setStorageSync("wx_code", res.code);
isShow.value = true;
},
complete: () => {
Taro.hideLoading();
},
});
Taro.showLoading({
title: "授权中...",
mask: true,
});
Taro.login({
success: (res) => {
console.log(res);
Taro.setStorageSync("wx_code", res.code);
isShow.value = true;
},
complete: () => {
Taro.hideLoading();
},
});
};
const toPage = () => {
Taro.navigateTo({
url: "/pages/users/bindPhone/index?type=1",
});
Taro.navigateTo({
url: "/pages/users/bindPhone/index?type=1",
});
};
</script>
<template>
<view class="wrapper">
<image src="../../../static/wechat_login.jpg" />
<view class="logo">
<image :src="logoImg" />
<view>捷兑通</view>
</view>
<view class="center">
<nut-button type="success" @click="getCode">微信登录</nut-button>
<nut-button style="margin-top: 15px" @click="toPage"
>手机号登录</nut-button
>
</view>
<UserModal v-model:isShow="isShow" @closeEdit="isShow = false" />
<view class="wrapper">
<image src="../../../static/wechat_login.jpg" />
<view class="logo">
<image :src="logoImg" />
<view>捷兑通</view>
</view>
<view class="center">
<nut-button type="success" @click="getCode">微信登录</nut-button>
<nut-button style="margin-top: 15px" @click="toPage"
>手机号登录</nut-button
>
</view>
<UserModal v-model:isShow="isShow" @closeEdit="isShow = false" />
</view>
</template>
<style lang="scss">
page {
background: #fff;
background: #fff;
}
.wrapper {
position: relative;
position: relative;
image {
width: 100%;
height: 838px;
}
.logo {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 35px;
line-height: 70px;
image {
width: 100%;
height: 838px;
width: 200px;
height: 200px;
border-radius: 50%;
}
}
.logo {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 35px;
line-height: 70px;
image {
width: 200px;
height: 200px;
border-radius: 50%;
}
}
.center {
position: absolute;
top: 80%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 10px 100px;
}
.center {
position: absolute;
top: 80%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 10px 100px;
}
}
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '我的订单'
})
navigationBarTitleText: "我的订单",
});

View File

@@ -1,12 +1,12 @@
<script lang="ts" setup>
import { ref } from "vue";
import {
useLoad,
useReachBottom,
showToast,
navigateTo,
setStorageSync,
useDidShow,
useLoad,
useReachBottom,
showToast,
navigateTo,
setStorageSync,
useDidShow,
} from "@tarojs/taro";
import Pay from "@/components/Pay.vue";
import { getIntegralOrderList } from "@/api/user";
@@ -18,349 +18,345 @@ const tabValue = ref(0);
const isShowPay = ref(false);
const tabsList = ref([
{
title: "全部",
value: 0,
num: 0,
},
{
title: "待付款",
value: 1,
num: 0,
},
{
title: "待使用",
value: 2,
num: 0,
},
{
title: "已使用",
value: 3,
num: 0,
},
{
title: "已失效",
value: 4,
num: 0,
},
{
title: "全部",
value: 0,
num: 0,
},
{
title: "待付款",
value: 1,
num: 0,
},
{
title: "待使用",
value: 2,
num: 0,
},
{
title: "已使用",
value: 3,
num: 0,
},
{
title: "已失效",
value: 4,
num: 0,
},
]);
const jfInfo = ref({});
interface OrderList {
oid: string;
add_time: string;
status: number;
BindGoods: {
cover: string;
name: string;
number: number;
};
count: number;
oid: string;
add_time: string;
status: number;
BindGoods: {
cover: string;
name: string;
number: number;
};
count: number;
number: number;
}
const orderList = ref<OrderList[]>([]);
useLoad((options) => {
tabValue.value = Number(options.type);
tabValue.value = Number(options.type);
});
useDidShow(() => {
getList();
getList();
});
const getList = async () => {
try {
const res = await getIntegralOrderList({
status: tabValue.value,
});
try {
const res = await getIntegralOrderList({
status: tabValue.value,
});
console.log(res);
orderList.value = res.data.data;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
}
getTj();
console.log(res);
orderList.value = res.data.data;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
}
getTj();
};
const tabChange = (index: number) => {
tabValue.value = index;
getList();
tabValue.value = index;
getList();
};
useReachBottom(() => {
console.log("useReachBottom");
console.log("useReachBottom");
});
const openPay = (item: OrderList) => {
isShowPay.value = true;
jfInfo.value = [item];
isShowPay.value = true;
jfInfo.value = [item];
};
const errPay = () => {
isShowPay.value = false;
showToast({
title: "支付失败",
icon: "none",
});
jfInfo.value = {};
getList();
isShowPay.value = false;
showToast({
title: "支付失败",
icon: "none",
});
jfInfo.value = {};
getList();
};
const closePay = () => {
isShowPay.value = false;
showToast({
title: "支付取消",
icon: "none",
});
jfInfo.value = {};
getList();
isShowPay.value = false;
showToast({
title: "支付取消",
icon: "none",
});
jfInfo.value = {};
getList();
};
const toDetail = (item: any) => {
setStorageSync("item", item);
navigateTo({
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
});
setStorageSync("item", item);
navigateTo({
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();
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",
});
}
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>
<view>
<view class="topTips">
<view>
<view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px"
>总消费积分{{ countInfo.Total || 0 }}
</view>
</view>
<image src="../static/user/order_list_top.png" />
<view>
<view class="topTips">
<view>
<view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px"
>总消费积分{{ countInfo.Total || 0 }}
</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>{{ item.num }}</view>
<view
class="line"
:class="{ lineColor: item.value === tabValue }"
></view>
</view>
</view>
<image src="../static/user/order_list_top.png" />
</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>{{ item.num }}</view>
<view
class="line"
:class="{ lineColor: item.value === tabValue }"
></view>
</view>
</view>
<view v-if="orderList.length > 0">
<view class="order-card" v-for="(item, index) in orderList" :key="index">
<view class="top">
<view>{{ item.add_time.slice(0, 19) }}</view>
<view style="color: red">{{
item.status === 0
? "待付款"
: item.status === 1
? "待使用"
: item.status === 2
? "已使用"
: "已失效"
}}</view>
</view>
<view v-if="orderList.length > 0">
<view
class="order-card"
v-for="(item, index) in orderList"
:key="index"
>
<view class="top">
<view>{{ item.add_time.slice(0, 19) }}</view>
<view style="color: red">{{
item.status === 0
? "待付款"
: item.status === 1
? "待使用"
: item.status === 2
? "已使用"
: "已失效"
}}</view>
</view>
<view class="line"></view>
<view class="center">
<view class="top">
<image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods?.name }} </view>
<view class="right">
<view>{{ item.BindGoods?.number }}</view>
<view>x{{ item?.count }}</view>
</view>
</view>
<!-- <view
<view class="line"></view>
<view class="center">
<view class="top">
<image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods?.name }} </view>
<view class="right">
<view>{{ item.BindGoods?.number }}</view>
<view>x{{ item?.count }}</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 class="line"></view>
<view class="btn">
<nut-button
v-if="item.status === 0"
plain
size="small"
type="primary"
@click="delOrder(item.oid)"
>取消订单
</nut-button>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
@click="toDetail(item)"
>查看详情
</nut-button>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
v-if="item.status === 0"
@click="openPay(item)"
>立即付款
</nut-button>
</view>
</view>
</view>
<nut-empty v-else description="暂无订单"></nut-empty>
<pay
:isShowPay="isShowPay"
payType="jf"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
<view class="line"></view>
<view class="btn">
<nut-button
v-if="item.status === 0"
plain
size="small"
type="primary"
@click="delOrder(item.oid)"
>取消订单
</nut-button>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
@click="toDetail(item)"
>查看详情
</nut-button>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
v-if="item.status === 0"
@click="openPay(item)"
>立即付款
</nut-button>
</view>
</view>
</view>
<nut-empty v-else description="暂无订单"></nut-empty>
<pay
:isShowPay="isShowPay"
payType="jf"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</view>
</template>
<style lang="scss">
.topTips {
box-sizing: border-box;
width: 100%;
background-color: #ff0000;
color: #ffffff;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
width: 100%;
background-color: #ff0000;
color: #ffffff;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
image {
width: 150px;
height: 150px;
}
image {
width: 150px;
height: 150px;
}
}
.tabs-box {
display: flex;
flex-direction: row;
justify-content: space-between;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: auto;
background-color: #fff;
padding: 0 20px;
text-align: center;
.text {
margin: 10px 20px;
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;
}
.line {
margin: 0 auto;
width: 50px;
height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.lineColor {
background-color: #ff0000;
}
.lineColor {
background-color: #ff0000;
}
}
.order-card {
width: 95%;
box-sizing: border-box;
margin: 15px auto;
background-color: #fff;
border-radius: 10px;
padding: 20px;
width: 95%;
box-sizing: border-box;
margin: 15px auto;
background-color: #fff;
border-radius: 10px;
padding: 20px;
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px;
}
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px;
}
.top {
display: flex;
justify-content: space-between;
align-items: center;
}
.btn {
display: flex;
justify-content: flex-end;
align-items: center;
}
.center {
.top {
display: flex;
justify-content: space-between;
align-items: center;
}
.btn {
display: flex;
justify-content: flex-end;
align-items: center;
}
.center {
.top {
display: flex;
justify-content: space-between;
// align-items: flex-start;
image {
width: 150px;
height: 150px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
}
}
display: flex;
justify-content: space-between;
// align-items: flex-start;
image {
width: 150px;
height: 150px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
}
}
}
}
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '订单详情'
})
navigationBarTitleText: "订单详情",
});

View File

@@ -1,433 +1,429 @@
<template>
<view>
<!-- 步骤条 -->
<view class="step-bar">
<view
class="item"
v-for="item in statusList"
:key="item.id"
:class="{ activation: item.id === goodInfo.status }"
>
<view class="text">{{ item.text }}</view>
<view class="dot"></view>
</view>
<view>
<!-- 步骤条 -->
<view class="step-bar">
<view
class="item"
v-for="item in statusList"
:key="item.id"
:class="{ activation: item.id === goodInfo.status }"
>
<view class="text">{{ item.text }}</view>
<view class="dot"></view>
</view>
</view>
<view v-if="goodInfo.status === 1" class="timeBox">
订单剩余{{ timeStr }}过期,请尽快核销
</view>
<!-- 商家信息 -->
<view class="mer-info">
<view class="left">
<view>
<text>{{ goodInfo.BindStore?.name }}</text>
<text>{{ goodInfo.BindStore?.phone }}</text>
</view>
<view v-if="goodInfo.status === 1" class="timeBox">
订单剩余{{ timeStr }}过期,请尽快核销
<nut-ellipsis
:rows="2"
:content="goodInfo.BindStore?.address"
direction="end"
></nut-ellipsis>
</view>
<view class="right">
<view class="icon" @click="toPhone">
<Service />
<text>电话</text>
</view>
<!-- 商家信息 -->
<view class="mer-info">
<view class="left">
<view>
<text>{{ goodInfo.BindStore?.name }}</text>
<text>{{ goodInfo.BindStore?.phone }}</text>
</view>
<nut-ellipsis
:rows="2"
:content="goodInfo.BindStore?.address"
direction="end"
></nut-ellipsis>
</view>
<view class="right">
<view class="icon" @click="toPhone">
<Service/>
<text>电话</text>
</view>
<view class="icon" @click="toAdder">
<Find/>
<text>导航</text>
</view>
</view>
<view class="icon" @click="toAdder">
<Find />
<text>导航</text>
</view>
</view>
</view>
<!-- 订单信息 -->
<nut-cell-group>
<nut-cell :title="`共${goodInfo.count}件商品`"></nut-cell>
<nut-cell>
<template #default>
<view class="top">
<image :src="goodInfo.BindGoods?.cover"/>
<view class="title"
>{{ goodInfo.BindGoods?.name }}
</view>
<view class="right">
<view>{{ goodInfo.BindGoods?.number }}</view>
<view>x{{ goodInfo.count }}</view>
</view>
</view>
</template>
</nut-cell>
<nut-cell title="订单号:" :desc="goodInfo.oid"></nut-cell>
<nut-cell
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="
goodInfo.status === 0
? '待付款'
: goodInfo.status === 1
? '待使用'
: goodInfo.status === 2
? '已使用'
: '已失效'
"
></nut-cell>
<nut-cell
:title="`商品总价(${type === '1' ? '元' : '积分'}):`"
:desc="goodInfo.number"
></nut-cell>
<nut-cell>
<template #default>
<view style="text-align: right; width: 100%">
<view
>{{
goodInfo.status === 0 ? '应付款' : '实付款'
}}({{ type === '1' ? '元' : '积分' }}):
<nut-price
:price="goodInfo.number"
size="normal"
:need-symbol="false"
/>
</view>
</view>
</template>
</nut-cell>
</nut-cell-group>
<view class="btn">
<!-- <nut-button
<!-- 订单信息 -->
<nut-cell-group>
<nut-cell :title="`共${goodInfo.count}件商品`"></nut-cell>
<nut-cell>
<template #default>
<view class="top">
<image :src="goodInfo.BindGoods?.cover" />
<view class="title">{{ goodInfo.BindGoods?.name }} </view>
<view class="right">
<view>{{ goodInfo.BindGoods?.number }}</view>
<view>x{{ goodInfo.count }}</view>
</view>
</view>
</template>
</nut-cell>
<nut-cell title="订单号:" :desc="goodInfo.oid"></nut-cell>
<nut-cell
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="
goodInfo.status === 0
? '待付款'
: goodInfo.status === 1
? '待使用'
: goodInfo.status === 2
? '已使用'
: '已失效'
"
></nut-cell>
<nut-cell
:title="`商品总价(${type === '1' ? '元' : '积分'}):`"
:desc="goodInfo.number"
></nut-cell>
<nut-cell>
<template #default>
<view style="text-align: right; width: 100%">
<view
>{{ goodInfo.status === 0 ? "应付款" : "实付款" }}({{
type === "1" ? "元" : "积分"
}}):
<nut-price
:price="goodInfo.number"
size="normal"
:need-symbol="false"
/>
</view>
</view>
</template>
</nut-cell>
</nut-cell-group>
<view class="btn">
<!-- <nut-button
plain
v-if="goodInfo.status === 0"
size="small"
type="primary"
>取消订单
</nut-button> -->
<nut-button
v-if="goodInfo.status === 0"
style="margin-left: 5px"
size="small"
type="primary"
@click="openPay()"
>立即付款
</nut-button>
<nut-button
v-if="goodInfo.status === 1"
style="margin-left: 5px"
size="small"
type="primary"
@click="openCode()"
>出示核销码
</nut-button>
</view>
<!-- 核销码弹窗 -->
<nut-popup
v-model:visible="isShowCode"
position="bottom"
:style="{ height: 'auto' }"
:maskClosable="true"
safe-area-inset-bottom
@closed="closed"
>
<view class="code-box">
<view>请出示核销码核销</view>
<image class="qrcode" :src="url"></image>
</view>
</nut-popup>
<pay
:isShowPay="isShowPay"
:payType="type === '1' ? 'wx' : 'jf'"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
<nut-button
v-if="goodInfo.status === 0"
style="margin-left: 5px"
size="small"
type="primary"
@click="openPay()"
>立即付款
</nut-button>
<nut-button
v-if="goodInfo.status === 1"
style="margin-left: 5px"
size="small"
type="primary"
@click="openCode()"
>出示核销码
</nut-button>
</view>
<!-- 核销码弹窗 -->
<nut-popup
v-model:visible="isShowCode"
position="bottom"
:style="{ height: 'auto' }"
:maskClosable="true"
safe-area-inset-bottom
@closed="closed"
>
<view class="code-box">
<view>请出示核销码核销</view>
<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>
<script setup lang="ts">
import Taro from '@tarojs/taro'
import {Find, Service} from '@nutui/icons-vue-taro'
import {ref} from 'vue'
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import Pay from '@/components/Pay.vue'
import Taro from "@tarojs/taro";
import { Find, Service } from "@nutui/icons-vue-taro";
import { ref } from "vue";
import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
import Pay from "@/components/Pay.vue";
dayjs.extend(duration)
dayjs.extend(duration);
const goodInfo = ref<any>({})
const goodInfo = ref<any>({});
const statusList = ref([
{
id: 0,
text: '待付款'
},
{
id: 1,
text: '待使用'
},
{
id: 2,
text: '已使用'
},
{
id: 3,
text: '已失效'
}
])
{
id: 0,
text: "待付款",
},
{
id: 1,
text: "待使用",
},
{
id: 2,
text: "已使用",
},
{
id: 3,
text: "已失效",
},
]);
const isShowCode = ref(false)
const isShowPay = ref(false)
const jfInfo = ref<any>({})
const isShowCode = ref(false);
const isShowPay = ref(false);
const jfInfo = ref<any>({});
const type = ref('')
const type = ref("");
const url = ref('')
const url = ref("");
Taro.useLoad((options) => {
type.value = options.type
goodInfo.value = Taro.getStorageSync('item')
if (goodInfo.value.status === 1) {
startTime()
}
})
type.value = options.type;
goodInfo.value = Taro.getStorageSync("item");
if (goodInfo.value.status === 1) {
startTime();
}
});
const toPhone = () => {
Taro.makePhoneCall({
phoneNumber: goodInfo.value.BindStore.mobile
})
}
Taro.makePhoneCall({
phoneNumber: goodInfo.value.BindStore.mobile,
});
};
const toAdder = () => {
Taro.openLocation({
latitude: Number(goodInfo.value.BindStore.lat),
longitude: Number(goodInfo.value.BindStore.lon),
scale: 18
})
}
Taro.openLocation({
latitude: Number(goodInfo.value.BindStore.lat),
longitude: Number(goodInfo.value.BindStore.lon),
scale: 18,
});
};
const openPay = () => {
isShowPay.value = true
jfInfo.value = Taro.getStorageSync('item')
}
isShowPay.value = true;
jfInfo.value = Taro.getStorageSync("item");
};
const errPay = () => {
isShowPay.value = false
Taro.showToast({
title: '支付失败',
icon: 'none'
})
jfInfo.value = {}
}
isShowPay.value = false;
Taro.showToast({
title: "支付失败",
icon: "none",
});
jfInfo.value = {};
};
const closePay = () => {
isShowPay.value = false
Taro.showToast({
title: '支付取消',
icon: 'none'
})
jfInfo.value = {}
}
isShowPay.value = false;
Taro.showToast({
title: "支付取消",
icon: "none",
});
jfInfo.value = {};
};
const openCode = () => {
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`
isShowCode.value = true
}
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`;
isShowCode.value = true;
};
const closed = () => {
isShowCode.value = false
url.value = ''
}
isShowCode.value = false;
url.value = "";
};
let timeId: any
let timeId: any;
const timeStr = ref('????')
const timeStr = ref("????");
const startTime = () => {
const nowTime = dayjs()
const endTime = dayjs(goodInfo.value.expires * 1000)
const nowTime = dayjs();
const endTime = dayjs(goodInfo.value.expires * 1000);
// 计算剩余时间的持续时间对象
const duration = dayjs.duration(endTime.diff(nowTime))
// 计算剩余时间的持续时间对象
const duration = dayjs.duration(endTime.diff(nowTime));
// 格式化剩余时间
timeStr.value = duration.format('D天H小时m分钟s秒')
// 格式化剩余时间
timeStr.value = duration.format("D天H小时m分钟s秒");
if (goodInfo.value.expires - dayjs().unix() > 0) {
clearInterval(timeId)
timeId = setTimeout(() => {
startTime()
}, 1000)
}
}
if (goodInfo.value.expires - dayjs().unix() > 0) {
clearInterval(timeId);
timeId = setTimeout(() => {
startTime();
}, 1000);
}
};
Taro.useUnload(() => {
clearTimeout(timeId)
})
clearTimeout(timeId);
});
</script>
<style lang="scss">
page {
height: 100vh;
box-sizing: border-box;
padding-bottom: 100px;
position: relative;
height: 100vh;
box-sizing: border-box;
padding-bottom: 100px;
position: relative;
}
.timeBox {
text-align: center;
font-weight: bold;
font-size: 30px;
padding: 30px;
text-align: center;
font-weight: bold;
font-size: 30px;
padding: 30px;
}
.step-bar {
width: 100%;
width: 100%;
height: 100px;
background: #fff;
display: flex;
.item {
width: 200px;
height: 100px;
background: #fff;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: small;
.item {
width: 200px;
height: 100px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: small;
.dot {
width: 25px;
height: 25px;
border-radius: 50%;
background: #cecece;
margin-top: 5px;
}
}
.dot {
width: 25px;
height: 25px;
border-radius: 50%;
background: #cecece;
margin-top: 5px;
}
.activation {
.text {
color: #ff0000;
}
.activation {
.text {
color: #ff0000;
}
.dot {
background: #ff0000;
position: relative;
.dot {
background: #ff0000;
position: relative;
&::before {
content: "";
width: 15px;
height: 15px;
border-radius: 50%;
background: #fff;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
&::before {
content: "";
width: 15px;
height: 15px;
border-radius: 50%;
background: #fff;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
}
}
.mer-info {
background-color: white;
padding: 20px 30px;
margin-top: 10px;
width: 100%;
box-sizing: border-box;
background-color: white;
padding: 20px 30px;
margin-top: 10px;
width: 100%;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
.left {
width: 50%;
text {
margin-right: 10px;
}
.address {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
display: -webkit-box;
-webkit-line-clamp: 1;
}
}
.right {
color: #858585;
text-align: center;
display: flex;
flex-direction: column;
height: 120px;
justify-content: space-between;
align-items: center;
.left {
width: 50%;
text {
margin-right: 10px;
}
.address {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
display: -webkit-box;
-webkit-line-clamp: 1;
}
}
.right {
color: #858585;
text-align: center;
display: flex;
flex-direction: column;
height: 120px;
justify-content: space-between;
.icon {
display: flex;
align-items: center;
//margin-bottom: 20px;
}
.icon {
display: flex;
align-items: center;
//margin-bottom: 20px;
}
}
}
.btn {
box-sizing: border-box;
background-color: #fff;
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20px;
box-sizing: border-box;
background-color: #fff;
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20px;
display: flex;
justify-content: flex-end;
align-items: flex-start;
display: flex;
justify-content: flex-end;
align-items: flex-start;
}
.top {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
image {
width: 150px;
height: 150px;
}
image {
width: 150px;
height: 150px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
}
}
.code-box {
padding: 20px;
box-sizing: border-box;
text-align: center;
font-size: large;
padding: 20px;
box-sizing: border-box;
text-align: center;
font-size: large;
}
.qrcode {
width: 300px;
height: 300px;
width: 300px;
height: 300px;
}
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '个人设置'
})
navigationBarTitleText: "个人设置",
});

View File

@@ -1,18 +1,22 @@
<script lang="ts" setup>
import Taro from '@tarojs/taro'
import Taro from "@tarojs/taro";
const toPage = (url: string) => {
if (url === '1') return Taro.showToast({title: '暂未开放', icon: 'none'})
if (url === "1") return Taro.showToast({ title: "暂未开放", icon: "none" });
Taro.navigateTo({
url: url
})
}
url: url,
});
};
</script>
<template>
<view class="app">
<nut-cell-group>
<nut-cell title="个人信息" is-link @click="toPage('/pages/users/user_setting/index')"></nut-cell>
<nut-cell
title="个人信息"
is-link
@click="toPage('/pages/users/user_setting/index')"
></nut-cell>
<nut-cell title="关于我们" is-link @click="toPage('1')"></nut-cell>
<nut-cell title="资质证明" is-link @click="toPage('1')"></nut-cell>
<nut-cell title="协议规则" is-link @click="toPage('1')"></nut-cell>
@@ -27,4 +31,4 @@ const toPage = (url: string) => {
height: 100vh;
background-color: #f5f5f5;
}
</style>
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '商户入驻',
})
navigationBarTitleText: "商户入驻",
});

View File

@@ -1,8 +1,8 @@
<script lang="ts" setup>
import Taro from '@tarojs/taro'
import {ref} from 'vue'
import {applyMer, getMerTypeList, getVerifyCode} from '@/api/user'
import Upload from '@/components/Upload.vue'
import Taro from "@tarojs/taro";
import { ref } from "vue";
import { applyMer, getMerTypeList, getVerifyCode } from "@/api/user";
import Upload from "@/components/Upload.vue";
const visible = ref(false);
@@ -18,24 +18,24 @@ const smsDisabled = ref(false);
// 表单数据
const formValue = ref<any>({
name: "",
userName: "",
phone: "",
code: "",
bType: "",
merTypeStr: "",
classId: "",
merGooTypeStr: "",
license: [],
front: [],
back: [],
head_photo: [],
img: [],
bank: "",
bank_card: "",
bank_name: "",
bank_user: "",
address: "",
name: "",
userName: "",
phone: "",
code: "",
bType: "",
merTypeStr: "",
classId: "",
merGooTypeStr: "",
license: [],
front: [],
back: [],
head_photo: [],
img: [],
bank: "",
bank_card: "",
bank_name: "",
bank_user: "",
address: "",
});
const merGooList = ref([]);
@@ -46,62 +46,62 @@ const merList = ref([]);
const ruleForm = ref<any>(null);
Taro.useLoad(() => {
getMerType();
getMerType();
});
// 获取商户类型
const getMerType = async () => {
try {
const res = await getMerTypeList();
console.log(res);
merList.value = res.data.type.map((item: any) => {
return {
text: item.name,
value: item.ID,
};
});
merGooList.value = res.data.class.map((item: any) => {
return {
text: item.name,
value: item.ID,
};
});
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
try {
const res = await getMerTypeList();
console.log(res);
merList.value = res.data.type.map((item: any) => {
return {
text: item.name,
value: item.ID,
};
});
merGooList.value = res.data.class.map((item: any) => {
return {
text: item.name,
value: item.ID,
};
});
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
};
// 关闭弹窗
const onOk = async () => {
try {
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).join(","),
};
const res = await applyMer(data);
Taro.showToast({
title: res.msg,
icon: "none",
});
setTimeout(() => {
Taro.switchTab({
url: "/pages/index/index",
});
}, 3000);
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
visible.value = false;
try {
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).join(","),
};
const res = await applyMer(data);
Taro.showToast({
title: res.msg,
icon: "none",
});
setTimeout(() => {
Taro.switchTab({
url: "/pages/index/index",
});
}, 3000);
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
visible.value = false;
};
// 打开弹窗
@@ -112,429 +112,429 @@ const onOk = async () => {
// 获取验证码
const getSmsCode = () => {
ruleForm.value.validate("phone").then(async ({ valid }: any) => {
if (valid) {
try {
await getVerifyCode({
phone: formValue.value.phone.toString(),
});
smsDisabled.value = true;
let time = 60;
const timer = setInterval(() => {
time--;
smsStr.value = `${time}s`;
if (time === 0) {
clearInterval(timer);
smsDisabled.value = false;
smsStr.value = "获取验证码";
}
}, 1000);
} catch (e) {
Taro.showToast({
title: e.message,
icon: "none",
});
}
}
});
ruleForm.value.validate("phone").then(async ({ valid }: any) => {
if (valid) {
try {
await getVerifyCode({
phone: formValue.value.phone.toString(),
});
smsDisabled.value = true;
let time = 60;
const timer = setInterval(() => {
time--;
smsStr.value = `${time}s`;
if (time === 0) {
clearInterval(timer);
smsDisabled.value = false;
smsStr.value = "获取验证码";
}
}, 1000);
} catch (e) {
Taro.showToast({
title: e.message,
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) => {
if (valid) {
console.log("success", formValue.value);
visible.value = true;
} else {
console.log("error submit!!", errors);
}
});
ruleForm.value.validate().then(({ valid, errors }: any) => {
if (valid) {
console.log("success", formValue.value);
visible.value = true;
} else {
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>
<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>
<nut-form-item
: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}$/,
},
]"
label="店铺号码"
prop="phone"
required
>
<input
v-model="formValue.mobile"
:maxlength="11"
placeholder="请输入店铺号码"
type="text"
/>
</nut-form-item>
<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"
>
{{ smsStr }}
</nut-button>
</view>
</nut-form-item>
<nut-form-item
required
label="店铺地址"
prop="address"
:rules="[
{
required: true,
message: '请输入店铺详细地址',
},
]"
>
<input
type="text"
v-model="formValue.address"
placeholder="请输入店铺详细地址"
/>
</nut-form-item>
<nut-form-item
required
label="法人"
prop="bank_user"
:rules="[
{
required: true,
message: '请输入法人',
},
]"
>
<input
type="text"
v-model="formValue.bank_user"
placeholder="请输入法人"
/>
</nut-form-item>
<nut-form-item
required
label="账户名称"
prop="bank_name"
:rules="[
{
required: true,
message: '请输入账户名称',
},
]"
>
<input
type="text"
v-model="formValue.bank_name"
placeholder="请输入账户名称"
/>
</nut-form-item>
<nut-form-item
required
label="开户银行"
prop="bank"
:rules="[
{
required: true,
message: '请输入银行名称',
},
]"
>
<input
type="text"
v-model="formValue.bank"
placeholder="请输入银行名称"
/>
</nut-form-item>
<nut-form-item
required
label="银行卡号"
prop="bank_card"
:rules="[
{
required: true,
message: '请输入银行卡号',
},
]"
>
<input
type="text"
v-model="formValue.bank_card"
placeholder="请输入银行卡号"
/>
</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-popup position="bottom" v-model:visible="merType">
<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-popup position="bottom" v-model:visible="merGooType">
<nut-picker
:columns="merGooList"
title="商户类型"
@confirm="confirmGooType"
@cancel="merGooType = false"
></nut-picker>
</nut-popup>
</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" multiple/>
</nut-form-item>
<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>
<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>
<nut-form-item
: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}$/,
},
]"
label="店铺号码"
prop="phone"
required
>
<input
v-model="formValue.mobile"
:maxlength="11"
placeholder="请输入店铺号码"
type="text"
/>
</nut-form-item>
<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"
>
{{ smsStr }}
</nut-button>
</view>
</nut-form-item>
<nut-form-item
required
label="店铺地址"
prop="address"
:rules="[
{
required: true,
message: '请输入店铺详细地址',
},
]"
>
<input
type="text"
v-model="formValue.address"
placeholder="请输入店铺详细地址"
/>
</nut-form-item>
<nut-form-item
required
label="法人"
prop="bank_user"
:rules="[
{
required: true,
message: '请输入法人',
},
]"
>
<input
type="text"
v-model="formValue.bank_user"
placeholder="请输入法人"
/>
</nut-form-item>
<nut-form-item
required
label="账户名称"
prop="bank_name"
:rules="[
{
required: true,
message: '请输入账户名称',
},
]"
>
<input
type="text"
v-model="formValue.bank_name"
placeholder="请输入账户名称"
/>
</nut-form-item>
<nut-form-item
required
label="开户银行"
prop="bank"
:rules="[
{
required: true,
message: '请输入银行名称',
},
]"
>
<input
type="text"
v-model="formValue.bank"
placeholder="请输入银行名称"
/>
</nut-form-item>
<nut-form-item
required
label="银行卡号"
prop="bank_card"
:rules="[
{
required: true,
message: '请输入银行卡号',
},
]"
>
<input
type="text"
v-model="formValue.bank_card"
placeholder="请输入银行卡号"
/>
</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-popup position="bottom" v-model:visible="merType">
<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-popup position="bottom" v-model:visible="merGooType">
<nut-picker
:columns="merGooList"
title="商户类型"
@confirm="confirmGooType"
@cancel="merGooType = false"
></nut-picker>
</nut-popup>
</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" multiple />
</nut-form-item>
<view class="btn">
<nut-button block type="primary" round @click="submit()"
>提交</nut-button
>
</view>
</nut-form>
<!-- 入驻协议弹窗 -->
<nut-dialog
no-cancel-btn
title="入驻协议"
ok-text="已阅读并且同意"
v-model:visible="visible"
@ok="onOk"
<view class="btn">
<nut-button block type="primary" round @click="submit()"
>提交</nut-button
>
<view>入驻协议</view>
</nut-dialog>
</view>
</view>
</nut-form>
<!-- 入驻协议弹窗 -->
<nut-dialog
no-cancel-btn
title="入驻协议"
ok-text="已阅读并且同意"
v-model:visible="visible"
@ok="onOk"
>
<view>入驻协议</view>
</nut-dialog>
</view>
</template>
<style lang="scss">
page {
background-image: url("~@/static/merchantBg.jpg");
background-size: 100%;
background-color: #e93423;
background-repeat: no-repeat;
background-image: url("~@/static/merchantBg.jpg");
background-size: 100%;
background-color: #e93423;
background-repeat: no-repeat;
}
.form {
position: relative;
top: 200px;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
position: relative;
top: 200px;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.btn {
padding: 20px;
margin-top: 20px;
text-align: center;
}
.btn {
padding: 20px;
margin-top: 20px;
text-align: center;
}
}
.yanCode {
display: flex;
justify-content: space-between;
align-items: center;
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '个人资料',
})
navigationBarTitleText: "个人资料",
});

View File

@@ -10,210 +10,200 @@ import { BASE_URL } from "@/utils/request";
const userInfo = ref<any>({});
Taro.useLoad(() => {
const data = Taro.getStorageSync("userInfo");
userInfo.value = data;
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.removeStorageSync("mer_type");
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.removeStorageSync("mer_type");
Taro.reLaunch({
url: "/pages/index/index",
});
} else if (res.cancel) {
console.log("用户点击取消");
}
},
});
};
const chooseavatar = (e: any) => {
Taro.uploadFile({
url: `${BASE_URL}/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;
},
});
Taro.uploadFile({
url: `${BASE_URL}/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",
});
}
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",
});
}
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>
<!-- {{ 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 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 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 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;
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;
position: relative;
.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;
.left {
margin-left: 10px;
display: flex;
align-items: center;
position: relative;
justify-content: space-between;
.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%;
}
}
.name {
margin-left: 10px;
}
.nut-button {
margin: 0 auto;
width: 125px;
height: 125px;
border-radius: 50%;
}
}
}
}
.btn {
padding: 0 40px;
margin-bottom: 20px;
padding: 0 40px;
margin-bottom: 20px;
}
.nut-input {
width: 400px !important;
padding: 0 !important;
width: 400px !important;
padding: 0 !important;
}
.nut-cell {
display: flex;
align-items: center;
display: flex;
align-items: center;
}
.phoneBtn {
padding: 0 !important;
margin: 0 !important;
border-radius: 0 !important;
background-color: transparent !important;
border: none !important;
padding: 0 !important;
margin: 0 !important;
border-radius: 0 !important;
background-color: transparent !important;
border: none !important;
}
</style>