wupengfei
2025-03-13 186234cb3833e620aa0ae46212fe337eb2d6e77d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<template>
  <PageLayout title="投诉举报" class="cooperation-page-wrapper" hasBorder :needAuth="false">
    <ContentScrollView :paddingH="false">
      <nut-form :model-value="form" ref="formRef" :rules="rules">
        <nut-form-item label="企业名称:" class="bole-form-item" prop="companyName" required>
          <nut-input
            v-model.trim="form.companyName"
            class="nut-input-text bole-input-text"
            placeholder="请输入企业名称"
            type="text"
            :max-length="35"
            show-word-limit
          />
        </nut-form-item>
        <nut-form-item label="联系人:" class="bole-form-item" prop="contact" required>
          <nut-input
            v-model.trim="form.contact"
            class="nut-input-text bole-input-text"
            placeholder="请输入联系人姓名"
            type="text"
            :max-length="10"
            show-word-limit
          />
        </nut-form-item>
        <nut-form-item label="联系电话:" class="bole-form-item" prop="contactPhone" required>
          <nut-input
            v-model.trim="form.contactPhone"
            class="nut-input-text bole-input-text"
            placeholder="请输入联系人电话"
            type="text"
          />
        </nut-form-item>
        <nut-form-item label="投诉说明:" class="bole-form-item alignTop" prop="remark" required>
          <nut-textarea
            placeholder="请输入举报投诉的说明"
            placeholderClass="bole-input-text-placeholder"
            autoSize
            class="bole-input-textarea"
            v-model="form.remark"
            :max-length="500"
            show-word-limit
          >
          </nut-textarea>
        </nut-form-item>
      </nut-form>
    </ContentScrollView>
    <PageFooter :isOnlyAction="false">
      <PageFooterBtn type="primary" @click="handleConfirm">提交</PageFooterBtn>
    </PageFooter>
  </PageLayout>
</template>
 
<script setup lang="ts">
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
// import * as cooperationApplyServices from '@12333/services/api/CooperationApply';
import { CooperateTypeText, CooperateApplyTypeEnum } from '@12333/constants';
import { FormValidator, Message } from '@12333/utils';
import Taro from '@tarojs/taro';
import { useUser } from '@/hooks';
 
defineOptions({
  name: 'complaint',
});
 
const { userDetail } = useUser();
 
const form = reactive({
  companyName: userDetail.value?.customerName ?? '',
  contact: userDetail.value?.contacter ?? '',
  contactPhone: userDetail.value?.phoneNumber ?? '',
  remark: '',
});
 
const rules = reactive<FormRules>({
  companyName: [{ required: true, message: '请输入企业名称' }],
  contact: [{ required: true, message: '请输入联系人姓名' }],
  contactPhone: [
    { required: true, message: '请输入联系电话' },
    { message: '请输入正确的联系电话', validator: FormValidator.validatorTelNumber },
  ],
  remark: [{ required: true, message: '请输入举报投诉的说明' }],
});
 
const formRef = ref<any>(null);
 
function handleConfirm() {
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      createPlatformCooperationApply();
    }
  });
}
 
async function createPlatformCooperationApply() {
  try {
    // let params: API.CreatePlatformCooperationApplyInput = {
    //   title: CooperateTypeText.Complaint,
    //   contact: form.contact,
    //   contactPhone: form.contactPhone,
    //   applyDescription: form.remark,
    //   companyName: form.companyName,
    //   applyType: CooperateApplyTypeEnum.Complaint,
    // };
    // let res = await cooperationApplyServices.createPlatformCooperationApply(params);
    // if (res) {
    //   await Message.confirm({
    //     message: '信息已提交,请耐心等待工作人员的联系',
    //   });
    //   Taro.navigateBack({
    //     delta: 1,
    //   });
    // }
  } catch (error) {}
}
</script>