ticket.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. <template>
  2. <div class="ticket">
  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. }
  284. })
  285. }
  286. let logicJudge = ref('and')
  287. let searchList = ref([
  288. {
  289. name: 'contactPersonPhone',
  290. type: '等于',
  291. search: ''
  292. }, {
  293. name: 'signDate',
  294. type: '固定范围',
  295. search: ''
  296. }, {
  297. name: 'ptlAgreement',
  298. type: '等于',
  299. search: ''
  300. }, {
  301. name: 'orderType',
  302. type: '等于',
  303. search: ''
  304. }, {
  305. name: 'signYear',
  306. type: '等于',
  307. search: ''
  308. }
  309. ])
  310. // 保险公司
  311. const initCompany = () => {
  312. api.financeApi.queryReceivableContact({
  313. incomeIds: selectedList.value.map((item: any) => item.id)
  314. }).then((res: any) => {
  315. if (res.code == 200) {
  316. options.value = res.data
  317. }
  318. })
  319. }
  320. const showTicket = ref(false)
  321. const contactPersonPhone = ref('')
  322. if (route.query?.contactPersonPhone) {
  323. console.log(route.query)
  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. initCompany()
  330. initData()
  331. }
  332. const downloadTemplate = () => {
  333. api.financeApi.exportAccountsReceivableInvoiceTemplate({}).then((res: any) => {
  334. if (res.code == 200) {
  335. const link = document.createElement('a');
  336. fetch(res.msg).then((res) => res.blob())
  337. .then((blob) => {
  338. // 将链接地址字符内容转变成blob地址
  339. link.href = URL.createObjectURL(blob)
  340. console.log(link.href)
  341. link.download = '平台结算导入模版.xlsx' //下载的文件的名字
  342. document.body.appendChild(link)
  343. link.click()
  344. })
  345. }
  346. })
  347. }
  348. let importModifyCallback = ref()// 导入数据回调
  349. const uploadJYFile = async (file) => {
  350. let files = file.raw
  351. const params = new FormData(); // 声明formData数据类型
  352. params.append("file", files);
  353. const { code, data, msg } = await api.financeApi.importAccountsReceivableInvoice(params)
  354. if (code == 200) {
  355. importModifyCallback.value = data
  356. if(data.orderNos.length>0){
  357. api.financeApi.getSelectedReceivableList({ orderNos: data.orderNos }).then((res: any) => {
  358. if (res.code == 200) {
  359. tableData.value = res.data
  360. }
  361. })
  362. }
  363. ElMessage({
  364. message: msg,
  365. type: 'success'
  366. })
  367. }
  368. }
  369. // 下载导入失败文件
  370. const downloadImportFailedData = (item) => {
  371. const link = document.createElement('a');
  372. link.href = item.failFileUrl;
  373. link.download = '';
  374. // 触发下载
  375. document.body.appendChild(link);
  376. link.click();
  377. document.body.removeChild(link);
  378. }
  379. let noData = ref(true)
  380. let tableData = ref([])
  381. const addTicket = () => {
  382. addShow.value = true
  383. }
  384. const handleSearch = () => {
  385. console.log(searchList.value)
  386. // router
  387. api.financeApi.getSelectedReceivableList({
  388. orderNos: selectedList.value.map(item => item.orderNo),
  389. searchList: searchList.value,
  390. logicJudge: logicJudge.value,
  391. }).then((res: any) => {
  392. if (res.code == 200) {
  393. tableData.value = res.data
  394. }
  395. })
  396. }
  397. let addShow = ref(false)
  398. let addSearchValue = ref('')
  399. let placeholder = ref('订单号查询')
  400. let addSelectType = ref('1')
  401. const handleAddSelectTypeChange = (e) => {
  402. switch (e) {
  403. case '1':
  404. placeholder.value = '订单号查询'
  405. break;
  406. case '2':
  407. placeholder.value = '交强险保单号查询'
  408. break;
  409. case '3':
  410. placeholder.value = '商业险保单号查询'
  411. break;
  412. }
  413. }
  414. let selectingData = ref([])
  415. let selectedData = ref([])
  416. // 出单协议多选转换
  417. const handlePtlAgreementChange = (index: any, e: any) => {
  418. console.log(e)
  419. if (Array.isArray(e)) {
  420. searchList.value[index].search = e.join(',') || ''
  421. } else {
  422. searchList.value[index].search = e || ''
  423. }
  424. }
  425. // 签单时间选择器改变时触发
  426. const signDateSelectChange = (index: any, e: any) => {
  427. switch (e) {
  428. case '为空':
  429. searchList.value[index].search = ''
  430. break;
  431. case '大于等于':
  432. case '小于等于':
  433. searchList.value[index].search = ''
  434. datesearch.value = ''
  435. break;
  436. }
  437. }
  438. // 未审核订单查询
  439. const getUnauditedOrder = () => {
  440. api.financeApi.getUnauditedOrder(addSearchValue.value).then((res: any) => {
  441. if (res.code == 200) {
  442. selectingData.value = res.data
  443. }
  444. })
  445. }
  446. const handleDel = (row) => {
  447. selectedData.value = selectedData.value.filter(item => item.id != row.id)
  448. }
  449. const handleAddSubmit = () => {
  450. if (selectedData.value.length < 1) {
  451. ElMessage({
  452. message: '请选择要添加的数据!',
  453. type: 'warning'
  454. })
  455. } else {
  456. api.financeApi.addReceivable(selectedData.value).then((res: any) => {
  457. if (res.code == 200) {
  458. ElMessage({
  459. message: res.msg,
  460. type: 'success'
  461. })
  462. addShow.value = false
  463. }
  464. })
  465. }
  466. }
  467. const handleToAdd = (row) => {
  468. if (selectedData.value.length < 1) {
  469. selectedData.value.push(row)
  470. } else {
  471. if (!selectedData.value.some(item => item.id === row.id)) {
  472. selectedData.value.push(row)
  473. }
  474. }
  475. }
  476. let imageShow = ref(false)
  477. let bigImageUrl = ref('')
  478. const handelViewImage = (item, index) => {
  479. bigImageUrl.value = item
  480. imageShow.value = true
  481. }
  482. const handelDelImage = (item, index) => {
  483. imageUrl.value.splice(index, 1)
  484. countForm.value.attachmentIds.splice(index, 1)
  485. }
  486. // 开票并结算
  487. const handleBack = () => {
  488. router.back()
  489. }
  490. const handleSettlement = () => {
  491. // 查应收金额
  492. api.financeApi.getPlatformSettlementReceivableAmount({
  493. invoiceType: "5",
  494. orderNos: tableData.value.map(item => item.orderNo),
  495. }).then((res: any) => {
  496. if (res.code == 200) {
  497. receivablePremium.value = res.data
  498. }
  499. })
  500. settlementDialog.value = true
  501. }
  502. const handelComfirm = (formEl: FormInstance | undefined) => {
  503. if (!formEl) return
  504. formEl.validate((valid) => {
  505. console.log(countForm.value)
  506. if (valid) {
  507. const contactPersonObj = options.value.find(v => v.contactPersonPhone === contactPersonPhone.value)
  508. api.financeApi.platformSettlement({
  509. settlementVo: countForm.value,
  510. invoicingVo: {
  511. incomeIds: tableData.value.map(item => item.id),
  512. orderNos: tableData.value.map(item => item.orderNo),
  513. contactPersonPhone: contactPersonPhone.value,
  514. contactPerson: contactPersonObj.contactPerson,
  515. receivablePremium: receivablePremium.value,
  516. invoiceType: "5"
  517. }
  518. }).then((res: any) => {
  519. if (res.code == 200) {
  520. ElMessage({
  521. message: res.msg,
  522. type: 'success'
  523. })
  524. settlementDialog.value = false
  525. } else {
  526. }
  527. })
  528. }
  529. })
  530. }
  531. const uploadImage = async (file, fileList) => {
  532. let files = file.raw
  533. const params = new FormData(); // 声明formData数据类型
  534. params.append("file", files);
  535. params.append("type", "image");
  536. const { code, data, msg } = await api.commonApi.fileUpload(params)
  537. if (code == 200) {
  538. imageUrl.value.push(data.downloadUrl)
  539. countForm.value.attachmentIds.push(data.id)
  540. }
  541. }
  542. const handleChange = async () => {
  543. const num = await calSub(receivablePremium.value, countForm.value.actualReceivedAmount)
  544. countForm.value.paymentDifference = num
  545. }
  546. /**
  547. * 计算两个数值的差值(被减数 - 减数)
  548. * @param minuend 被减数
  549. * @param subtrahend 减数
  550. * @returns 差值,若接口无数据则返回 0
  551. */
  552. const calSub = async (minuend: number, subtrahend: number) => {
  553. const res = await api.financeApi.calSub({ minuend, subtrahend })
  554. return res.data || 0
  555. }
  556. const openSettlement = (list, id) => {
  557. contactPersonPhone.value = id
  558. selectedList.value = list
  559. handleSettlement()
  560. initCompany()
  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>