InvoiceFormTask.vue 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684
  1. <template>
  2. <view>
  3. <cu-custom :backUrl="'/pages/index/index'" :isBack="true" bgColor="bg-gradual-blue">
  4. <block slot="content">发票申请</block>
  5. </cu-custom>
  6. <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules"
  7. ref="inputForm" v-if="!nodeFlag">
  8. <el-row :gutter="15" :key="index_experience"
  9. v-for="(item, index_experience) in this.inputForm.financeInvoiceBaseDTOList">
  10. <el-col :span="24">
  11. <u-form-item label="">
  12. <el-divider content-position="left"> 基本信息详情 {{ index_experience + 1 }}</el-divider>
  13. </u-form-item>
  14. </el-col>
  15. <el-col :span="24">
  16. <u-form-item label="项目名称" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].programName'"
  17. :rules="[
  18. ]">
  19. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].programName"
  20. placeholder="请选择项目名称" @focus="showProject(index_experience)" clearable></u--input>
  21. </u-form-item>
  22. <u-form-item label="合同名称" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].contractName'"
  23. :rules="[
  24. ]">
  25. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].contractName"
  26. :readonly="true" placeholder="请填写合同名称" clearable></u--input>
  27. </u-form-item>
  28. <u-form-item label="项目编号" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].programNo'"
  29. :rules="[
  30. ]">
  31. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].programNo"
  32. :readonly="true" placeholder="请填写项目编号" clearable></u--input>
  33. </u-form-item>
  34. <u-form-item label="报告号" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].reportNo'"
  35. :rules="[
  36. ]">
  37. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].reportNo"
  38. :readonly="true" placeholder="请填写报告号" clearable></u--input>
  39. </u-form-item>
  40. <u-form-item label="发票金额(元)" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].account'"
  41. :required="true" :rules="[
  42. ]">
  43. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].account"
  44. @blur="onInputCode(index_experience, $event, 'account')" placeholder="请填写发票金额(元)"
  45. clearable></u--input>
  46. </u-form-item>
  47. </el-col>
  48. <el-col :span="24" style="text-align: center">
  49. <u-form-item label="">
  50. <el-button style="width: 100%" type="danger" @click="removeRow('base', index_experience)"
  51. plain>删除基本信息 {{ index_experience + 1 }}</el-button>
  52. </u-form-item>
  53. </el-col>
  54. </el-row>
  55. <u-form-item label="">
  56. <el-button style="width: 100%" type="primary" @click="addRow('base')" plain>新增基本信息</el-button>
  57. </u-form-item>
  58. <u-form-item label="">
  59. <el-divider content-position="left"> 发票详情</el-divider>
  60. </u-form-item>
  61. <u-form-item label="发票类型" borderBottom prop="type" :required="true">
  62. <u-radio-group v-model="inputForm.type">
  63. <u-radio :customStyle="{ marginRight: '16px' }" v-for="(item, index) in typeList" :key="index"
  64. :label="item.name" :name="item.value"></u-radio>
  65. </u-radio-group>
  66. </u-form-item>
  67. <u-form-item label="发票申请编号" prop="no" :rules="[
  68. ]">
  69. <u--input v-model="inputForm.no" :disabled="true" placeholder="请填写发票申请编号" clearable></u--input>
  70. </u-form-item>
  71. <u-form-item label="开票类型" borderBottom prop="billingType" :required="true">
  72. <u-radio-group v-model="inputForm.billingType">
  73. <u-radio :customStyle="{ marginRight: '16px' }" v-for="(item, index) in billingTypeList"
  74. :key="index" :label="item.name" :name="item.value" @change="reimbursementTypeChange"></u-radio>
  75. </u-radio-group>
  76. </u-form-item>
  77. <u-form-item label="实际开票单位" prop="billingWorkplaceReal" v-if="inputForm.billingType === '1'"
  78. :required="true" :rules="[
  79. ]">
  80. <u--input v-model="inputForm.billingWorkplaceReal" @focus="showWorkplace()" placeholder="请填写实际开票单位"
  81. clearable></u--input>
  82. </u-form-item>
  83. <template v-if="inputForm.type === '1'">
  84. <u-form-item label="纳税人识别号" prop="taxpayerIdentificationNo" v-if="inputForm.billingType === '1'"
  85. :required="true" :rules="[
  86. ]">
  87. <u--input v-model="inputForm.taxpayerIdentificationNo" placeholder="请填写纳税人识别号" clearable></u--input>
  88. </u-form-item>
  89. <u-form-item label="地址" prop="address" v-if="inputForm.billingType === '1'" :required="true" :rules="[
  90. ]">
  91. <u--input v-model="inputForm.address" placeholder="请填写地址" clearable></u--input>
  92. </u-form-item>
  93. <u-form-item label="电话" prop="telPhone" v-if="inputForm.billingType === '1'" :required="true" :rules="[
  94. ]">
  95. <u--input v-model="inputForm.telPhone" placeholder="请填写电话" clearable></u--input>
  96. </u-form-item>
  97. <u-form-item label="开户银行" borderBottom v-if="inputForm.billingType === '1'" prop="openBank"
  98. :required="true">
  99. <jp-picker v-model="inputForm.openBank" @input="changeBank" rangeKey="label" rangeValue="value"
  100. :range=bankList></jp-picker>
  101. </u-form-item>
  102. <u-form-item label="银行账号" borderBottom v-if="inputForm.billingType === '1'" prop="bankAccount"
  103. :required="true">
  104. <u--input v-model="inputForm.bankAccount" :disabled="true" placeholder="请填写银行账号"
  105. clearable></u--input>
  106. </u-form-item>
  107. </template>
  108. <template v-if="inputForm.type !== '1'">
  109. <u-form-item label="纳税人识别号" v-if="inputForm.billingType === '1'" prop="taxpayerIdentificationNo" :rules="[
  110. ]">
  111. <u--input v-model="inputForm.taxpayerIdentificationNo" placeholder="请填写纳税人识别号" clearable></u--input>
  112. </u-form-item>
  113. <u-form-item label="地址" prop="address" v-if="inputForm.billingType === '1'" :rules="[
  114. ]">
  115. <u--input v-model="inputForm.address" placeholder="请填写地址" clearable></u--input>
  116. </u-form-item>
  117. <u-form-item label="电话" prop="telPhone" v-if="inputForm.billingType === '1'" :rules="[
  118. ]">
  119. <u--input v-model="inputForm.telPhone" placeholder="请填写电话" clearable></u--input>
  120. </u-form-item>
  121. <u-form-item label="开户银行" borderBottom v-if="inputForm.billingType === '1'" prop="openBank">
  122. <jp-picker v-model="inputForm.openBank" @input="changeBank" rangeKey="label" rangeValue="value"
  123. :range=bankList></jp-picker>
  124. </u-form-item>
  125. <u-form-item label="银行账号" v-if="inputForm.billingType === '1'" borderBottom prop="bankAccount">
  126. <u--input v-model="inputForm.bankAccount" :disabled="true" placeholder="请填写银行账号"
  127. clearable></u--input>
  128. </u-form-item>
  129. </template>
  130. <u-form-item label="姓名" v-if="inputForm.billingType === '2'" prop="nameShow" :required="true" :rules="[
  131. ]">
  132. <u--input v-model="inputForm.nameShow" placeholder="请选择" @focus="openUserPullForm('', '姓名')"
  133. clearable></u--input>
  134. </u-form-item>
  135. <u-form-item label="收款类型" borderBottom prop="receivablesType" :required="true">
  136. <jp-picker v-model="inputForm.receivablesType" rangeKey="label" rangeValue="value" :range="[
  137. { label: '单一收费', value: '1' },
  138. { label: '合并收费', value: '2' },
  139. ]"></jp-picker>
  140. </u-form-item>
  141. <u-form-item label="开票内容" borderBottom prop="billingContent" :required="true">
  142. <jp-picker v-model="inputForm.billingContent" rangeKey="label" rangeValue="value" :range="[
  143. { label: '审计费', value: '1' },
  144. { label: '工程审核费', value: '2' },
  145. { label: '咨询费', value: '3' },
  146. { label: '预算编制费', value: '4' },
  147. { label: '招标代理费', value: '5' },
  148. { label: '司法鉴定费', value: '6' },
  149. { label: '其他', value: '8' },
  150. { label: '技术服务费', value: '9' },
  151. { label: '鉴证咨询服务*评估费', value: '10' },
  152. { label: '其他咨询服务*专家咨询费', value: '11' },
  153. { label: '会计服务', value: '12' },
  154. { label: '竣工决算编制费', value: '13' },
  155. { label: '*信息技术服务*技术服务费', value: '14' },
  156. ]"></jp-picker>
  157. </u-form-item>
  158. <u-form-item label="发票金额(元)" borderBottom prop="accountTotal" :required="true">
  159. <u--input v-model="inputForm.accountTotal" :disabled="true" placeholder="请填写发票金额" clearable></u--input>
  160. </u-form-item>
  161. <u-form-item label="报备类型" borderBottom prop="reportType" :required="true">
  162. <jp-picker v-model="inputForm.reportType" rangeKey="label" rangeValue="value" :range="[
  163. { label: '上市公司审计', value: '1' },
  164. { label: '国有大型企业审计', value: '2' },
  165. { label: '新三板企业审计', value: '3' },
  166. { label: '一般企业审计', value: '4' },
  167. { label: '事业单位审计', value: '5' },
  168. { label: '民间非营利组织等其他单位审计', value: '6' },
  169. { label: '内控审计报告', value: '7' },
  170. { label: '内控鉴证报告', value: '8' },
  171. { label: '其他报告', value: '9' },
  172. { label: '专项审计业务', value: '10' },
  173. { label: '验资业务', value: '11' },
  174. ]"></jp-picker>
  175. </u-form-item>
  176. <u-form-item label="是否多张开票" borderBottom prop="isMultiple" :required="true">
  177. <u-radio-group v-model="inputForm.isMultiple">
  178. <u-radio :customStyle="{ marginRight: '16px' }" v-for="(item, index) in yesNoFlag" :key="index"
  179. :label="item.name" :name="item.value"></u-radio>
  180. </u-radio-group>
  181. </u-form-item>
  182. <u-form-item label="开票内容要求" borderBottom prop="billingContentTerms">
  183. <u--textarea placeholder='开票内容要求' :maxlength="500"
  184. v-model="inputForm.billingContentTerms"></u--textarea>
  185. </u-form-item>
  186. <u-form-item label="开票人" borderBottom prop="billingPeople">
  187. <u--input v-model="inputForm.billingPeople" :disabled="true" placeholder="请选择开票人" clearable></u--input>
  188. </u-form-item>
  189. <!--<u-form-item label="开票时间" prop="billingDate" v-if="addFlag" :required="true"
  190. :rules="[
  191. ]">
  192. <el-date-picker
  193. v-model="inputForm.billingDate"
  194. type="date"
  195. style="width:100%"
  196. size="default"
  197. placement="bottom-start"
  198. clearable>
  199. </el-date-picker>
  200. </u-form-item>
  201. <u-form-item label="领票时间" prop="collectDate" v-if="addFlag"
  202. :rules="[
  203. ]">
  204. <el-date-picker
  205. v-model="inputForm.collectDate"
  206. type="date"
  207. style="width:100%"
  208. size="default"
  209. placement="bottom-start"
  210. clearable>
  211. </el-date-picker>
  212. </u-form-item>-->
  213. <u-form-item label="实际开票人" prop="billingPeopleRealName" :required="true" :rules="[
  214. ]">
  215. <u--input v-model="inputForm.billingPeopleRealName" placeholder="请选择实际开票人"
  216. @focus="openUserPullForm('', '实际')" clearable></u--input>
  217. </u-form-item>
  218. <u-form-item label="接收邮箱" prop="actualDrawerEmailAddress" :rules="[
  219. ]">
  220. <u--input v-model="inputForm.actualDrawerEmailAddress" placeholder="请输入接收邮箱" clearable></u--input>
  221. <view class="button-container">
  222. <button @click="openDia">完善邮箱</button>
  223. </view>
  224. </u-form-item>
  225. <u-form-item label="对账人" prop="reconciliationPeopleName" :required="true" :rules="[
  226. ]">
  227. <u--input v-model="inputForm.reconciliationPeopleName" placeholder="请选择对账人"
  228. @focus="openUserPullForm('', '对账')" clearable></u--input>
  229. </u-form-item>
  230. <u-form-item label="对账地区" borderBottom prop="reconciliationArea" :required="true">
  231. <jp-area-select v-model="inputForm.reconciliationArea"></jp-area-select>
  232. </u-form-item>
  233. <u-form-item label="备注" borderBottom prop="remarks">
  234. <u--textarea placeholder='请填写备注' :maxlength="500" v-model="inputForm.remarks"></u--textarea>
  235. </u-form-item>
  236. <el-row :gutter="15" :key="index_experience"
  237. v-for="(item, index_experience) in this.inputForm.financeInvoiceDetailDTOList">
  238. <el-col :span="24">
  239. <u-form-item label="">
  240. <el-divider content-position="left"> 发票明细详情 {{ index_experience + 1 }}</el-divider>
  241. </u-form-item>
  242. </el-col>
  243. <el-col :span="24">
  244. <u-form-item label="发票代码" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].code'"
  245. :rules="[
  246. ]">
  247. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].code"
  248. placeholder="请填写发票代码" clearable></u--input>
  249. </u-form-item>
  250. <u-form-item label="发票号" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].number'"
  251. :rules="[
  252. ]">
  253. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].number"
  254. @blur="validateNumber(index_experience)" placeholder="请填写发票号" clearable></u--input>
  255. </u-form-item>
  256. <u-form-item label="开票金额(元)" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].account'"
  257. :rules="[
  258. ]">
  259. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].account"
  260. placeholder="请填写开票金额(元)" clearable></u--input>
  261. </u-form-item>
  262. <u-form-item label="税率(%)" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].rate'"
  263. :rules="[
  264. ]">
  265. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].rate"
  266. @blur="checkRate($event, index_experience)" placeholder="请填写税率(%)" clearable></u--input>
  267. </u-form-item>
  268. <u-form-item label="金额" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].amount'"
  269. :rules="[
  270. ]">
  271. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].amount"
  272. :readonly="true" placeholder="请填写金额" clearable></u--input>
  273. </u-form-item>
  274. <u-form-item label="税额" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].tax'" :rules="[
  275. ]">
  276. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].tax" :readonly="true"
  277. placeholder="请填写税额" clearable></u--input>
  278. </u-form-item>
  279. <u-form-item label="累计登记金额"
  280. :prop="'financeInvoiceDetailDTOList[' + index_experience + '].allAmount'" :rules="[
  281. ]">
  282. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].allAmount"
  283. placeholder="请填写累计登记金额" clearable></u--input>
  284. </u-form-item>
  285. </el-col>
  286. <el-col :span="24" style="text-align: center">
  287. <u-form-item label="">
  288. <el-button style="width: 100%" type="danger" :disabled="true"
  289. @click="removeRow('detail', index_experience)" plain>删除发票明细 {{ index_experience +
  290. 1 }}</el-button>
  291. </u-form-item>
  292. </el-col>
  293. </el-row>
  294. <u-form-item label="">
  295. <el-button style="width: 100%" :disabled="true" type="primary" @click="addRow('detail')"
  296. plain>新增发票明细</el-button>
  297. <!-- <el-button style="width: 100%" :disabled="true" type="primary" @click="downloadTpl" plain>下载模板</el-button>-->
  298. </u-form-item>
  299. <u-form-item label="附件">
  300. <!-- <el-upload class="upload-demo"
  301. :action="`http://cpaoa.xgccpm.com/api/public-modules-server/oss/file/webUpload/upload`"
  302. :on-remove="(file, fileList) => handleRemove(file, fileList)"
  303. :file-list="inputForm.workAttachmentDtoList"
  304. :on-success="(response, file, fileList) => handleUploadSuccess(response, file, fileList)"
  305. :limit="3">
  306. <el-button size="small" type="primary">点击上传</el-button>
  307. <div slot="tip" class="el-upload__tip">只能上传不超过 3 个文件</div>
  308. <template slot="file" slot-scope="{ file }" v-if="shouldShowFile(file)">
  309. <span @click="handleFileClick(file)">{{ file.name }}</span>
  310. <el-button type="text" icon="el-icon-close" @click="handleDelete(file)">✕</el-button>
  311. </template>
  312. </el-upload> -->
  313. <UploadComponent :uploadUrl="`${uploadUrl}/public-modules-server/oss/file/webUpload/upload`"
  314. @onRemove="handleDelete" @onSuccess="handleUploadSuccess"
  315. :fileList="inputForm.workAttachmentDtoList" :limit="3">
  316. </UploadComponent>
  317. </u-form-item>
  318. </u--form>
  319. <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules"
  320. ref="inputForm" v-if="nodeFlag">
  321. <el-row :gutter="15" :key="index_experience"
  322. v-for="(item, index_experience) in this.inputForm.financeInvoiceBaseDTOList">
  323. <el-col :span="24">
  324. <u-form-item label="">
  325. <el-divider content-position="left"> 基本信息详情 {{ index_experience + 1 }}</el-divider>
  326. </u-form-item>
  327. </el-col>
  328. <el-col :span="24">
  329. <u-form-item label="项目名称" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].programName'"
  330. :rules="[
  331. ]">
  332. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].programName"
  333. :disabled="true" placeholder="请选择项目名称" @focus="showProject(index_experience)"
  334. clearable></u--input>
  335. </u-form-item>
  336. <u-form-item label="合同名称" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].contractName'"
  337. :rules="[
  338. ]">
  339. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].contractName"
  340. :disabled="true" :readonly="true" placeholder="请填写合同名称" clearable></u--input>
  341. </u-form-item>
  342. <u-form-item label="项目编号" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].programNo'"
  343. :rules="[
  344. ]">
  345. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].programNo"
  346. :disabled="true" :readonly="true" placeholder="请填写项目编号" clearable></u--input>
  347. </u-form-item>
  348. <u-form-item label="报告号" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].reportNo'"
  349. :rules="[
  350. ]">
  351. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].reportNo"
  352. :disabled="true" :readonly="true" placeholder="请填写报告号" clearable></u--input>
  353. </u-form-item>
  354. <u-form-item label="发票金额(元)" :prop="'financeInvoiceBaseDTOList[' + index_experience + '].account'"
  355. :required="true" :rules="[
  356. ]">
  357. <u--input v-model="inputForm.financeInvoiceBaseDTOList[index_experience].account"
  358. :disabled="true" @blur="onInputCode(index_experience, $event, 'account')"
  359. placeholder="请填写发票金额(元)" clearable></u--input>
  360. </u-form-item>
  361. </el-col>
  362. <el-col :span="24" style="text-align: center">
  363. <u-form-item label="">
  364. <el-button style="width: 100%" type="danger" :disabled="true"
  365. @click="removeRow('base', index_experience)" plain>删除基本信息 {{ index_experience +
  366. 1 }}</el-button>
  367. </u-form-item>
  368. </el-col>
  369. </el-row>
  370. <u-form-item label="">
  371. <el-button style="width: 100%" type="primary" :disabled="true" @click="addRow('base')"
  372. plain>新增基本信息</el-button>
  373. </u-form-item>
  374. <u-form-item label="">
  375. <el-divider content-position="left"> 发票详情</el-divider>
  376. </u-form-item>
  377. <u-form-item label="发票类型" borderBottom prop="type" :required="true">
  378. <u-radio-group v-model="inputForm.type">
  379. <u-radio :disabled="true" :customStyle="{ marginRight: '16px' }" v-for="(item, index) in typeList"
  380. :key="index" :label="item.name" :name="item.value"></u-radio>
  381. </u-radio-group>
  382. </u-form-item>
  383. <u-form-item label="发票申请编号" prop="no" :rules="[
  384. ]">
  385. <u--input v-model="inputForm.no" :disabled="true" placeholder="请填写发票申请编号" clearable></u--input>
  386. </u-form-item>
  387. <u-form-item label="开票类型" borderBottom prop="billingType" :required="true">
  388. <u-radio-group v-model="inputForm.billingType">
  389. <u-radio :disabled="true" :customStyle="{ marginRight: '16px' }"
  390. v-for="(item, index) in billingTypeList" :key="index" :label="item.name" :name="item.value"
  391. @change="reimbursementTypeChange"></u-radio>
  392. </u-radio-group>
  393. </u-form-item>
  394. <u-form-item label="实际开票单位" prop="billingWorkplaceReal" v-if="inputForm.billingType === '1'"
  395. :required="true" :rules="[
  396. ]">
  397. <u--input v-model="inputForm.billingWorkplaceReal" :disabled="true" @focus="showWorkplace()"
  398. placeholder="请填写实际开票单位" clearable></u--input>
  399. </u-form-item>
  400. <template v-if="inputForm.type === '1'">
  401. <u-form-item label="纳税人识别号" prop="taxpayerIdentificationNo" v-if="inputForm.billingType === '1'"
  402. :required="true" :rules="[
  403. ]">
  404. <u--input v-model="inputForm.taxpayerIdentificationNo" :disabled="true" placeholder="请填写纳税人识别号"
  405. clearable></u--input>
  406. </u-form-item>
  407. <u-form-item label="地址" prop="address" v-if="inputForm.billingType === '1'" :required="true" :rules="[
  408. ]">
  409. <u--input v-model="inputForm.address" :disabled="true" placeholder="请填写地址" clearable></u--input>
  410. </u-form-item>
  411. <u-form-item label="电话" prop="telPhone" v-if="inputForm.billingType === '1'" :required="true" :rules="[
  412. ]">
  413. <u--input v-model="inputForm.telPhone" :disabled="true" placeholder="请填写电话" clearable></u--input>
  414. </u-form-item>
  415. <u-form-item label="开户银行" borderBottom v-if="inputForm.billingType === '1'" prop="openBank"
  416. :required="true">
  417. <jp-picker v-model="inputForm.openBank" :disabled="true" @input="changeBank" rangeKey="label"
  418. rangeValue="value" :range=bankList></jp-picker>
  419. </u-form-item>
  420. <u-form-item label="银行账号" borderBottom v-if="inputForm.billingType === '1'" prop="bankAccount"
  421. :required="true">
  422. <u--input v-model="inputForm.bankAccount" :disabled="true" placeholder="请填写银行账号"
  423. clearable></u--input>
  424. </u-form-item>
  425. </template>
  426. <template v-if="inputForm.type !== '1'">
  427. <u-form-item label="纳税人识别号" v-if="inputForm.billingType === '1'" prop="taxpayerIdentificationNo" :rules="[
  428. ]">
  429. <u--input v-model="inputForm.taxpayerIdentificationNo" :disabled="true" placeholder="请填写纳税人识别号"
  430. clearable></u--input>
  431. </u-form-item>
  432. <u-form-item label="地址" prop="address" v-if="inputForm.billingType === '1'" :rules="[
  433. ]">
  434. <u--input v-model="inputForm.address" :disabled="true" placeholder="请填写地址" clearable></u--input>
  435. </u-form-item>
  436. <u-form-item label="电话" prop="telPhone" v-if="inputForm.billingType === '1'" :rules="[
  437. ]">
  438. <u--input v-model="inputForm.telPhone" :disabled="true" placeholder="请填写电话" clearable></u--input>
  439. </u-form-item>
  440. <u-form-item label="开户银行" borderBottom v-if="inputForm.billingType === '1'" prop="openBank">
  441. <jp-picker v-model="inputForm.openBank" :disabled="true" @input="changeBank" rangeKey="label"
  442. rangeValue="value" :range=bankList></jp-picker>
  443. </u-form-item>
  444. <u-form-item label="银行账号" v-if="inputForm.billingType === '1'" borderBottom prop="bankAccount">
  445. <u--input v-model="inputForm.bankAccount" :disabled="true" placeholder="请填写银行账号"
  446. clearable></u--input>
  447. </u-form-item>
  448. </template>
  449. <u-form-item label="姓名" v-if="inputForm.billingType === '2'" prop="nameShow" :required="true" :rules="[
  450. ]">
  451. <u--input v-model="inputForm.nameShow" :disabled="true" placeholder="请选择"
  452. @focus="openUserPullForm('', '姓名')" clearable></u--input>
  453. </u-form-item>
  454. <u-form-item label="收款类型" borderBottom prop="receivablesType" :required="true">
  455. <jp-picker v-model="inputForm.receivablesType" :disabled="true" rangeKey="label" rangeValue="value"
  456. :range="[
  457. { label: '单一收费', value: '1' },
  458. { label: '合并收费', value: '2' },
  459. ]"></jp-picker>
  460. </u-form-item>
  461. <u-form-item label="开票内容" borderBottom prop="billingContent" :required="true">
  462. <jp-picker v-model="inputForm.billingContent" rangeKey="label" :disabled="true" rangeValue="value"
  463. :range="[
  464. { label: '审计费', value: '1' },
  465. { label: '工程审核费', value: '2' },
  466. { label: '咨询费', value: '3' },
  467. { label: '预算编制费', value: '4' },
  468. { label: '招标代理费', value: '5' },
  469. { label: '司法鉴定费', value: '6' },
  470. { label: '其他', value: '8' },
  471. { label: '技术服务费', value: '9' },
  472. { label: '鉴证咨询服务*评估费', value: '10' },
  473. { label: '其他咨询服务*专家咨询费', value: '11' },
  474. { label: '会计服务', value: '12' },
  475. { label: '竣工决算编制费', value: '13' },
  476. { label: '*信息技术服务*技术服务费', value: '14' },
  477. ]"></jp-picker>
  478. </u-form-item>
  479. <u-form-item label="发票金额(元)" borderBottom prop="accountTotal" :required="true">
  480. <u--input v-model="inputForm.accountTotal" :disabled="true" placeholder="请填写发票金额" clearable></u--input>
  481. </u-form-item>
  482. <u-form-item label="报备类型" borderBottom prop="reportType" :required="true">
  483. <jp-picker v-model="inputForm.reportType" :disabled="true" rangeKey="label" rangeValue="value" :range="[
  484. { label: '上市公司审计', value: '1' },
  485. { label: '国有大型企业审计', value: '2' },
  486. { label: '新三板企业审计', value: '3' },
  487. { label: '一般企业审计', value: '4' },
  488. { label: '事业单位审计', value: '5' },
  489. { label: '民间非营利组织等其他单位审计', value: '6' },
  490. { label: '内控审计报告', value: '7' },
  491. { label: '内控鉴证报告', value: '8' },
  492. { label: '其他报告', value: '9' },
  493. { label: '专项审计业务', value: '10' },
  494. { label: '验资业务', value: '11' },
  495. ]"></jp-picker>
  496. </u-form-item>
  497. <u-form-item label="是否多张开票" borderBottom prop="isMultiple" :required="true">
  498. <u-radio-group v-model="inputForm.isMultiple">
  499. <u-radio :disabled="true" :customStyle="{ marginRight: '16px' }" v-for="(item, index) in yesNoFlag"
  500. :key="index" :label="item.name" :name="item.value"></u-radio>
  501. </u-radio-group>
  502. </u-form-item>
  503. <u-form-item label="开票内容要求" borderBottom prop="billingContentTerms">
  504. <u--textarea placeholder='开票内容要求' :disabled="true" :maxlength="500"
  505. v-model="inputForm.billingContentTerms"></u--textarea>
  506. </u-form-item>
  507. <u-form-item label="开票人" borderBottom prop="billingPeople">
  508. <u--input v-model="inputForm.billingPeople" :disabled="true" placeholder="请选择开票人" clearable></u--input>
  509. </u-form-item>
  510. <u-form-item label="开票时间" prop="billingDate" v-if="addFlag" :required="true" :rules="[
  511. ]">
  512. <el-date-picker :disabled="testFlag" v-model="inputForm.billingDate" type="date" style="width:100%"
  513. size="default" placement="bottom-start" clearable>
  514. </el-date-picker>
  515. </u-form-item>
  516. <u-form-item label="领票时间" prop="collectDate" v-if="addFlag" :rules="[
  517. ]">
  518. <el-date-picker :disabled="testFlag" v-model="inputForm.collectDate" type="date" style="width:100%"
  519. size="default" placement="bottom-start" clearable>
  520. </el-date-picker>
  521. </u-form-item>
  522. <u-form-item label="实际开票人" prop="billingPeopleRealName" :required="true" :rules="[
  523. ]">
  524. <u--input v-model="inputForm.billingPeopleRealName" :disabled="true" placeholder="请选择实际开票人"
  525. @focus="openUserPullForm('', '实际')" clearable></u--input>
  526. </u-form-item>
  527. <u-form-item label="接收邮箱" prop="actualDrawerEmailAddress" :rules="[
  528. ]">
  529. <u--input v-model="inputForm.actualDrawerEmailAddress" :disabled="true" placeholder="请输入接收邮箱"
  530. clearable></u--input>
  531. <view class="button-container">
  532. <button :disabled="true" @click="openDia">完善邮箱</button>
  533. </view>
  534. </u-form-item>
  535. <u-form-item label="对账人" prop="reconciliationPeopleName" :required="true" :rules="[
  536. ]">
  537. <u--input v-model="inputForm.reconciliationPeopleName" :disabled="true" placeholder="请选择对账人"
  538. @focus="openUserPullForm('', '对账')" clearable></u--input>
  539. </u-form-item>
  540. <u-form-item label="对账地区" borderBottom prop="reconciliationArea" :required="true">
  541. <jp-area-select :disabled="true" v-model="inputForm.reconciliationArea"></jp-area-select>
  542. </u-form-item>
  543. <u-form-item label="备注" borderBottom prop="remarks">
  544. <u--textarea placeholder='请填写备注' :disabled="true" :maxlength="500"
  545. v-model="inputForm.remarks"></u--textarea>
  546. </u-form-item>
  547. <el-row :gutter="15" :key="index_experience"
  548. v-for="(item, index_experience) in this.inputForm.financeInvoiceDetailDTOList">
  549. <el-col :span="24">
  550. <u-form-item label="">
  551. <el-divider content-position="left"> 发票明细详情 {{ index_experience + 1 }}</el-divider>
  552. </u-form-item>
  553. </el-col>
  554. <el-col :span="24">
  555. <u-form-item label="发票代码" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].code'"
  556. :rules="[
  557. ]">
  558. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].code"
  559. :disabled="testFlag" placeholder="请填写发票代码" clearable></u--input>
  560. </u-form-item>
  561. <u-form-item label="发票号" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].number'"
  562. :rules="[
  563. ]">
  564. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].number"
  565. :disabled="testFlag" @blur="validateNumber(index_experience)" placeholder="请填写发票号"
  566. clearable></u--input>
  567. </u-form-item>
  568. <u-form-item label="开票金额(元)" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].account'"
  569. :rules="[
  570. ]">
  571. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].account"
  572. :disabled="testFlag" placeholder="请填写开票金额(元)" clearable></u--input>
  573. </u-form-item>
  574. <u-form-item label="税率(%)" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].rate'"
  575. :rules="[
  576. ]">
  577. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].rate"
  578. :disabled="testFlag" @blur="checkRate($event, index_experience)" placeholder="请填写税率(%)"
  579. clearable></u--input>
  580. </u-form-item>
  581. <u-form-item label="金额" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].amount'"
  582. :rules="[
  583. ]">
  584. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].amount"
  585. :disabled="testFlag" :readonly="true" placeholder="请填写金额" clearable></u--input>
  586. </u-form-item>
  587. <u-form-item label="税额" :prop="'financeInvoiceDetailDTOList[' + index_experience + '].tax'" :rules="[
  588. ]">
  589. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].tax"
  590. :disabled="testFlag" :readonly="true" placeholder="请填写税额" clearable></u--input>
  591. </u-form-item>
  592. <u-form-item label="累计登记金额"
  593. :prop="'financeInvoiceDetailDTOList[' + index_experience + '].allAmount'" :rules="[
  594. ]">
  595. <u--input v-model="inputForm.financeInvoiceDetailDTOList[index_experience].allAmount"
  596. :disabled="testFlag" placeholder="请填写累计登记金额" clearable></u--input>
  597. </u-form-item>
  598. </el-col>
  599. <el-col :span="24" style="text-align: center">
  600. <u-form-item label="">
  601. <el-button style="width: 100%" type="danger" :disabled="testFlag"
  602. @click="removeRow('detail', index_experience)" plain>删除基本信息 {{ index_experience +
  603. 1 }}</el-button>
  604. </u-form-item>
  605. </el-col>
  606. </el-row>
  607. <u-form-item label="">
  608. <el-button style="width: 100%" type="primary" :disabled="testFlag" @click="addRow('detail')"
  609. plain>新增发票明细</el-button>
  610. <!-- <el-button style="width: 100%" :disabled="testFlag" type="primary" @click="downloadTpl" plain>下载模板</el-button>-->
  611. </u-form-item>
  612. <u-form-item label="附件">
  613. <!-- <el-upload :disabled="true" class="upload-demo"
  614. :action="`http://cpaoa.xgccpm.com/api/public-modules-server/oss/file/webUpload/upload`"
  615. :on-remove="(file, fileList) => handleRemove(file, fileList)"
  616. :file-list="inputForm.workAttachmentDtoList"
  617. :on-success="(response, file, fileList) => handleUploadSuccess(response, file, fileList)"
  618. :limit="3">
  619. <el-button size="small" :disabled="true" type="primary">点击上传</el-button>
  620. <div slot="tip" class="el-upload__tip">只能上传不超过 3 个文件</div>
  621. <template slot="file" slot-scope="{ file }" v-if="shouldShowFile(file)">
  622. <span @click="handleFileClick(file)">{{ file.name }}</span>
  623. <el-button type="text" icon="el-icon-close" @click="handleDelete(file)">✕</el-button>
  624. </template>
  625. </el-upload> -->
  626. <UploadComponent :uploadUrl="`${uploadUrl}/public-modules-server/oss/file/webUpload/upload`"
  627. @onRemove="handleDelete" @onSuccess="handleUploadSuccess"
  628. :fileList="inputForm.workAttachmentDtoList" :limit="3">
  629. </UploadComponent>
  630. </u-form-item>
  631. </u--form>
  632. <user-select ref="userPicker" @input="handleEvent"></user-select>
  633. <InvoiceProjectChoose ref="invoiceProjectChoose" @input="selectProjectChange" title="报告项目选择" />
  634. <WorkPlaceChoose ref="workPlaceChoose" @input="getWorkClient" title="客户选择" />
  635. <EmailForm ref="emailForm" @input="emailForm" title="完善邮箱" />
  636. </view>
  637. </template>
  638. <script>
  639. import financeInvoiceService from '@/api/cw/invoice/CwFinanceInvoiceService'
  640. var graceChecker = require("@/common/graceChecker.js");
  641. import workClientService from '@/api/cw/workClientInfo/WorkClientService'
  642. import InvoiceProjectChoose from './InvoiceProjectChoose'
  643. import WorkPlaceChoose from './WorkPlaceChoose'
  644. import EmailForm from './EmailForm'
  645. import userSelect from '@/components/user-select/user-select-radio.vue'
  646. import OSSService from "@/api/sys/OSSService"
  647. import MaterialTypeService from '@/api/materialManagement/MaterialTypeService'
  648. import WareHouseService from '@/api/materialManagement/WareHouseService'
  649. import CommonApi from '@/api/common/CommonApi'
  650. import { mapState, mapMutations, mapActions } from 'vuex'
  651. import UploadComponent from '@/pages/common/UploadComponent.vue';
  652. import upload from '@/utils/upload.js'
  653. export default {
  654. components: {
  655. EmailForm,
  656. userSelect,
  657. InvoiceProjectChoose,
  658. WorkPlaceChoose,
  659. UploadComponent
  660. },
  661. computed: mapState({
  662. userInfo: (state) => state.user.userInfo,
  663. avatar: (state) => state.user.avatar
  664. }),
  665. data() {
  666. return {
  667. uploadUrl: upload.UPLOAD_URL,
  668. nodeFlag: false,
  669. isPreInvoice: '',
  670. yesNoFlag: [{ name: '否', value: '0' }, { name: '是', value: '1' }],
  671. bj1: "",
  672. areaList: [],
  673. typeList: [{
  674. name: '专票',
  675. value: '1',
  676. disabled: false
  677. }, {
  678. name: '普票',
  679. value: '2',
  680. disabled: false
  681. }],
  682. billingTypeList: [{
  683. name: '企业开票',
  684. value: '1',
  685. disabled: false
  686. }, {
  687. name: '个人开票',
  688. value: '2',
  689. disabled: false
  690. }],
  691. showFileList: [], // 控制每个文件是否显示的数组
  692. testFlag: false,
  693. addFlag: false,
  694. bankList: [],
  695. inputForm: {
  696. account: '',
  697. accountTotal: '',//发票汇总金额
  698. financeInvoiceBaseDTOList: [],
  699. financeInvoiceDetailDTOList: [],
  700. workAttachmentDtoList: [], // 附件信息
  701. procInsId: '',
  702. type: '1',
  703. no: '',
  704. billingType: '1',
  705. billingWorkplaceReal: '',
  706. billingWorkplaceRealId: '',
  707. taxpayerIdentificationNo: '',
  708. address: '',
  709. telPhone: '',
  710. billingId: '',
  711. openBank: '',
  712. bankAccount: '',
  713. receivablesType: '',
  714. billingContent: '',
  715. reportType: '',
  716. isMultiple: '0',
  717. billingContentTerms: '',
  718. billingPeople: '',
  719. billingPeopleRealName: '',
  720. billingPeopleReal: '',
  721. actualDrawerEmailAddress: '',
  722. reconciliationPeopleName: '',
  723. reconciliationPeople: '',
  724. reconciliationArea: '',
  725. remarks: '',
  726. name: '',
  727. nameShow: '',
  728. billingDate: '',
  729. collectDate: '',
  730. programId: '',
  731. },
  732. rules: {
  733. 'billingWorkplaceReal': [
  734. {
  735. required: true,
  736. message: '实际开票单位不能为空',
  737. trigger: ['blur', 'change']
  738. }
  739. ],
  740. 'taxpayerIdentificationNo': [
  741. {
  742. required: true,
  743. message: '纳税人识别号不能为空',
  744. trigger: ['blur', 'change']
  745. }
  746. ],
  747. 'billingContent': [
  748. {
  749. required: true,
  750. message: '开票内容不能为空',
  751. trigger: ['blur', 'change']
  752. }
  753. ],
  754. 'billingPeopleRealName': [
  755. {
  756. required: true,
  757. message: '实际开票人不能为空',
  758. trigger: ['blur', 'change']
  759. }
  760. ],
  761. 'reconciliationPeopleName': [
  762. {
  763. required: true,
  764. message: '对账人不能为空',
  765. trigger: ['blur', 'change']
  766. }
  767. ],
  768. 'reconciliationArea': [
  769. {
  770. required: true,
  771. message: '对账地区不能为空',
  772. trigger: ['blur', 'change']
  773. }
  774. ],
  775. 'billingDate': [
  776. {
  777. required: true,
  778. message: '开票时间不能为空',
  779. trigger: ['blur', 'change']
  780. }
  781. ],
  782. 'telPhone': [
  783. {
  784. required: true,
  785. message: '电话不能为空',
  786. trigger: ['blur', 'change']
  787. },
  788. {
  789. validator: (rule, value, callback) => this.validatePhone(value, callback),
  790. trigger: ['blur', 'change']
  791. }
  792. ],
  793. 'actualDrawerEmailAddress': [
  794. {
  795. validator: (rule, value, callback) => this.checkEmail(value, callback),
  796. trigger: ['blur']
  797. }
  798. ],
  799. }
  800. }
  801. },
  802. ossService: null,
  803. materialTypeService: null,
  804. wareHouseService: null,
  805. commonApi: null,
  806. // 页面加载时执行
  807. created() {
  808. this.ossService = new OSSService()
  809. this.commonApi = new CommonApi()
  810. this.materialTypeService = new MaterialTypeService()
  811. this.wareHouseService = new WareHouseService()
  812. this.inputForm.actualDrawerEmailAddress = this.userInfo.email
  813. this.inputForm.handledBy = this.userInfo.name
  814. this.inputForm.handledById = this.userInfo.id
  815. this.inputForm.handledByOffice = this.userInfo.officeDTO.id
  816. this.inputForm.handledByOfficeName = this.userInfo.officeDTO.name
  817. },
  818. props: {
  819. businessId: {
  820. type: String,
  821. default: ''
  822. },
  823. formReadOnly: {
  824. type: Boolean,
  825. default: false
  826. },
  827. status: {
  828. type: String,
  829. default: ''
  830. }
  831. },
  832. watch: {
  833. 'businessId': {
  834. handler(newVal) {
  835. if (this.businessId) {
  836. this.init(this.businessId)
  837. } else {
  838. this.$nextTick(() => {
  839. // this.$refs.inputForm.reset()
  840. })
  841. }
  842. },
  843. immediate: true,
  844. deep: false
  845. },
  846. },
  847. methods: {
  848. init(id) {
  849. console.log('this.status', this.status)
  850. this.nodeFlag = true
  851. this.inputForm.id = id
  852. if (id) {
  853. financeInvoiceService.queryById(id).then((data) => {
  854. if (this.status === 'testSee') {
  855. this.nodeFlag = true
  856. this.testFlag = true
  857. } else {
  858. this.commonApi.getTaskNameByProcInsId(data.procInsId).then((data) => {
  859. if (this.isNotEmpty(data)) {
  860. if (data === '发起人重新申请' || this.isEmpty(data)) {
  861. this.nodeFlag = false
  862. } else if (data === '发票管理员审核') {
  863. this.nodeFlag = true
  864. this.addFlag = true
  865. }
  866. } else {
  867. this.testFlag = true
  868. this.addFlag = true
  869. console.log('没有')
  870. }
  871. })
  872. }
  873. this.inputForm = this.recover(this.inputForm, data)
  874. if (this.inputForm.workAttachmentDtoList) {
  875. this.inputForm.workAttachmentDtoList.forEach((item, index) => {
  876. this.$set(this.showFileList, index, true);
  877. })
  878. }
  879. let i = this.inputForm.financeInvoiceBaseDTOList.length
  880. let sun = 0
  881. for (let j = 0; j < i; j++) {
  882. sun = (100 * sun + 100 * this.inputForm.financeInvoiceBaseDTOList[j].account) / 100
  883. }
  884. this.inputForm.accountTotal = sun
  885. this.inputForm.billingDate = this.formatDate(new Date())
  886. if (!this.nodeFlag && this.status !== 'testSee') {
  887. this.inputForm.financeInvoiceDetailDTOList.push({
  888. code: '',
  889. number: '',
  890. account: sun,
  891. rate: '',
  892. amount: '',
  893. tax: '',
  894. allAmount: ''
  895. })
  896. }
  897. if (!this.isEmpty(this.inputForm.billingWorkplaceRealId)) {
  898. this.bankList = []
  899. workClientService.queryById(this.inputForm.billingWorkplaceRealId).then((data) => {
  900. if (this.isNotEmpty(data.cwWorkClientBillingDTOList)) {
  901. data.cwWorkClientBillingDTOList.forEach(i => {
  902. i.ourBank = i.accountHolder
  903. let test = { label: i.ourBank, value: i.id, account: i.account }
  904. this.bankList.push(test)
  905. this.$set(this.inputForm, 'openBank', i.id);
  906. })
  907. } else {
  908. this.bankList = []
  909. }
  910. })
  911. }
  912. })
  913. }
  914. },
  915. formatDate(date) {
  916. const dateNew = new Date(date); // 将日期字符串转换为 Date 对象
  917. const year = dateNew.getFullYear();
  918. const month = (dateNew.getMonth() + 1).toString().padStart(2, '0');
  919. const day = dateNew.getDate().toString().padStart(2, '0');
  920. return `${year}-${month}-${day}`;
  921. },
  922. isEmpty(value) {
  923. let result = false;
  924. if (value == null || value == undefined) {
  925. result = true;
  926. }
  927. if (typeof value == 'string' && (value.replace(/\s+/g, "") == "" || value == "")) {
  928. result = true;
  929. }
  930. if (typeof value == "object" && value instanceof Array && value.length === 0) {
  931. result = true;
  932. }
  933. return result;
  934. },
  935. isNotEmpty(value) {
  936. return !this.isEmpty(value)
  937. },
  938. /**
  939. * 判断是否为空
  940. */
  941. isNull(val) {
  942. if (val instanceof Array) {
  943. if (val.length === 0) return true;
  944. } else if (val instanceof Object) {
  945. if (JSON.stringify(val) === "{}") return true;
  946. } else {
  947. if (
  948. val === "null" ||
  949. val == null ||
  950. val === "undefined" ||
  951. val === undefined ||
  952. val === ""
  953. )
  954. return true;
  955. return false;
  956. }
  957. return false;
  958. },
  959. addRow(type) {
  960. if (type === 'base') {
  961. if (this.inputForm.financeInvoiceBaseDTOList.length === 0) {
  962. this.inputForm.financeInvoiceBaseDTOList.push({
  963. recipientAgent: this.userInfo.name,
  964. recipientAgentId: this.userInfo.id, recipientOffice: this.userInfo.officeDTO.name
  965. });
  966. } else {
  967. if (this.isNotEmpty(this.inputForm.financeInvoiceBaseDTOList[0].programName)) {
  968. this.inputForm.financeInvoiceBaseDTOList.push({
  969. recipientAgent: this.userInfo.name,
  970. recipientAgentId: this.userInfo.id, recipientOffice: this.userInfo.officeDTO.name
  971. });
  972. } else {
  973. uni.showToast({
  974. title: '非项目,只能有一条非项目数据',
  975. icon: 'none',
  976. duration: 2000
  977. });
  978. }
  979. }
  980. } else if (type === 'detail') {
  981. console.log('this.inputForm.accountTotal', this.inputForm.accountTotal)
  982. this.inputForm.financeInvoiceDetailDTOList.push({
  983. code: '',
  984. number: '',
  985. account: this.inputForm.accountTotal,
  986. rate: '',
  987. amount: '',
  988. tax: '',
  989. allAmount: ''
  990. })
  991. }
  992. // 点击新增按钮时,向表格中添加一行空数据
  993. // this.inputForm.financeInvoiceBaseDTOList.push({ recipientAgent: this.userInfo.name,
  994. // recipientAgentId: this.userInfo.id, recipientOffice: this.userInfo.officeDTO.name });
  995. },
  996. removeRow(type, index) {
  997. if (type === 'base') {
  998. // 点击删除按钮时,从表格中移除指定行
  999. this.inputForm.financeInvoiceBaseDTOList.splice(index, 1);
  1000. let currentAccountTotal = 0; // 初始化为 0
  1001. // 遍历 financeInvoiceBaseDTOList,累加每一行的 account
  1002. this.inputForm.financeInvoiceBaseDTOList.forEach(item => {
  1003. currentAccountTotal += parseFloat(item.account || 0); // 获取当前行的 account,若为空则设为 0
  1004. });
  1005. // 设置新的 accountTotal
  1006. this.$set(this.inputForm, 'accountTotal', currentAccountTotal);
  1007. } else if (type === 'detail') {
  1008. this.inputForm.financeInvoiceDetailDTOList.splice(index, 1);
  1009. }
  1010. },
  1011. formatDateNew(date) {
  1012. const year = date.getFullYear();
  1013. const month = (date.getMonth() + 1).toString().padStart(2, '0');
  1014. const day = date.getDate().toString().padStart(2, '0');
  1015. const hours = date.getHours().toString().padStart(2, '0');
  1016. const minutes = date.getMinutes().toString().padStart(2, '0');
  1017. const seconds = date.getSeconds().toString().padStart(2, '0');
  1018. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  1019. },
  1020. handleUploadSuccess(file, fileList) {
  1021. this.inputForm.workAttachmentDtoList = fileList
  1022. // 强制更新视图
  1023. this.$forceUpdate();
  1024. },
  1025. handleRemove(file, fileList) {
  1026. // 处理移除文件逻辑
  1027. // file 是移除的文件
  1028. // fileList 是当前文件列表
  1029. console.log(fileList);
  1030. const formattedFiles = fileList.map(fileItem => {
  1031. return {
  1032. name: fileItem.name,
  1033. size: fileItem.size,
  1034. url: '/' + fileItem.response.url,
  1035. createBy: this.userInfo,
  1036. by: this.userInfo.id,
  1037. createTime: this.formatDateNew(new Date())
  1038. };
  1039. });
  1040. this.inputForm.workAttachmentDtoList = formattedFiles
  1041. },
  1042. saveForm(callback) {
  1043. return new Promise((resolve, reject) => {
  1044. // 表单规则验证
  1045. // ...
  1046. let errors = [];
  1047. if (this.isEmpty(this.inputForm.financeInvoiceBaseDTOList)) {
  1048. errors.push('至少新增一条基本信息');
  1049. } else if (this.isNotEmpty(this.inputForm.financeInvoiceBaseDTOList)) {
  1050. let i = this.inputForm.financeInvoiceBaseDTOList.length;
  1051. for (let j = 0; j < i; j++) {
  1052. let k = j + 1;
  1053. if (this.isEmpty(this.inputForm.financeInvoiceBaseDTOList[j].programName)) {
  1054. errors.push('第' + k + '行的基本信息不能为空');
  1055. }
  1056. if (this.isEmpty(this.inputForm.financeInvoiceBaseDTOList[j].account)) {
  1057. errors.push('第' + k + '行的发票金额不能为空');
  1058. }
  1059. }
  1060. } else {
  1061. if (this.inputForm.type === '1') {
  1062. if (this.isEmpty(this.inputForm.address)) {
  1063. errors.push('地址不能为空');
  1064. }
  1065. if (this.isEmpty(this.inputForm.telPhone)) {
  1066. errors.push('电话不能为空');
  1067. }
  1068. if (this.isEmpty(this.inputForm.openBank)) {
  1069. errors.push('开户银行不能为空');
  1070. }
  1071. if (this.isEmpty(this.inputForm.bankAccount)) {
  1072. errors.push('银行账号不能为空');
  1073. }
  1074. }
  1075. }
  1076. //验证邮箱
  1077. if (this.isNotEmpty(this.inputForm.actualDrawerEmailAddress)) {
  1078. var reg = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
  1079. if (!reg.test(this.inputForm.actualDrawerEmailAddress)) {
  1080. errors.push('请输入正确的邮箱地址');
  1081. }
  1082. }
  1083. if (errors.length > 0) {
  1084. // 存在错误,显示提示信息
  1085. errors.forEach(error => {
  1086. uni.showToast({
  1087. title: error,
  1088. icon: 'none',
  1089. duration: 2000
  1090. });
  1091. });
  1092. reject('Form validation failed');
  1093. } else {
  1094. this.inputForm.account = this.inputForm.accountTotal
  1095. // 所有验证通过,执行保存操作
  1096. this.$refs.inputForm.validate().then(() => {
  1097. uni.showLoading();
  1098. this.inputForm.status = '2';
  1099. financeInvoiceService.saveForm(this.inputForm).then(data => {
  1100. callback(data.businessTable, data.businessId);
  1101. resolve('Form saved successfully');
  1102. }).catch(error => {
  1103. reject('Save operation failed');
  1104. });
  1105. }).catch(() => {
  1106. reject('Form validation failed');
  1107. });
  1108. }
  1109. });
  1110. },
  1111. // 修改状态
  1112. async updateStatusById(type, callback) {
  1113. if (type === 'reject' || type === 'reback') {
  1114. financeInvoiceService.queryById(this.inputForm.id).then((data) => {
  1115. if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
  1116. this.loading = false
  1117. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  1118. throw new Error()
  1119. } else {
  1120. if (type === 'reject') {
  1121. // 驳回
  1122. this.inputForm.status = '4'
  1123. }
  1124. if (type === 'reback') {
  1125. // 撤回
  1126. this.inputForm.status = '3'
  1127. }
  1128. if (type === 'reject' || type === 'reback') {
  1129. let param = { status: this.inputForm.status, id: this.inputForm.id }
  1130. financeInvoiceService.updateStatusById(param).then(() => {
  1131. this.loading = false
  1132. callback()
  1133. })
  1134. }
  1135. }
  1136. })
  1137. } else if (type === 'hold') {
  1138. financeInvoiceService.queryById(this.inputForm.id).then((data) => {
  1139. if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
  1140. this.loading = false
  1141. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  1142. throw new Error()
  1143. } else {
  1144. // 终止
  1145. let param = { status: '1', id: this.inputForm.id }
  1146. financeInvoiceService.updateStatusById(param).then(() => {
  1147. this.loading = false
  1148. callback()
  1149. })
  1150. }
  1151. })
  1152. }
  1153. },
  1154. reapplyForm(callback) {
  1155. this.loading = true
  1156. financeInvoiceService.queryById(this.inputForm.id).then((data) => {
  1157. if (data.status !== '4') { // 审核状态不是“驳回”,就弹出提示
  1158. this.loading = false
  1159. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  1160. throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  1161. } else {
  1162. this.startFormTrue(callback)
  1163. }
  1164. })
  1165. },
  1166. // 送审
  1167. async startFormTrue(callback) {
  1168. this.$refs.inputForm.validate().then(res => {
  1169. this.inputForm.status = '2'
  1170. financeInvoiceService.saveForm(this.inputForm).then((data) => {
  1171. this.inputForm.id = data.businessId
  1172. callback(data.businessTable, data.businessId, this.inputForm)
  1173. this.$refs.inputForm.resetFields()
  1174. this.loading = false
  1175. }).catch(() => {
  1176. this.$refs.inputForm.resetFields()
  1177. }).catch((e) => {
  1178. })
  1179. })
  1180. },
  1181. // 通过
  1182. async agreeForm(callback) {
  1183. return new Promise((resolve, reject) => {
  1184. // 表单规则验证
  1185. // ...
  1186. let errors = [];
  1187. let acc = 0
  1188. let i = this.inputForm.financeInvoiceDetailDTOList.length;
  1189. for (let j = 0; j < i; j++) {
  1190. let k = j + 1;
  1191. if (this.isEmpty(this.inputForm.financeInvoiceDetailDTOList[j].number)) {
  1192. errors.push('发票明细中第' + k + ' 条数据的 “发票号” 为空');
  1193. }
  1194. if (this.isEmpty(this.inputForm.financeInvoiceDetailDTOList[j].account)) {
  1195. errors.push('发票明细中第' + k + ' 条数据的 “开票金额” 为空');
  1196. }
  1197. acc = (acc + parseFloat(parseFloat(this.inputForm.financeInvoiceDetailDTOList[j].account).toFixed(2)))
  1198. }
  1199. if (parseFloat(acc).toFixed(2) !== parseFloat(this.inputForm.account).toFixed(2)) {
  1200. errors.push('发票明细中 “开票金额”总和 与发票详情中 “发票金额” 不等');
  1201. }
  1202. this.inputForm.financeInvoiceDetailDTOList.forEach((item, index) => {
  1203. this.inputForm.financeInvoiceDetailDTOList.forEach((item2, index2) => {
  1204. if (index !== index2) {
  1205. if (item.number === item2.number) {
  1206. errors.push('发票明细中第 ' + (index + 1) + ' 条数据的 “发票号” 存在重复');
  1207. }
  1208. }
  1209. })
  1210. })
  1211. if (errors.length > 0) {
  1212. // 存在错误,显示提示信息
  1213. errors.forEach(error => {
  1214. uni.showToast({
  1215. title: error,
  1216. icon: 'none',
  1217. duration: 2000
  1218. });
  1219. });
  1220. reject('Form validation failed');
  1221. } else {
  1222. // 所有验证通过,执行保存操作
  1223. this.$refs.inputForm.validate().then(res => {
  1224. this.inputForm.status = '5'
  1225. financeInvoiceService.saveForm(this.inputForm).then((data) => {
  1226. callback(data.businessTable, data.businessId, this.inputForm)
  1227. this.$refs.inputForm.resetFields()
  1228. this.loading = false
  1229. }).catch(() => {
  1230. this.loading = false
  1231. this.$refs.inputForm.resetFields()
  1232. })
  1233. })
  1234. }
  1235. });
  1236. },
  1237. shouldShowFile(file) {
  1238. if (this.inputForm.workAttachmentDtoList && this.inputForm.workAttachmentDtoList.length > 0) {
  1239. // 返回一个布尔值,确定是否显示上传成功后的文件
  1240. return this.showFileList[this.inputForm.workAttachmentDtoList.indexOf(file)];
  1241. }
  1242. return false; // 默认返回 false 或者其他适当的
  1243. },
  1244. async handleFileClick(file) {
  1245. await this.ossService.getTemporaryUrl(file.url).then((data) => {
  1246. file.lsUrl = data
  1247. })
  1248. if (this.isImage(file.name)) {
  1249. // 如果是图片文件,则执行放大显示图片的逻辑
  1250. this.handleImageClick(file);
  1251. } else {
  1252. // window.open(file.lsUrl, '_blank')
  1253. window.location.href = file.lsUrl
  1254. // 如果不是图片文件,则执行其他操作,比如下载文件等
  1255. }
  1256. },
  1257. handleImageClick(file) {
  1258. // 在点击图片时执行放大显示的逻辑
  1259. this.$alert(`<img src="${file.lsUrl}" style="max-width: 100%; max-height: 100%;" />`, '图片详情', {
  1260. dangerouslyUseHTMLString: true,
  1261. customClass: 'custom-alert'
  1262. });
  1263. },
  1264. // 判断文件是否是图片类型
  1265. isImage(fileName) {
  1266. const ext = fileName.toLowerCase().split('.').pop(); // 获取文件的后缀名
  1267. return ['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(ext); // 判断后缀名是否是图片类型
  1268. },
  1269. handleDelete(file, fileList, index) {
  1270. // this.handleRemove(file, fileList)
  1271. // 从文件列表中移除文件
  1272. this.inputForm.workAttachmentDtoList.splice(index, 1);
  1273. },
  1274. // 输入值改变事件处理程序
  1275. onInputCode(index, event, type) {
  1276. const inputValue = event
  1277. const formattedValue = this.formatInput(inputValue);
  1278. if (type === 'account') {
  1279. this.$set(this.inputForm.financeInvoiceBaseDTOList[index], 'account', formattedValue)
  1280. // 计算 accountTotal 的新值
  1281. const currentAccountTotal = parseFloat(this.inputForm.accountTotal || 0); // 获取当前 accountTotal,若为空则设为 0
  1282. const newAccountTotal = currentAccountTotal + parseFloat(formattedValue);
  1283. // 设置新的 accountTotal
  1284. this.$set(this.inputForm, 'accountTotal', newAccountTotal);
  1285. }
  1286. },
  1287. // 通用的输入限制和格式化方法
  1288. formatInput(inputValue, decimalLimit = 2) {
  1289. // 如果输入值不是数字或者不是有效的小数,则返回空字符串
  1290. if (!/^\d*\.?\d*$/.test(inputValue)) {
  1291. return '';
  1292. }
  1293. // 只保留数字和一个小数点
  1294. let value = inputValue.replace(/[^\d.]/g, '');
  1295. // 只允许一个小数点
  1296. const dotIndex = value.indexOf('.');
  1297. if (dotIndex !== -1) {
  1298. const substr = value.substr(dotIndex + 1);
  1299. if (substr.indexOf('.') !== -1) {
  1300. value = value.substr(0, dotIndex + 1) + substr.replace(/\./g, '');
  1301. }
  1302. }
  1303. // 限制小数位数为指定的decimalLimit位数
  1304. if (dotIndex !== -1) {
  1305. const integerPart = value.substring(0, dotIndex);
  1306. const decimalPart = value.substring(dotIndex + 1);
  1307. value = integerPart + '.' + decimalPart.slice(0, decimalLimit);
  1308. }
  1309. return value;
  1310. },
  1311. reimbursementTypeChange(value) {
  1312. this.inputForm.address = ''
  1313. this.inputForm.telPhone = ''
  1314. this.inputForm.billingId = ''
  1315. this.inputForm.billingWorkplaceReal = ''
  1316. this.inputForm.billingWorkplaceRealId = ''
  1317. this.inputForm.taxpayerIdentificationNo = ''
  1318. this.bankList = []
  1319. this.inputForm.bankAccount = ''
  1320. this.inputForm.openBank = ''
  1321. this.inputForm.name = ''
  1322. },
  1323. openUserPullForm(index, type) {
  1324. // 点击 "采购人" 输入框时打开userPullForm页面,传入index用于区分不同的行
  1325. // uni.navigateTo({
  1326. // url: '/pages/materialManagement/collect/UserPullForm?index=' + index // userPullForm页面的路径
  1327. // });
  1328. this.$refs.userPicker.open(index, type);
  1329. },
  1330. handleEvent(data, index, type) {
  1331. if (type === '实际') {
  1332. this.inputForm.billingPeopleRealName = data.label
  1333. this.inputForm.billingPeopleReal = data.id
  1334. } else if (type === '对账') {
  1335. this.inputForm.reconciliationPeopleName = data.label
  1336. this.inputForm.reconciliationPeople = data.id
  1337. } else if (type === '姓名') {
  1338. this.inputForm.nameShow = data.label
  1339. this.inputForm.name = data.id
  1340. }
  1341. },
  1342. // 显示 项目选择器
  1343. showProject(index) {
  1344. if (this.inputForm.financeInvoiceBaseDTOList.length > 0 && this.isNotEmpty(this.inputForm.financeInvoiceBaseDTOList[0].programName)) {
  1345. if (this.isNotEmpty(this.inputForm.financeInvoiceBaseDTOList[0].reportNo)) {
  1346. this.$refs.invoiceProjectChoose.init(index, '2');
  1347. } else {
  1348. this.$refs.invoiceProjectChoose.init(index, '1');
  1349. }
  1350. } else {
  1351. this.$refs.invoiceProjectChoose.init(index);
  1352. }
  1353. },
  1354. // 实际开票单位选择
  1355. showWorkplace() {
  1356. this.$refs.workPlaceChoose.init();
  1357. },
  1358. selectProjectChange(rows, index) {
  1359. if (rows.length > 0) {
  1360. rows.forEach((item, rowIndex) => {
  1361. this.inputForm.programId = item.id;
  1362. if (rowIndex === 0) {
  1363. let r = this.inputForm.financeInvoiceBaseDTOList[index];
  1364. if (!r) {
  1365. r = {};
  1366. }
  1367. r.programName = item.projectName;
  1368. r.contractName = item.contractName;
  1369. r.programNo = item.projectNumber;
  1370. r.contractId = item.contractId;
  1371. r.programId = item.id;
  1372. r.reportNo = item.reportNo;
  1373. r.reportType = item.reportType;
  1374. r.isPreInvoice = item.isPreInvoice;
  1375. this.$set(this.inputForm.financeInvoiceBaseDTOList, index, r);
  1376. } else {
  1377. let r = {
  1378. programName: item.projectName,
  1379. contractName: item.contractName,
  1380. programNo: item.projectNumber,
  1381. contractId: item.contractId,
  1382. programId: item.id,
  1383. reportNo: item.reportNo,
  1384. reportType: item.reportType,
  1385. isPreInvoice: item.isPreInvoice
  1386. }
  1387. this.inputForm.financeInvoiceBaseDTOList.push(r);
  1388. }
  1389. });
  1390. } else {
  1391. let r = {
  1392. programName: rows.projectName,
  1393. contractName: rows.contractName,
  1394. programNo: rows.projectNumber,
  1395. contractId: rows.contractId,
  1396. programId: rows.id,
  1397. reportNo: rows.reportNo,
  1398. reportType: rows.reportType,
  1399. isPreInvoice: rows.isPreInvoice
  1400. }
  1401. if (!this.inputForm.detailInfoReports) {
  1402. this.$set(this.inputForm, 'detailInfoReports', []);
  1403. }
  1404. this.$set(this.inputForm.detailInfoReports, index, r);
  1405. this.isPreInvoice = rows.isPreInvoice;
  1406. this.inputForm.programId = rows.id;
  1407. }
  1408. },
  1409. getWorkClient(row) {
  1410. this.bankList = []
  1411. this.inputForm.billingWorkplaceReal = row.name // 实际开票单位姓名
  1412. this.inputForm.billingWorkplaceRealId = row.id // 实际开票单位id ‘客户id’
  1413. this.inputForm.taxpayerIdentificationNo = this.isEmpty(row.uscCode) ? '' : row.uscCode // 纳税人识别号 ‘统一社会信用代码’
  1414. this.inputForm.address = this.isEmpty(row.address) ? '' : row.address // 地址
  1415. this.inputForm.telPhone = this.isEmpty(row.mobile) ? '' : row.mobile // 电话
  1416. this.inputForm.billingId = '' // 实际开票单位的开票信息id
  1417. // this.inputForm.telPhone = '' // 电话
  1418. for (let i = 0; i < row.cwWorkClientBillingDTOList.length; i++) {
  1419. row.cwWorkClientBillingDTOList[i].ourBank = row.cwWorkClientBillingDTOList[i].accountHolder
  1420. let test = { label: row.cwWorkClientBillingDTOList[i].ourBank, value: row.cwWorkClientBillingDTOList[i].id, account: row.cwWorkClientBillingDTOList[i].account }
  1421. this.bankList.push(test)
  1422. }
  1423. // row.cwWorkClientBillingDTOList.forEach(item => {
  1424. // item.ourBank = item.accountHolder
  1425. // this.bankList.push(item)
  1426. // })
  1427. this.inputForm.bankAccount = ''
  1428. this.inputForm.openBank = ''
  1429. this.$forceUpdate()
  1430. },
  1431. changeBank(value) {
  1432. this.bankList.forEach(item => {
  1433. if (item.value === value) {
  1434. this.inputForm.bankAccount = item.account
  1435. }
  1436. })
  1437. },
  1438. validatePhone(str, callback) {
  1439. const phone = /(^(\d{3,4}-)?\d{6,8}$)|(^(\d{3,4}-)?\d{6,8}(-\d{1,5})?$)|(^(((13[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})|(19[0-9]{1}))+\d{8})$)/
  1440. if (str && !phone.test(str)) {
  1441. callback(new Error('请输入正确的电话号码'))
  1442. } else {
  1443. callback()
  1444. }
  1445. },
  1446. checkEmail(str, callback) {
  1447. if (!this.isNotEmpty(str)) {
  1448. callback(); // 输入框为空时不进行验证,直接清除错误提示
  1449. return;
  1450. }
  1451. var reg = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
  1452. if (!reg.test(str)) {
  1453. callback(new Error('请输入正确的邮箱地址'))
  1454. } else {
  1455. callback()
  1456. }
  1457. },
  1458. openDia() {
  1459. let id = this.userInfo.id
  1460. let userEmail = this.inputForm.actualDrawerEmailAddress
  1461. this.$refs.emailForm.init(id, userEmail);
  1462. },
  1463. emailForm(row) {
  1464. this.inputForm.actualDrawerEmailAddress = row
  1465. },
  1466. checkRate(rate, rowIndex) {
  1467. if (!this.isEmpty(rate)) {
  1468. if (parseFloat(rate) < 1 || parseFloat(rate) > 100) {
  1469. uni.showToast({
  1470. title: '“税率” 请填写 1 到 100 之间的数字,请重新输入',
  1471. icon: 'none',
  1472. duration: 2000
  1473. });
  1474. rate = ''
  1475. }
  1476. }
  1477. this.getAmount(rate, rowIndex)
  1478. this.getTax(rate, rowIndex)
  1479. },
  1480. // 根据开票金额和税率计算出金额: 开票金额-税率*开票金额
  1481. getAmount(rate, rowIndex) {
  1482. let amount = this.inputForm.financeInvoiceDetailDTOList[rowIndex].amount
  1483. let account = this.inputForm.financeInvoiceDetailDTOList[rowIndex].account
  1484. if (!this.isEmpty(account) && !this.isEmpty(rate)) {
  1485. amount = parseFloat((parseFloat(account) - parseFloat((parseFloat(account) * parseFloat((parseFloat(rate) / 100).toFixed(4))).toFixed(4))).toFixed(2))
  1486. } else {
  1487. amount = ''
  1488. }
  1489. this.$set(this.inputForm.financeInvoiceDetailDTOList[rowIndex], 'amount', amount)
  1490. },
  1491. // 根据开票金额和税率计算出税额: 税率*开票金额
  1492. getTax(rate, rowIndex) {
  1493. let tax = this.inputForm.financeInvoiceDetailDTOList[rowIndex].tax
  1494. let account = this.inputForm.financeInvoiceDetailDTOList[rowIndex].account
  1495. if (!this.isEmpty(account) && !this.isEmpty(rate)) {
  1496. tax = parseFloat((parseFloat(account) * parseFloat((parseFloat(rate) / 100).toFixed(4))).toFixed(2))
  1497. } else {
  1498. tax = ''
  1499. }
  1500. this.$set(this.inputForm.financeInvoiceDetailDTOList[rowIndex], 'tax', tax)
  1501. },
  1502. // 下载模板
  1503. downloadTpl() {
  1504. financeInvoiceService.exportTemplate().then((res) => {
  1505. console.log('res', res)
  1506. // 将二进制流文件写入excel表,以下为重要步骤
  1507. this.downloadExcel(res, '发票明细导入模板')
  1508. }).catch(function (err) {
  1509. if (err.response) {
  1510. console.log(err.response)
  1511. }
  1512. })
  1513. },
  1514. downloadExcel(data, filename) {
  1515. if (filename.indexOf(".xls") === -1) {
  1516. filename = filename + ".xls"
  1517. }
  1518. var blob = new Blob([data], {
  1519. type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
  1520. }); // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet这里表示xlsx类型
  1521. var downloadElement = document.createElement("a");
  1522. var href = window.URL.createObjectURL(blob); // 创建下载的链接
  1523. downloadElement.href = href;
  1524. downloadElement.download = filename; // 下载后文件名
  1525. document.body.appendChild(downloadElement);
  1526. downloadElement.click(); // 点击下载
  1527. document.body.removeChild(downloadElement); // 下载完成移除元素
  1528. window.URL.revokeObjectURL(href); // 释放掉blob对象
  1529. },
  1530. async validateNumber(index) {
  1531. const numberString = this.inputForm.financeInvoiceDetailDTOList[index].number.trim(); // 去除空格
  1532. let errorDetected = false; // 布尔变量用于检测是否有错误发生
  1533. if (this.isNotEmpty(numberString)) {
  1534. if (!/^\d+$/.test(numberString)) { // 使用正则表达式检查是否只包含数字字符
  1535. uni.showToast({
  1536. title: '发票号只能输入整数',
  1537. icon: 'none',
  1538. duration: 2000
  1539. });
  1540. errorDetected = true; // 如果有错误,设置为 true
  1541. }
  1542. // 验证发票号是否大于 8 位
  1543. if (parseInt(numberString) > 99999999) {
  1544. uni.showToast({
  1545. title: '“发票号” 不可以大于 8 位,请重新输入',
  1546. icon: 'none',
  1547. duration: 2000
  1548. });
  1549. errorDetected = true; // 如果有错误,设置为 true
  1550. }
  1551. // 验证是否重复
  1552. for (let i = 0; i < this.inputForm.financeInvoiceDetailDTOList.length; i++) {
  1553. if (index !== i && numberString === this.inputForm.financeInvoiceDetailDTOList[i].number) {
  1554. uni.showToast({
  1555. title: '“发票号” 已存在,请重新输入',
  1556. icon: 'none',
  1557. duration: 2000
  1558. });
  1559. errorDetected = true; // 如果有错误,设置为 true
  1560. break; // 找到重复即可跳出循环
  1561. }
  1562. }
  1563. // 查询是否已存在
  1564. await financeInvoiceService.queryByNumber(numberString, '').then((data) => {
  1565. if (data === true) {
  1566. uni.showToast({
  1567. title: '“发票号” 已存在,请重新输入',
  1568. icon: 'none',
  1569. duration: 2000
  1570. });
  1571. errorDetected = true; // 如果有错误,设置为 true
  1572. }
  1573. });
  1574. // 只在发生错误时清空输入字段
  1575. if (errorDetected) {
  1576. this.$set(this.inputForm.financeInvoiceDetailDTOList[index], 'number', '');
  1577. }
  1578. }
  1579. }
  1580. }
  1581. }
  1582. </script>
  1583. <style>
  1584. .cu-form-group .title {
  1585. min-width: calc(4em + 40px);
  1586. }
  1587. /* 样式示例,您可能需要根据实际情况调整 */
  1588. .upload-demo {
  1589. width: 40%;
  1590. }
  1591. .button-container {
  1592. margin-top: 10px;
  1593. text-align: right;
  1594. }
  1595. </style>