|
|
@@ -3,39 +3,34 @@
|
|
|
<app-modal direction="right" height="100%" v-model:show="showModal" :refresh="refresh">
|
|
|
<app-view class="g-form">
|
|
|
<template #header>
|
|
|
- <app-navbar title="信息修改" @back="closed" />
|
|
|
+ <app-navbar :title="selectedRow.buyorsell === 0 ? '买方信息' : '卖方信息'" @back="closed" />
|
|
|
</template>
|
|
|
<Form ref="formRef" class="g-form__container" @submit="formSubmit">
|
|
|
<CellGroup title="履约信息">
|
|
|
- <Field name="ContactInfo" v-model="formData.ContactInfo" autosize label="联络信息" type="textarea"
|
|
|
- placeholder="请输入联络信息" />
|
|
|
- <Field name="ReceiveInfo" v-model="formData.ContactInfo" autosize label="收货地址" type="textarea"
|
|
|
- placeholder="请输入收货地址">
|
|
|
- <template #button>
|
|
|
- <Button icon="plus" size="small" type="primary" />
|
|
|
- </template>
|
|
|
- </Field>
|
|
|
- <Field name="ReceiptInfo" v-model="formData.ContactInfo" autosize label="发票信息" type="textarea"
|
|
|
- placeholder="请输入发票信息">
|
|
|
- <template #button>
|
|
|
- <Button icon="plus" size="small" type="primary" />
|
|
|
- </template>
|
|
|
- </Field>
|
|
|
+ <Field name="Contract" label="联络信息" type="textarea" autosize v-model="Contract" placeholder="请输入联络信息" :rules="formRules.Contract" />
|
|
|
+ <Field name="Receive" label="收货地址" type="textarea" autosize v-model="Receive" :rules="formRules.Receive" placeholder="请输入收货地址" right-icon="add-o" @click-right-icon="showContact = true" />
|
|
|
+ <Field name="Receipt" label="发票信息" type="textarea" autosize v-model="Receipt" placeholder="必填" :rules="formRules.Receipt" right-icon="add-o" @click-right-icon="showReceipt = true" />
|
|
|
</CellGroup>
|
|
|
</Form>
|
|
|
<template #footer>
|
|
|
- <Button type="primary" block round @click="contracted">申请违约</Button>
|
|
|
+ <Button type="primary" block round @click="contracted">修改信息</Button>
|
|
|
</template>
|
|
|
</app-view>
|
|
|
+ <app-contact v-model:show="showContact" @change="contactChange" />
|
|
|
+ <app-receipt v-model:show="showReceipt" @change="receiptChange" />
|
|
|
</app-modal>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef, PropType } from 'vue'
|
|
|
-import { CellGroup, Button, Field, Form, FormInstance } from 'vant'
|
|
|
+import { CellGroup, Button, Field, Form, FormInstance, FieldRule } from 'vant'
|
|
|
import { dialog, fullloading } from '@/utils/vant'
|
|
|
import { usePerformanceModifyContact } from '@/business/performance'
|
|
|
+
|
|
|
import AppModal from '@/components/base/modal/index.vue'
|
|
|
+import AppContact from '@mobile/components/modules/contact/index.vue'
|
|
|
+import AppReceipt from '@mobile/components/modules/receipt/index.vue'
|
|
|
+import { getReceiptTypeName } from '@/constants/receipt'
|
|
|
|
|
|
const showModal = shallowRef(true)
|
|
|
// 是否刷新父组件数据
|
|
|
@@ -50,6 +45,81 @@ const props = defineProps({
|
|
|
|
|
|
const { formData, formSubmit } = usePerformanceModifyContact()
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
+const showContact = shallowRef(false) // 显示联系人选择列表
|
|
|
+const showReceipt = shallowRef(false) // 显示发票选择列表
|
|
|
+
|
|
|
+const Contract = shallowRef('') // 联系人嘻嘻
|
|
|
+const Receive = shallowRef('') // 收货地址信息
|
|
|
+const Receipt = shallowRef('') // 发票信息
|
|
|
+
|
|
|
+// 表单验证规则
|
|
|
+const formRules: { [key in keyof Proto.PerformanceModifyContactReq | 'Contract' | 'Receive' | 'Receipt']?: FieldRule[] } = {
|
|
|
+ Receive: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入收货地址信息',
|
|
|
+ }],
|
|
|
+ Receipt: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入发票信息',
|
|
|
+ }],
|
|
|
+ Contract: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入联络信息',
|
|
|
+ }],
|
|
|
+}
|
|
|
+
|
|
|
+// 选择联系信息
|
|
|
+const contactChange = (item: Model.UserReceiveInfoRsp) => {
|
|
|
+ Receive.value = ''
|
|
|
+ Receive.value += '姓名:' + item.receivername + '\n'
|
|
|
+ Receive.value += '电话:' + item.phonenum + '\n'
|
|
|
+ const { provincename, cityname, districtname, address } = item
|
|
|
+ Receive.value += '地址:' + provincename + cityname + districtname + address
|
|
|
+}
|
|
|
+
|
|
|
+// 选择发票信息
|
|
|
+const receiptChange = (item: Model.WrUserReceiptInfoRsp) => {
|
|
|
+ /// 清空数据
|
|
|
+ Receipt.value = ""
|
|
|
+ Object.entries(item).forEach(([key, value]) => {
|
|
|
+ if (value !== '') {
|
|
|
+ switch (key) {
|
|
|
+ case 'receipttype': {
|
|
|
+ Receipt.value += '发票类型:' + getReceiptTypeName(Number(value)) + '\n'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'username': {
|
|
|
+ Receipt.value += '发票抬头:' + value + '\n'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'taxpayerid': {
|
|
|
+ Receipt.value += '税号:' + value + '\n'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'receiptbank': {
|
|
|
+ Receipt.value += '开户银行:' + value + '\n'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'receiptaccount': {
|
|
|
+ Receipt.value += '银行账号:' + value + '\n'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'address': {
|
|
|
+ Receipt.value += '企业地址:' + value + '\n'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'contactinfo': {
|
|
|
+ Receipt.value += '企业电话:' + value + '\n'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 'email': {
|
|
|
+ Receipt.value += '邮箱:' + value + '\n'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
const contracted = () => {
|
|
|
dialog({
|
|
|
@@ -58,6 +128,13 @@ const contracted = () => {
|
|
|
}).then(() => {
|
|
|
/// PerformancePlanID
|
|
|
formData.value.PerformancePlanID = props.selectedRow.performanceplanid
|
|
|
+ /// Json String
|
|
|
+ const json = {
|
|
|
+ ContactInfo: '${Contract.value}',
|
|
|
+ ReceiveInfo: '${Receive.value}',
|
|
|
+ ReceiptInfo: `${Receipt.value}`
|
|
|
+ }
|
|
|
+ formData.value.ContactInfo= JSON.stringify(json)
|
|
|
/// loding....
|
|
|
fullloading((hideLoading) => {
|
|
|
formSubmit().then(() => {
|
|
|
@@ -73,7 +150,14 @@ const contracted = () => {
|
|
|
/// 关闭弹窗
|
|
|
const closed = (isRefresh = false) => {
|
|
|
refresh.value = isRefresh
|
|
|
- showModal.value = false
|
|
|
+ if (showContact.value) {
|
|
|
+ showContact.value = false
|
|
|
+ } else if (showReceipt.value) {
|
|
|
+ showReceipt.value = false
|
|
|
+ } else {
|
|
|
+ refresh.value = isRefresh
|
|
|
+ showModal.value = false
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 暴露组件属性给父组件调用
|