ticket.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. <template>
  2. <div class="ticket" v-if="showTicket">
  3. <div class="search-list">
  4. <div class="search-left">
  5. <el-select v-model="logicJudge">
  6. <el-option value="and" label="并且"></el-option>
  7. <el-option value="or" label="或者"></el-option>
  8. </el-select>
  9. </div>
  10. <div class="search-right">
  11. <div class="search-type" v-for="(item, index) in searchList">
  12. <el-select v-model="item.name" style="margin-right: 20px; width: 200px" disabled>
  13. <el-option value="contactPersonPhone" label="对接人"></el-option>
  14. <el-option value="signDate" label="签单时间"></el-option>
  15. <el-option value="ptlAgreement" label="出单协议"></el-option>
  16. <el-option value="orderType" label="订单类型"></el-option>
  17. <el-option value="signYear" label="签单年份"></el-option>
  18. </el-select>
  19. <el-select v-model="item.type" v-if="item.name != 'signDate'" style="margin-right: 20px; width: 150px"
  20. @change="val => signDateSelectChange(index, val)">
  21. <el-option value="等于" label="等于"></el-option>
  22. <el-option value="不等于" label="不等于"></el-option>
  23. <el-option value="包含" label="包含"></el-option>
  24. <el-option value="不包含" label="不包含"></el-option>
  25. <el-option value="为空" label="为空"></el-option>
  26. </el-select>
  27. <el-select v-model="item.type" v-else style="margin-right: 20px; width: 150px"
  28. @change="val => signDateSelectChange(index, val)">
  29. <el-option value="大于等于" label="大于等于"></el-option>
  30. <el-option value="小于等于" label="小于等于"></el-option>
  31. <el-option value="固定范围" label="固定范围"></el-option>
  32. <el-option value="不在固定范围" label="不在固定范围"></el-option>
  33. <el-option value="为空" label="为空"></el-option>
  34. </el-select>
  35. <el-select class="w-350px" v-if="item.name == 'contactPersonPhone'" v-model="item.search" placeholder="请选择"
  36. clearable :disabled="item.type == '为空'">
  37. <el-option v-for="item in options" :key="item.contactPersonPhone" :value="item.contactPersonPhone"
  38. :label="item.contactPerson"></el-option>
  39. </el-select>
  40. <el-date-picker style="width: 350px" v-model="datesearch" v-if="item.name == 'signDate'"
  41. :type="item.type == '大于等于' || item.type == '小于等于' ? 'date' : 'daterange'" placeholder="请选择"
  42. :disabled="item.type == '为空'" @change="handlePtlAgreementChange(index, $event)" value-format="YYYY-MM-DD" />
  43. <el-select style="width: 350px" v-model="multipleSearch" v-if="item.name == 'ptlAgreement'" multiple
  44. filterable :disabled="item.type == '为空'" @change="handlePtlAgreementChange(index, $event)">
  45. <el-option v-for="item in insurerContract" :key="item.id" :value="item.id"
  46. :label="item.agreementName"></el-option>
  47. </el-select>
  48. <el-select style="width: 350px" v-model="orderTypesearch" v-if="item.name == 'orderType'" multiple
  49. :disabled="item.type == '为空'" @change="handlePtlAgreementChange(index, $event)">
  50. <el-option value="1" label="车险订单"></el-option>
  51. <el-option value="2" label="代客录单"></el-option>
  52. <el-option value="3" label="补录订单"></el-option>
  53. </el-select>
  54. <el-date-picker v-if="item.name == 'signYear'" style="width: 350px" format="YYYY" value-format="YYYY"
  55. v-model="yearrangesearch" type="yearrange" range-separator="-" :disabled="item.type == '为空'"
  56. @change="handlePtlAgreementChange(index, $event)" />
  57. <!-- <el-icon style="margin-left: 20px; cursor:pointer;"><CircleClose /></el-icon> -->
  58. </div>
  59. <el-button type="primary" @click="handleSearch">搜索</el-button>
  60. </div>
  61. </div>
  62. <div class="tips">
  63. <p>应收明细</p>
  64. <el-button type="primary" @click="addTicket">添加应收</el-button>
  65. </div>
  66. <el-table :data="tableData" style="height: calc(100% - 340px)">
  67. <template #empty>
  68. <div v-if="noData">暂无应收,点击<el-button link type="primary" @click="batchShow = true">导入应收</el-button></div>
  69. <div v-else>没有符合的应收单据~</div>
  70. </template>
  71. <el-table-column prop="licenseNo" label="车牌号"></el-table-column>
  72. <el-table-column prop="companyName" label="保险公司"></el-table-column>
  73. <el-table-column prop="signingTime" label="签单时间"></el-table-column>
  74. <el-table-column prop="agreementName" label="协议名称"></el-table-column>
  75. <el-table-column prop="orderType" label="订单类型"></el-table-column>
  76. <el-table-column prop="signYear" label="签单年份"></el-table-column>
  77. <el-table-column prop="orderNo" label="订单号"></el-table-column>
  78. <el-table-column prop="jqPolicyNo" label="交强保单号"></el-table-column>
  79. <el-table-column prop="syPolicyNo" label="商业保单号"></el-table-column>
  80. <el-table-column prop="jqPremium" label="交强险保费"></el-table-column>
  81. <el-table-column prop="jqSuperviseCostsProportion" label="交强险手续费比例"></el-table-column>
  82. <el-table-column prop="syPremium" label="商业险保费"></el-table-column>
  83. <el-table-column prop="sySuperviseCostsProportion" label="商业险手续费比例"></el-table-column>
  84. <el-table-column label="应收金额">
  85. <template #default="scope">
  86. {{ scope.row.productId === '0330' || scope.row.productId === '0330034002' || scope.row.productId ===
  87. '034002' ? scope.row.jqSuperviseCostsPremiums : scope.row.productId === '034001' || scope.row.productId ===
  88. '0330034001' ? scope.row.sySuperviseCostsPremiums : '' }}
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. <div class="footer">
  93. <el-button plain @click="handleBack">取消</el-button>
  94. <el-button type="primary" @click="handleSettlement">结算</el-button>
  95. </div>
  96. <el-dialog :close-on-click-modal="false" v-model="addShow" width="800" title="添加应收">
  97. <div class="add-content">
  98. <el-input v-model="addSearchValue" style="max-width: 500px" :placeholder="`请输入${placeholder}`"
  99. class="input-with-select">
  100. <template #prepend>
  101. <el-select v-model="addSelectType" placeholder="请选择" style="width: 120px"
  102. @change="handleAddSelectTypeChange">
  103. <el-option label="订单号查询" value="1" />
  104. <el-option label="交强险保单号查询" value="2" />
  105. <el-option label="商业险保单号查询" value="3" />
  106. </el-select>
  107. </template>
  108. <template #append>
  109. <el-button type="primary" @click="getUnauditedOrder">搜索</el-button>
  110. </template>
  111. </el-input>
  112. <el-table :data="selectingData" style="width: 100%;">
  113. <el-table-column prop="a" label="费用状态" width="100"></el-table-column>
  114. <el-table-column prop="signingTime" label="签单时间" width="120"></el-table-column>
  115. <el-table-column prop="licenseNo" label="车牌号" width="120"></el-table-column>
  116. <el-table-column prop="jqPolicyNo" label="交强保单号" width="120"></el-table-column>
  117. <el-table-column prop="syPolicyNo" label="商业保单号" width="120"></el-table-column>
  118. <el-table-column prop="jqPremium" label="交强保费" width="100"></el-table-column>
  119. <el-table-column prop="jqSuperviseCostsProportion" label="交强手续费比例" width="100"></el-table-column>
  120. <el-table-column prop="syPremium" label="商业保费" width="100"></el-table-column>
  121. <el-table-column prop="sySuperviseCostsProportion" label="商业手续费比例" width="100"></el-table-column>
  122. <el-table-column prop="a" label="应收金额" width="100"></el-table-column>
  123. <el-table-column label="操作" fixed="right" width="100">
  124. <template #default="scope">
  125. <el-button link type="primary" @click="handleToAdd(scope.row)">添加</el-button>
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. <p>已添加的应收单据</p>
  130. <el-table :data="selectedData" style="width: 100%;">
  131. <el-table-column prop="a" label="费用状态" width="100"></el-table-column>
  132. <el-table-column prop="signingTime" label="签单时间" width="120"></el-table-column>
  133. <el-table-column prop="licenseNo" label="车牌号" width="120"></el-table-column>
  134. <el-table-column prop="jqPolicyNo" label="交强保单号" width="120"></el-table-column>
  135. <el-table-column prop="syPolicyNo" label="商业保单号" width="120"></el-table-column>
  136. <el-table-column prop="jqPremium" label="交强保费" width="100"></el-table-column>
  137. <el-table-column prop="jqSuperviseCostsProportion" label="交强手续费比例" width="100"></el-table-column>
  138. <el-table-column prop="syPremium" label="商业保费" width="100"></el-table-column>
  139. <el-table-column prop="sySuperviseCostsProportion" label="商业手续费比例" width="100"></el-table-column>
  140. <el-table-column prop="a" label="应收金额" width="100"></el-table-column>
  141. <el-table-column label="操作" fixed="right" width="100">
  142. <template #default="scope">
  143. <el-button link type="primary" @click="handleDel(scope.row)">删除</el-button>
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. </div>
  148. <template #footer>
  149. <el-button class="border-[#0083FF] color-[#0083FF]" plain @click="addShow = false">取消</el-button>
  150. <el-button type="primary" @click="handleAddSubmit">确定</el-button>
  151. </template>
  152. </el-dialog>
  153. <el-image-viewer v-if="imageShow" :url-list="[bigImageUrl]" @close="imageShow = false" />
  154. </div>
  155. <el-dialog :close-on-click-modal="false" v-model="settlementDialog" width="600" title="结算">
  156. <el-form ref="CountFormRef" :model="countForm" :rules="settlementRules" label-width="120">
  157. <el-form-item label="应收金额">
  158. <el-input v-model="receivablePremium" placeholder="请输入" disabled></el-input>
  159. </el-form-item>
  160. <el-form-item prop="actualReceivedAmount" label="实收金额">
  161. <el-input-number v-model="countForm.actualReceivedAmount" style="width: 100%;" :min="0" :precision="4"
  162. controls-position="right" @change="handleChange" />
  163. </el-form-item>
  164. <el-form-item prop="paymentDifference" label="回款差额">
  165. <el-input v-model="countForm.paymentDifference" disabled></el-input>
  166. </el-form-item>
  167. <el-form-item prop="paymentReason" label="差额原因">
  168. <el-input v-model="countForm.paymentReason" placeholder="请输入"></el-input>
  169. </el-form-item>
  170. <el-form-item prop="receivePaymentDate" label="收款日期">
  171. <el-date-picker v-model="countForm.receivePaymentDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
  172. format="YYYY-MM-DD HH:mm:ss" />
  173. </el-form-item>
  174. <el-form-item prop="attachmentIds" label="收款凭证" class="upload-btn">
  175. <el-upload style="margin: 0 10px 10px 0" :auto-upload="false" multiple v-if="!countForm.h"
  176. :show-file-list="false" accept=".png, .jpg, .jpeg" @change="uploadImage" drag>
  177. <el-button style="height: 0;" link size="large" icon="Plus" />
  178. </el-upload>
  179. <div class="imageDiv" v-for="(item, index) in imageUrl" :key="item">
  180. <img :src="item" />
  181. <div class="model">
  182. <span class="icon-view" @click="handelViewImage(item, index)">
  183. <el-icon>
  184. <View />
  185. </el-icon>
  186. </span>
  187. <span class="icon-del" @click="handelDelImage(item, index)">
  188. <el-icon>
  189. <Delete />
  190. </el-icon>
  191. </span>
  192. </div>
  193. </div>
  194. <!-- <el-upload action="https://tennat.baoxianzhanggui.com/api/file/upload" drag
  195. v-model:file-list="countForm.attachmentIds" multiple list-type="picture-card">
  196. <el-icon>
  197. <Plus />
  198. </el-icon>
  199. </el-upload> -->
  200. </el-form-item>
  201. </el-form>
  202. <template #footer>
  203. <el-button class="border-[#0083FF] color-[#0083FF]" plain @click="settlementDialog = false">取消</el-button>
  204. <el-button type="primary" @click="handelComfirm(CountFormRef)">确定结算</el-button>
  205. </template>
  206. </el-dialog>
  207. <el-dialog v-model="batchShow" width="800" title="数据导入">
  208. <div style="display: flex; align-items: center; justify-content: center; margin-bottom: 10px">
  209. 下载「标准导入模板」,编辑后上传;系统将自动匹配相关字段
  210. <el-button link type="primary" @click="downloadTemplate">下载模板</el-button>
  211. </div>
  212. <el-upload class="upload-demo " drag accept=".xls, .xlsx" :auto-upload="false" @change="uploadJYFile">
  213. <div class="flex f-c a-c">
  214. <el-icon class="el-icon--upload"><upload-filled /></el-icon>
  215. <div class="el-upload__text">
  216. 点击或将文件拖拽到这里上传
  217. </div>
  218. <a style="color: #999; font-size: 12px">目前支持的文件类型为*.xls, *.xlsx</a>
  219. </div>
  220. </el-upload>
  221. <div v-if="importModifyCallback">
  222. <div>
  223. 您将导入 <span style="color:#409eff;">{{ importModifyCallback?.failedNumber +
  224. importModifyCallback?.successNumber
  225. ||
  226. 0 }}
  227. </span> 条数据,其中 <span style="color:#409eff;">{{ importModifyCallback?.successNumber || 0 }} </span>
  228. 条正常导入;<span style="color: red;">{{ importModifyCallback?.failedNumber || 0 }}</span> 条不符合要求无法导入。
  229. </div>
  230. <el-button type="primary" link @click="downloadImportFailedData(importModifyCallback)">下载导入失败文件</el-button>
  231. </div>
  232. <template #footer>
  233. <el-button class="border-[#0083FF] color-[#0083FF]" plain @click="batchShow = false">取消</el-button>
  234. <el-button type="primary" @click="batchShow = false">确定</el-button>
  235. </template>
  236. </el-dialog>
  237. </template>
  238. <script setup lang="ts">
  239. import api from '@/api'
  240. import { useRoute, useRouter } from 'vue-router'
  241. import { ElMessage, FormInstance } from "element-plus";
  242. let route = useRoute()
  243. let router = useRouter()
  244. const CountFormRef = ref<FormInstance>()
  245. const batchShow = ref(false)//数据导入弹窗
  246. const selectedList = ref([])//选中的应收单据
  247. const options = ref()//保险公司
  248. const insurerContract = ref()//保险公司协议
  249. const multipleSearch = ref('')
  250. const orderTypesearch = ref('')
  251. const yearrangesearch = ref('')
  252. const datesearch = ref('')
  253. const countForm = ref({
  254. invoicingId: '',
  255. actualReceivedAmount: '',
  256. paymentDifference: '',
  257. paymentReason: '',
  258. receivePaymentDate: '',
  259. attachmentIds: [],
  260. })
  261. const receivablePremium = ref('')
  262. const settlementDialog = ref(false)//结算弹窗
  263. let settlementRules = ref({
  264. actualReceivedAmount: [{ required: true, trigger: "blur", message: "请输入" }],
  265. receivePaymentDate: [{ required: true, trigger: "change", message: "请选择" }],
  266. attachmentIds: [{ required: true, message: "请上传" }]
  267. })
  268. let imageUrl = ref([])
  269. //获取保险公司协议
  270. const getByCompanyId = () => {
  271. api.dispatchApi.getByCompanyIdt(route.query.contactPersonPhone).then((res: any) => {
  272. if (res.code == 200) {
  273. insurerContract.value = res.data
  274. }
  275. })
  276. }
  277. //保险公司协议
  278. const initData = () => {
  279. // router
  280. api.financeApi.getSelectedReceivableList({ orderNos: selectedList.value.map(v => v.orderNo), searchList: searchList.value, logicJudge: logicJudge.value, }).then((res: any) => {
  281. if (res.code == 200) {
  282. tableData.value = res.data
  283. initCompany()
  284. }
  285. })
  286. }
  287. let logicJudge = ref('and')
  288. let searchList = ref([
  289. {
  290. name: 'contactPersonPhone',
  291. type: '等于',
  292. search: ''
  293. }, {
  294. name: 'signDate',
  295. type: '固定范围',
  296. search: ''
  297. }, {
  298. name: 'ptlAgreement',
  299. type: '等于',
  300. search: ''
  301. }, {
  302. name: 'orderType',
  303. type: '等于',
  304. search: ''
  305. }, {
  306. name: 'signYear',
  307. type: '等于',
  308. search: ''
  309. }
  310. ])
  311. // 保险公司
  312. const initCompany = () => {
  313. api.financeApi.queryReceivableContact({
  314. incomeIds: tableData.value.map((item: any) => item.id)
  315. }).then((res: any) => {
  316. if (res.code == 200) {
  317. options.value = res.data
  318. }
  319. })
  320. }
  321. const showTicket = ref(false)
  322. const contactPersonPhone = ref('')
  323. if (route.query?.invoiceType) {
  324. showTicket.value = true
  325. selectedList.value = JSON.parse(route.query.selectedList || '[]')
  326. searchList.value[0].search = route.query.contactPersonPhone || ''
  327. contactPersonPhone.value = route.query.contactPersonPhone || ''
  328. getByCompanyId()
  329. initData()
  330. } else {
  331. showTicket.value = false
  332. }
  333. const downloadTemplate = () => {
  334. api.financeApi.exportAccountsReceivableInvoiceTemplate({}).then((res: any) => {
  335. if (res.code == 200) {
  336. const link = document.createElement('a');
  337. fetch(res.msg).then((res) => res.blob())
  338. .then((blob) => {
  339. // 将链接地址字符内容转变成blob地址
  340. link.href = URL.createObjectURL(blob)
  341. console.log(link.href)
  342. link.download = '平台结算导入模版.xlsx' //下载的文件的名字
  343. document.body.appendChild(link)
  344. link.click()
  345. })
  346. }
  347. })
  348. }
  349. let importModifyCallback = ref()// 导入数据回调
  350. const uploadJYFile = async (file) => {
  351. let files = file.raw
  352. const params = new FormData(); // 声明formData数据类型
  353. params.append("file", files);
  354. const { code, data, msg } = await api.financeApi.importAccountsReceivableInvoice(params)
  355. if (code == 200) {
  356. importModifyCallback.value = data
  357. if (data.orderNos.length > 0) {
  358. api.financeApi.getSelectedReceivableList({ orderNos: data.orderNos }).then((res: any) => {
  359. if (res.code == 200) {
  360. tableData.value = res.data
  361. }
  362. })
  363. }
  364. ElMessage({
  365. message: msg,
  366. type: 'success'
  367. })
  368. }
  369. }
  370. // 下载导入失败文件
  371. const downloadImportFailedData = (item) => {
  372. const link = document.createElement('a');
  373. link.href = item.failFileUrl;
  374. link.download = '';
  375. // 触发下载
  376. document.body.appendChild(link);
  377. link.click();
  378. document.body.removeChild(link);
  379. }
  380. let noData = ref(true)
  381. let tableData = ref([])
  382. const addTicket = () => {
  383. addShow.value = true
  384. }
  385. const handleSearch = () => {
  386. console.log(searchList.value)
  387. // router
  388. api.financeApi.getSelectedReceivableList({
  389. orderNos: selectedList.value.map(item => item.orderNo),
  390. searchList: searchList.value,
  391. logicJudge: logicJudge.value,
  392. }).then((res: any) => {
  393. if (res.code == 200) {
  394. tableData.value = res.data
  395. }
  396. })
  397. }
  398. let addShow = ref(false)
  399. let addSearchValue = ref('')
  400. let placeholder = ref('订单号查询')
  401. let addSelectType = ref('1')
  402. const handleAddSelectTypeChange = (e) => {
  403. switch (e) {
  404. case '1':
  405. placeholder.value = '订单号查询'
  406. break;
  407. case '2':
  408. placeholder.value = '交强险保单号查询'
  409. break;
  410. case '3':
  411. placeholder.value = '商业险保单号查询'
  412. break;
  413. }
  414. }
  415. let selectingData = ref([])
  416. let selectedData = ref([])
  417. // 出单协议多选转换
  418. const handlePtlAgreementChange = (index: any, e: any) => {
  419. console.log(e)
  420. if (Array.isArray(e)) {
  421. searchList.value[index].search = e.join(',') || ''
  422. } else {
  423. searchList.value[index].search = e || ''
  424. }
  425. }
  426. // 签单时间选择器改变时触发
  427. const signDateSelectChange = (index: any, e: any) => {
  428. switch (e) {
  429. case '为空':
  430. searchList.value[index].search = ''
  431. break;
  432. case '大于等于':
  433. case '小于等于':
  434. searchList.value[index].search = ''
  435. datesearch.value = ''
  436. break;
  437. }
  438. }
  439. // 未审核订单查询
  440. const getUnauditedOrder = () => {
  441. api.financeApi.getUnauditedOrder(addSearchValue.value).then((res: any) => {
  442. if (res.code == 200) {
  443. selectingData.value = res.data
  444. }
  445. })
  446. }
  447. const handleDel = (row) => {
  448. selectedData.value = selectedData.value.filter(item => item.id != row.id)
  449. }
  450. const handleAddSubmit = () => {
  451. if (selectedData.value.length < 1) {
  452. ElMessage({
  453. message: '请选择要添加的数据!',
  454. type: 'warning'
  455. })
  456. } else {
  457. api.financeApi.addReceivable(selectedData.value).then((res: any) => {
  458. if (res.code == 200) {
  459. ElMessage({
  460. message: res.msg,
  461. type: 'success'
  462. })
  463. addShow.value = false
  464. }
  465. })
  466. }
  467. }
  468. const handleToAdd = (row) => {
  469. if (selectedData.value.length < 1) {
  470. selectedData.value.push(row)
  471. } else {
  472. if (!selectedData.value.some(item => item.id === row.id)) {
  473. selectedData.value.push(row)
  474. }
  475. }
  476. }
  477. let imageShow = ref(false)
  478. let bigImageUrl = ref('')
  479. const handelViewImage = (item, index) => {
  480. bigImageUrl.value = item
  481. imageShow.value = true
  482. }
  483. const handelDelImage = (item, index) => {
  484. imageUrl.value.splice(index, 1)
  485. countForm.value.attachmentIds.splice(index, 1)
  486. }
  487. // 开票并结算
  488. const handleBack = () => {
  489. router.back()
  490. }
  491. const handleSettlement = () => {
  492. // 查应收金额
  493. api.financeApi.getPlatformSettlementReceivableAmount({
  494. invoiceType: "5",
  495. orderNos: tableData.value.map(item => item.orderNo),
  496. }).then((res: any) => {
  497. if (res.code == 200) {
  498. receivablePremium.value = res.data
  499. }
  500. })
  501. settlementDialog.value = true
  502. }
  503. const handelComfirm = (formEl: FormInstance | undefined) => {
  504. if (!formEl) return
  505. formEl.validate((valid) => {
  506. console.log(countForm.value)
  507. if (valid) {
  508. const contactPersonObj = options.value.find(v => v.contactPersonPhone === contactPersonPhone.value)
  509. api.financeApi.platformSettlement({
  510. settlementVo: countForm.value,
  511. invoicingVo: {
  512. incomeIds: tableData.value.map(item => item.id),
  513. orderNos: tableData.value.map(item => item.orderNo),
  514. contactPersonPhone: contactPersonPhone.value,
  515. contactPerson: contactPersonObj.contactPerson,
  516. receivablePremium: receivablePremium.value,
  517. invoiceType: "5"
  518. }
  519. }).then((res: any) => {
  520. if (res.code == 200) {
  521. ElMessage({
  522. message: res.msg,
  523. type: 'success'
  524. })
  525. settlementDialog.value = false
  526. } else {
  527. }
  528. })
  529. }
  530. })
  531. }
  532. const uploadImage = async (file, fileList) => {
  533. let files = file.raw
  534. const params = new FormData(); // 声明formData数据类型
  535. params.append("file", files);
  536. params.append("type", "image");
  537. const { code, data, msg } = await api.commonApi.fileUpload(params)
  538. if (code == 200) {
  539. imageUrl.value.push(data.downloadUrl)
  540. countForm.value.attachmentIds.push(data.id)
  541. }
  542. }
  543. const handleChange = async () => {
  544. const num = await calSub(countForm.value.actualReceivedAmount, receivablePremium.value)
  545. countForm.value.paymentDifference = num
  546. }
  547. /**
  548. * 计算两个数值的差值(被减数 - 减数)
  549. * @param minuend 被减数
  550. * @param subtrahend 减数
  551. * @returns 差值,若接口无数据则返回 0
  552. */
  553. const calSub = async (minuend: number, subtrahend: number) => {
  554. const res = await api.financeApi.calSub({ minuend, subtrahend })
  555. return res.data || 0
  556. }
  557. const openSettlement = (list, id) => {
  558. contactPersonPhone.value = id
  559. selectedList.value = list
  560. handleSettlement()
  561. }
  562. defineExpose({
  563. openSettlement,
  564. });
  565. </script>
  566. <style scoped lang="scss">
  567. .ticket {
  568. height: calc(100vh - 135px);
  569. width: calc(100% - 24px);
  570. margin: 12px auto;
  571. padding: 12px;
  572. background: #FFFFFF;
  573. overflow-y: auto;
  574. .search-list {
  575. display: flex;
  576. align-items: center;
  577. justify-content: flex-start;
  578. .search-left {
  579. width: 150px;
  580. display: flex;
  581. align-items: center;
  582. justify-content: center;
  583. margin-right: 20px;
  584. }
  585. .search-right {
  586. width: 700px;
  587. .search-type {
  588. display: flex;
  589. align-items: center;
  590. justify-content: flex-start;
  591. margin-bottom: 10px;
  592. }
  593. }
  594. }
  595. .tips {
  596. display: flex;
  597. align-items: center;
  598. justify-content: flex-start;
  599. p {
  600. margin-right: 30px;
  601. }
  602. }
  603. .footer {
  604. width: 100%;
  605. position: absolute;
  606. left: 0;
  607. bottom: 0;
  608. display: flex;
  609. align-items: center;
  610. justify-content: center;
  611. height: 80px;
  612. }
  613. }
  614. .imageDiv {
  615. position: relative;
  616. width: 80px;
  617. height: 80px;
  618. margin: 0 10px 10px 0;
  619. &:hover {
  620. .model {
  621. display: flex;
  622. align-items: center;
  623. justify-content: center;
  624. background-color: rgba(0, 0, 0, .3);
  625. }
  626. }
  627. img {
  628. display: block;
  629. width: 100%;
  630. height: 100%;
  631. border-radius: 4px;
  632. }
  633. .model {
  634. position: absolute;
  635. width: 80px;
  636. height: 80px;
  637. border-radius: 4px;
  638. display: none;
  639. top: 0;
  640. left: 0;
  641. .icon-view,
  642. .icon-del {
  643. color: #FFFFFF;
  644. margin: 0 10px;
  645. cursor: pointer;
  646. }
  647. }
  648. }
  649. .upload-btn {
  650. :deep(.el-button) {
  651. width: 80px;
  652. height: 80px;
  653. font-size: 30px;
  654. color: #ccc;
  655. }
  656. }
  657. </style>