|
|
@@ -1,6 +1,18 @@
|
|
|
<script lang="ts" setup>
|
|
|
-import { reactive, ref } from 'vue'
|
|
|
-import { useUserStore } from '@/store'
|
|
|
+import {
|
|
|
+ useRequest
|
|
|
+} from 'alova/client'
|
|
|
+import {
|
|
|
+ reactive,
|
|
|
+ ref
|
|
|
+} from 'vue'
|
|
|
+import {
|
|
|
+ couponIssuerApplyByAdd,
|
|
|
+ getCouponIssuerApplyById
|
|
|
+} from '@/api/me'
|
|
|
+import {
|
|
|
+ useUserStore
|
|
|
+} from '@/store'
|
|
|
|
|
|
definePage({
|
|
|
style: {
|
|
|
@@ -10,11 +22,11 @@ definePage({
|
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
|
-const model = reactive({
|
|
|
+let model = reactive({
|
|
|
name: '',
|
|
|
phone: '',
|
|
|
- result: '',
|
|
|
- description: '',
|
|
|
+ status: '0',
|
|
|
+ auditRemark: '',
|
|
|
})
|
|
|
const rules = reactive({
|
|
|
name: {
|
|
|
@@ -31,16 +43,51 @@ const rules = reactive({
|
|
|
trigger: ['blur', 'change'],
|
|
|
},
|
|
|
})
|
|
|
+// 发卷人查询审核状态
|
|
|
+const {
|
|
|
+ send: getCouponIssuerApplyByIdRequest,
|
|
|
+ data: couponIssuerApplyByIdData,
|
|
|
+} = useRequest(getCouponIssuerApplyById, {
|
|
|
+ immediate: false,
|
|
|
+})
|
|
|
+const formResult = ref(null)
|
|
|
+onLoad(async (options) => {
|
|
|
+ await getCouponIssuerApplyByIdRequest()
|
|
|
+ console.log(999999, couponIssuerApplyByIdData.value.status)
|
|
|
+ if (couponIssuerApplyByIdData.value && couponIssuerApplyByIdData.value.status === '1') {
|
|
|
+ formResult.value = couponIssuerApplyByIdData.value
|
|
|
+ model = couponIssuerApplyByIdData.value
|
|
|
+ }
|
|
|
+})
|
|
|
|
|
|
// 使用 ref 创建响应式引用
|
|
|
const uFormRef = ref(null)
|
|
|
|
|
|
+// 发劵人审核-添加
|
|
|
+const {
|
|
|
+ send: couponIssuerApplyByAddRequest,
|
|
|
+ data: couponIssuerApplyByAddData,
|
|
|
+} = useRequest(couponIssuerApplyByAdd, {
|
|
|
+ immediate: false,
|
|
|
+})
|
|
|
+
|
|
|
function submitForm() {
|
|
|
uFormRef.value.validate().then((valid) => {
|
|
|
if (valid) {
|
|
|
- uni.$u.toast('校验通过')
|
|
|
+ const couponIssuerApplyByAddForm = {
|
|
|
+ name: model.name,
|
|
|
+ phone: model.phone,
|
|
|
+ }
|
|
|
+ couponIssuerApplyByAddRequest(couponIssuerApplyByAddForm).then(() => {
|
|
|
+ // 返回上一页
|
|
|
+ console.log('提交成功:', couponIssuerApplyByAddData)
|
|
|
+ uni.$u.toast('校验通过')
|
|
|
+ uni.navigateBack()
|
|
|
+ }).catch(() => {
|
|
|
+ uni.$u.toast('校验失败')
|
|
|
+ })
|
|
|
}
|
|
|
- else {
|
|
|
+ else {
|
|
|
uni.$u.toast('校验失败')
|
|
|
}
|
|
|
}).catch(() => {
|
|
|
@@ -53,65 +100,29 @@ function submitForm() {
|
|
|
<template>
|
|
|
<view class="form-container">
|
|
|
<view class="form-wrapper">
|
|
|
- <u-form
|
|
|
- ref="uFormRef"
|
|
|
- label-position="left"
|
|
|
- :model="model"
|
|
|
- :rules="rules"
|
|
|
- >
|
|
|
- <u-form-item
|
|
|
- ref="item1"
|
|
|
- label="申请人姓名"
|
|
|
- prop="name"
|
|
|
- :border-bottom="true"
|
|
|
- >
|
|
|
- <u-input
|
|
|
- v-model="model.name"
|
|
|
- border="none"
|
|
|
- placeholder="请输入申请人姓名"
|
|
|
- />
|
|
|
+ <u-form ref="uFormRef" label-position="left" :model="model" :rules="rules">
|
|
|
+ <u-form-item ref="item1" label="申请人姓名" prop="name" :border-bottom="true">
|
|
|
+ <u-input v-model="model.name" border="none" placeholder="请输入申请人姓名" />
|
|
|
</u-form-item>
|
|
|
- <u-form-item
|
|
|
- ref="item2"
|
|
|
- label="电话"
|
|
|
- prop="phone"
|
|
|
- :border-bottom="true"
|
|
|
- >
|
|
|
- <u-input
|
|
|
- v-model="model.phone"
|
|
|
- border="none"
|
|
|
- placeholder="请输入小程序登录的手机号"
|
|
|
- />
|
|
|
+ <u-form-item ref="item2" label="电话" prop="phone" :border-bottom="true">
|
|
|
+ <u-input v-model="model.phone" border="none" placeholder="请输入小程序登录的手机号" />
|
|
|
</u-form-item>
|
|
|
- <u-form-item
|
|
|
- ref="item3"
|
|
|
- label="申请结果"
|
|
|
- :border-bottom="true"
|
|
|
- >
|
|
|
- <view class="form-item-result u-text-danger">
|
|
|
+ <u-form-item v-if="formResult" ref="item3" label="申请结果" :border-bottom="true">
|
|
|
+ <view v-if="formResult.status === '2'" class="form-item-result u-text-danger">
|
|
|
已拒绝
|
|
|
</view>
|
|
|
- <view class="form-item-result u-text-success">
|
|
|
+ <view v-else class="form-item-result u-text-success">
|
|
|
已通过
|
|
|
</view>
|
|
|
</u-form-item>
|
|
|
- <view class="form-item-des">
|
|
|
- <u-form-item
|
|
|
- ref="item4"
|
|
|
- label="拒绝说明"
|
|
|
- :border-bottom="true"
|
|
|
- >
|
|
|
- <u-textarea
|
|
|
- v-model="model.description"
|
|
|
- placeholder="此处显示拒绝说明"
|
|
|
- border="none"
|
|
|
- disabled
|
|
|
- />
|
|
|
+ <view v-if="formResult && formResult.status === '2'" class="form-item-des">
|
|
|
+ <u-form-item ref="item4" label="拒绝说明" :border-bottom="true">
|
|
|
+ <u-textarea v-model="model.auditRemark" placeholder="此处显示拒绝说明" border="none" disabled />
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
</u-form>
|
|
|
|
|
|
- <view class="form-btn" @click="submitForm">
|
|
|
+ <view v-if="formResult && formResult.status !== '1'" class="form-btn" @click="submitForm">
|
|
|
提交申请
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -125,14 +136,17 @@ function submitForm() {
|
|
|
font-size: 26rpx !important;
|
|
|
color: #333333 !important;
|
|
|
}
|
|
|
+
|
|
|
::v-deep .u-input__content__field-wrapper__field {
|
|
|
text-align: right !important;
|
|
|
}
|
|
|
+
|
|
|
::v-deep .u-form-item__body__left__content__label {
|
|
|
color: #333333 !important;
|
|
|
font-size: 26rpx !important;
|
|
|
font-weight: 400 !important;
|
|
|
}
|
|
|
+
|
|
|
::v-deep .u-line {
|
|
|
border-color: #eeeeee !important;
|
|
|
}
|
|
|
@@ -141,6 +155,7 @@ function submitForm() {
|
|
|
display: flex;
|
|
|
justify-content: flex-end;
|
|
|
}
|
|
|
+
|
|
|
.form-container {
|
|
|
background-color: #f5f5f5;
|
|
|
min-height: 100vh;
|
|
|
@@ -159,10 +174,12 @@ function submitForm() {
|
|
|
line-height: 44rpx;
|
|
|
border-radius: 10rpx;
|
|
|
text-align: center;
|
|
|
+
|
|
|
&.u-text-danger {
|
|
|
color: #ff3333;
|
|
|
background: rgba(#ff7171, 0.2);
|
|
|
}
|
|
|
+
|
|
|
&.u-text-success {
|
|
|
color: #64a6ff;
|
|
|
background: rgba(#64a6ff, 0.2);
|