InvoiceFormTask.vue 87 KB

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