i
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '我的账户'
|
||||
})
|
||||
@@ -1,15 +1,73 @@
|
||||
<script lang="ts">
|
||||
import {defineComponent} from 'vue'
|
||||
<script lang="ts" setup>
|
||||
|
||||
export default defineComponent({
|
||||
name: "index"
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
$END$
|
||||
<view>
|
||||
<view class="card">
|
||||
<view class="greeting">Hello! YuanHuakk</view>
|
||||
<view class="info">
|
||||
<view class="left">
|
||||
<view>
|
||||
<view class="num">豆子:188888</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="num">积分:188888</view>
|
||||
</view>
|
||||
</view>
|
||||
<image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
<style lang="scss">
|
||||
page {
|
||||
//background-color: #111;
|
||||
}
|
||||
|
||||
.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;
|
||||
|
||||
.greeting {
|
||||
font-size: 35px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
height: 300px;
|
||||
width: 50%;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.num {
|
||||
font-size: 40px;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 380px;
|
||||
height: 270px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,14 @@
|
||||
<script lang="ts" setup>
|
||||
import {ref} from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import Pay from "../../../components/Pay.vue";
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
useLoad,
|
||||
useReachBottom,
|
||||
showToast,
|
||||
navigateTo,
|
||||
setStorageSync,
|
||||
} from "@tarojs/taro";
|
||||
import Pay from "@/components/Pay.vue";
|
||||
import { getIntegralOrderList } from "@/api/user";
|
||||
|
||||
const tabValue = ref(0);
|
||||
|
||||
@@ -35,38 +42,79 @@ const tabsList = ref([
|
||||
},
|
||||
]);
|
||||
|
||||
const orderList = ref([{}]);
|
||||
const jfInfo = ref({});
|
||||
|
||||
Taro.useLoad((options) => {
|
||||
interface OrderList {
|
||||
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);
|
||||
getList();
|
||||
});
|
||||
|
||||
const getList = async () => {
|
||||
try {
|
||||
const res = await getIntegralOrderList({
|
||||
status: tabValue.value,
|
||||
});
|
||||
console.log(res);
|
||||
orderList.value = res.data.data;
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const tabChange = (index: number) => {
|
||||
tabValue.value = index;
|
||||
getList();
|
||||
};
|
||||
|
||||
Taro.useReachBottom(() => {
|
||||
useReachBottom(() => {
|
||||
console.log("useReachBottom");
|
||||
});
|
||||
|
||||
const openPay = () => {
|
||||
console.log("openPay");
|
||||
const openPay = (item: OrderList) => {
|
||||
console.log("openPay", item);
|
||||
isShowPay.value = true;
|
||||
jfInfo.value = item;
|
||||
};
|
||||
|
||||
const errPay = () => {
|
||||
isShowPay.value = false;
|
||||
Taro.showToast({
|
||||
showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
};
|
||||
const closePay = () => {
|
||||
isShowPay.value = false;
|
||||
Taro.showToast({
|
||||
showToast({
|
||||
title: "支付取消",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
};
|
||||
|
||||
const toDetail = (item: any) => {
|
||||
setStorageSync("item", item);
|
||||
navigateTo({
|
||||
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -76,11 +124,10 @@ const closePay = () => {
|
||||
<view>
|
||||
<view style="font-weight: bold">订单信息</view>
|
||||
<view style="font-size: 15px"
|
||||
>消费订单:{{ 10 || 0 }} 总消费积分:{{ 12312 || 0 }}
|
||||
</view
|
||||
>
|
||||
>消费订单:{{ 10 || 0 }} 总消费积分:{{ 12312 || 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<image src="../static/user/order_list_top.png"/>
|
||||
<image src="../static/user/order_list_top.png" />
|
||||
</view>
|
||||
<view class="tabs-box">
|
||||
<view
|
||||
@@ -97,80 +144,80 @@ const closePay = () => {
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="orderList.length > 0">
|
||||
<view class="order-card" v-for="item in 10" :key="item">
|
||||
<view
|
||||
class="order-card"
|
||||
v-for="(item, index) in orderList"
|
||||
:key="index"
|
||||
>
|
||||
<view class="top">
|
||||
<view>2023-08-14 14:24:23</view>
|
||||
<view style="color: red">待付款</view>
|
||||
<view>{{ item.add_time.slice(0, 19) }}</view>
|
||||
<view style="color: red">{{
|
||||
item.status === 1
|
||||
? "待付款"
|
||||
: item.status === 2
|
||||
? "待使用"
|
||||
: item.status === 3
|
||||
? "已使用"
|
||||
: "已失效"
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="center">
|
||||
<view class="top">
|
||||
<image src="../static/user/order_list_top.png"/>
|
||||
<view class="title"
|
||||
>商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称
|
||||
</view
|
||||
>
|
||||
<image :src="item.BindGoods.cover" />
|
||||
<view class="title">{{ item.BindGoods.name }} </view>
|
||||
<view class="right">
|
||||
<view>123.00</view>
|
||||
<view>x1</view>
|
||||
<view>{{ item.BindGoods.number }}</view>
|
||||
<view>x{{ item.count }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="bom"
|
||||
style="text-align: right; font-size: 13px"
|
||||
>
|
||||
共10件商品,实付积分:
|
||||
<text style="color: red"
|
||||
>123.00
|
||||
</text
|
||||
>
|
||||
共{{ item.count }}件商品,实付积分:
|
||||
<text style="color: red">{{ item.number }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="btn">
|
||||
<nut-button plain size="small" type="primary"
|
||||
>取消订单
|
||||
</nut-button
|
||||
>
|
||||
<nut-button
|
||||
v-if="item.status === 0"
|
||||
plain
|
||||
size="small"
|
||||
type="primary"
|
||||
>取消订单
|
||||
</nut-button>
|
||||
<nut-button
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
type="primary"
|
||||
>查看详情
|
||||
</nut-button
|
||||
>
|
||||
@click="toDetail(item)"
|
||||
>查看详情
|
||||
</nut-button>
|
||||
<nut-button
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="openPay()"
|
||||
>立即付款
|
||||
</nut-button
|
||||
>
|
||||
v-if="item.status === 0"
|
||||
@click="openPay(item)"
|
||||
>立即付款
|
||||
</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无订单"></nut-empty>
|
||||
<pay
|
||||
:isShowPay="isShowPay"
|
||||
payType="wx"
|
||||
payType="jf"
|
||||
@errPay="errPay"
|
||||
@closePay="closePay"
|
||||
:jfInfo="jfInfo"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
scroll-view {
|
||||
// IOS安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.topTips {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
@@ -246,7 +293,7 @@ scroll-view {
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
// align-items: flex-start;
|
||||
|
||||
image {
|
||||
width: 150px;
|
||||
|
||||
@@ -1,7 +1,354 @@
|
||||
<template>
|
||||
<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 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>
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<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
|
||||
title="支付状态:"
|
||||
:desc="
|
||||
goodInfo.status === 0
|
||||
? '待付款'
|
||||
: goodInfo.status === 1
|
||||
? '待使用'
|
||||
: goodInfo.status === 2
|
||||
? '已使用'
|
||||
: '已失效'
|
||||
"
|
||||
></nut-cell>
|
||||
<nut-cell
|
||||
title="商品总价(积分):"
|
||||
:desc="goodInfo.number"
|
||||
></nut-cell>
|
||||
<nut-cell>
|
||||
<template #default>
|
||||
<view style="text-align: right; width: 100%">
|
||||
<view
|
||||
>实付款(积分):
|
||||
<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>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
useLoad,
|
||||
getStorageSync,
|
||||
makePhoneCall,
|
||||
openLocation,
|
||||
} from "@tarojs/taro";
|
||||
import { Service, Find } from "@nutui/icons-vue-taro";
|
||||
import { ref } from "vue";
|
||||
|
||||
<style lang="scss"></style>
|
||||
const goodInfo = ref<any>({});
|
||||
|
||||
const statusList = ref([
|
||||
{
|
||||
id: 0,
|
||||
text: "待付款",
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
text: "待使用",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
text: "已使用",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
text: "已失效",
|
||||
},
|
||||
]);
|
||||
|
||||
const isShowCode = ref(false);
|
||||
|
||||
const url = ref("");
|
||||
|
||||
useLoad((options) => {
|
||||
console.log("options", options);
|
||||
goodInfo.value = getStorageSync("item");
|
||||
});
|
||||
|
||||
const toPhone = () => {
|
||||
makePhoneCall({
|
||||
phoneNumber: goodInfo.value.BindStore.phone,
|
||||
});
|
||||
};
|
||||
|
||||
const toAdder = () => {
|
||||
openLocation({
|
||||
latitude: Number(goodInfo.value.BindStore.lat),
|
||||
longitude: Number(goodInfo.value.BindStore.lon),
|
||||
scale: 18,
|
||||
});
|
||||
};
|
||||
|
||||
const openPay = () => {};
|
||||
|
||||
const openCode = () => {
|
||||
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`;
|
||||
isShowCode.value = true;
|
||||
};
|
||||
|
||||
const closed = () => {
|
||||
isShowCode.value = false;
|
||||
url.value = "";
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 100px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.step-bar {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
.activation {
|
||||
.text {
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
.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%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mer-info {
|
||||
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;
|
||||
|
||||
.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;
|
||||
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.top {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
.code-box {
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
.qrcode {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '申请商户',
|
||||
navigationBarTitleText: '商户入驻',
|
||||
})
|
||||
@@ -1,160 +1,250 @@
|
||||
<script lang="ts" setup>
|
||||
import {reactive, ref} from "vue";
|
||||
import Taro from '@tarojs/taro'
|
||||
import {ref} from 'vue'
|
||||
import {getVerifyCode, applyMer, getMerTypeList} from '@/api/user'
|
||||
|
||||
const basicData = reactive({
|
||||
name: '',
|
||||
age: '',
|
||||
tel: '',
|
||||
address: ''
|
||||
});
|
||||
const visible = ref(false)
|
||||
|
||||
const visible = ref(false);
|
||||
const merType = ref(false);
|
||||
const merGooType = ref(false);
|
||||
const merType = ref(false)
|
||||
|
||||
|
||||
const merGooType = ref(false)
|
||||
|
||||
// 验证码按钮文字
|
||||
const smsStr = ref('获取验证码')
|
||||
|
||||
// 验证码按钮是否禁用
|
||||
const smsDisabled = ref(false)
|
||||
|
||||
// 表单数据
|
||||
const formValue = ref({
|
||||
merName: '',
|
||||
name: '',
|
||||
phone: '',
|
||||
merType: '',
|
||||
merTypeStr: '',
|
||||
merGooType: '',
|
||||
merGooTypeStr: '',
|
||||
});
|
||||
name: '',
|
||||
userName: '',
|
||||
phone: '',
|
||||
code: '',
|
||||
bType: '',
|
||||
merTypeStr: '',
|
||||
classId: '',
|
||||
merGooTypeStr: ''
|
||||
})
|
||||
|
||||
const ruleForm = ref<any>(null);
|
||||
const merGooList = ref([])
|
||||
|
||||
const onOk = () => {
|
||||
visible.value = false;
|
||||
const merList = ref([])
|
||||
|
||||
};
|
||||
// 表单校验
|
||||
const ruleForm = ref<any>(null)
|
||||
|
||||
const open = () => {
|
||||
console.log('open');
|
||||
visible.value = true;
|
||||
};
|
||||
Taro.useLoad(() => {
|
||||
getMerType()
|
||||
})
|
||||
|
||||
const confirmMerType = (e: any) => {
|
||||
formValue.value.merTypeStr = e.selectedOptions[0].text;
|
||||
formValue.value.merType = e.selectedOptions[0].value;
|
||||
merType.value = false;
|
||||
}
|
||||
const confirmGooType = (e: any) => {
|
||||
formValue.value.merGooTypeStr = e.selectedOptions[0].text;
|
||||
formValue.value.merGooType = 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);
|
||||
// 获取商户类型
|
||||
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'
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const onOk = async () => {
|
||||
try {
|
||||
const res = await applyMer(formValue.value)
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
visible.value = false
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const open = () => {
|
||||
console.log('open')
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
// 获取验证码
|
||||
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 = 10
|
||||
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
|
||||
}
|
||||
|
||||
// 选择经营类目
|
||||
const confirmGooType = (e: any) => {
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="appBg">
|
||||
<nut-form ref="ruleForm" class="form" :model-value="formValue">
|
||||
<nut-form-item required label="商户名称" prop="merName" :rules="[{
|
||||
<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.merName" placeholder="请输入商户名称"/>
|
||||
</nut-form-item>
|
||||
<nut-form-item required label="用户姓名" prop="name" :rules="[{
|
||||
<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.name" placeholder="请输入真实姓名"/>
|
||||
</nut-form-item>
|
||||
<nut-form-item required label="联系电话" prop="phone" :rules="[{
|
||||
<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="number" :maxlength="11" v-model="formValue.phone" placeholder="请输入联系电话"/>
|
||||
</nut-form-item>
|
||||
<nut-form-item required label="商户类型" prop="merTypeStr" :rules="[{
|
||||
<input type="text" :maxlength="11" v-model="formValue.phone" placeholder="请输入联系电话"/>
|
||||
</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="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="[{
|
||||
text: '供应商',
|
||||
value: '1'
|
||||
},{
|
||||
text: '兑换商',
|
||||
value: '2'
|
||||
}]" title="商户类型" @confirm="confirmMerType" @cancel="merType = false"></nut-picker>
|
||||
</nut-popup>
|
||||
</nut-form-item>
|
||||
<nut-form-item required label="经营类目" prop="merGooTypeStr" :rules="[{
|
||||
<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="[{
|
||||
text: '酒吧',
|
||||
value: '1'
|
||||
},{
|
||||
text: 'KTV',
|
||||
value: '2'
|
||||
},{
|
||||
text: '餐饮',
|
||||
value: '2'
|
||||
},{
|
||||
text: '娱乐',
|
||||
value: '4'
|
||||
},{
|
||||
text: '其他',
|
||||
value: '5'
|
||||
}]" title="商户类型" @confirm="confirmGooType" @cancel="merGooType = false"></nut-picker>
|
||||
</nut-popup>
|
||||
</nut-form-item>
|
||||
<view class="btn">
|
||||
<nut-button block type="primary" round @click="submit()">提交</nut-button>
|
||||
</view>
|
||||
<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 label="资质上传" prop="img">-->
|
||||
<!-- <nut-uploader url="www.baidu.com"></nut-uploader>-->
|
||||
<!-- </nut-form-item>-->
|
||||
|
||||
</nut-form>
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<nut-dialog
|
||||
no-cancel-btn
|
||||
title="入驻协议"
|
||||
ok-text="已阅读并且同意"
|
||||
v-model:visible="visible"
|
||||
@ok="onOk"
|
||||
>
|
||||
<view>入驻协议</view>
|
||||
</nut-dialog>
|
||||
</view>
|
||||
<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>入驻协议</view>
|
||||
</nut-dialog>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.appBg {
|
||||
background-image: url("../../../static/merchantBg.jpg");
|
||||
background-size: 100%;
|
||||
background-color: #E93423;
|
||||
height: 100vh;
|
||||
background-repeat: no-repeat;
|
||||
page {
|
||||
background-image: url("~@/static/merchantBg.jpg");
|
||||
background-size: 100%;
|
||||
background-color: #E93423;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.form {
|
||||
|
||||
.form {
|
||||
position: relative;
|
||||
top: 300px;
|
||||
|
||||
.btn {
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.yanCode {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user