wupengfei
6 小时以前 47047d626ea8fab28c04e6534fe6ffa3dc61de69
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
<template>
  <ContentScrollView :paddingH="false">
    <nut-form :model-value="form" ref="formRef" :rules="rules">
      <nut-form-item class="bole-form-item" prop="reason">
        <nut-textarea v-model="form.reason" rows="4" placeholder="请输入"> </nut-textarea>
      </nut-form-item>
    </nut-form>
  </ContentScrollView>
  <PageFooter>
    <PageFooterBtn type="primary" @click="handleConfirm">提交</PageFooterBtn>
  </PageFooter>
</template>
 
<script setup lang="ts">
import Taro from '@tarojs/taro';
import * as standardOrderServices from '@12333/services/apiV2/standardOrder';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { Message } from '@12333/utils';
import { goBack } from '@/utils';
 
defineOptions({
  name: 'InnerPage',
});
 
const route = Taro.useRouter();
const id = route.params?.id as string;
 
const form = reactive({
  reason: '',
});
 
const rules = reactive<FormRules>({
  reason: [{ required: true, message: '请输入取消原因' }],
});
 
const formRef = ref<any>(null);
function handleConfirm() {
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      confirm();
    }
  });
}
 
async function confirm() {
  try {
    let params: API.CancelStandardOrderAppointmentCommand = {
      id: id,
      appointmentCancelReason: form.reason,
    };
    let res = await standardOrderServices.cancelStandardOrderAppointment(params);
    if (res) {
      Message.success('操作成功', {
        onClosed() {
          goBack();
        },
      });
    }
  } catch (error) {}
}
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
</style>