AccountsReceivable.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <div>
  3. <div class="p-2">
  4. <el-form
  5. :inline="true"
  6. :model="pageRequest"
  7. size="small"
  8. label-width="120px"
  9. >
  10. <el-row>
  11. <el-col :span="6">
  12. <el-form-item label="月份选择:">
  13. <el-date-picker
  14. v-model="pageRequest.yearMonthStr"
  15. type="month"
  16. value-format="yyyy-MM"
  17. placeholder="选择一个月"
  18. class="widths"
  19. >
  20. </el-date-picker>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="6">
  24. <el-form-item label="保险公司:">
  25. <el-select
  26. v-model="pageRequest.insuranceId"
  27. filterable
  28. class="widths"
  29. clearable
  30. collapse-tags
  31. >
  32. <el-option
  33. v-for="val in companyList"
  34. :key="val.id"
  35. :label="val.name"
  36. :value="val.id"
  37. ></el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="1">
  42. <el-button type="primary" size="small" @click="Search"
  43. >查询</el-button
  44. >
  45. </el-col>
  46. <el-col :span="1">
  47. <!-- <el-upload
  48. class="upload-demo"
  49. :auto-upload="false"
  50. :on-change="writeOffUpload"
  51. action="###"
  52. >
  53. <el-button type="primary" size="small">数据导入</el-button>
  54. </el-upload> -->
  55. </el-col>
  56. </el-row>
  57. </el-form>
  58. </div>
  59. <el-main ref="elMain" style="padding: 0px">
  60. <kt-common-table
  61. :SerialShow="true"
  62. :operationWidth="150"
  63. :showOperation="false"
  64. permsDelete="sys:user:delete"
  65. :showBatchDelete="false"
  66. :showBatchSettled="false"
  67. :showBatchPrint="false"
  68. permsButton1="sys:user:edit"
  69. permsButton2="sys:user:edit"
  70. permsButton3="sys:user:edit"
  71. :data="pageResult"
  72. :columns="columns"
  73. @findPage="findPage"
  74. keyName="policyno"
  75. settledName="批量导出"
  76. @handlePrint="handlePrint"
  77. button1Name="修改"
  78. button1Background="#E6A23C"
  79. @handleButton1="accountUpdate"
  80. button1Icon=""
  81. button2Name="删除"
  82. button2Background="#F56C6C"
  83. @handleButton2="accountDelete"
  84. button2Icon=""
  85. :isshowpagination="false"
  86. >
  87. </kt-common-table>
  88. </el-main>
  89. </div>
  90. </template>
  91. <script>
  92. import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
  93. import CommonUtil from "@/utils/comutil.js";
  94. import { searchkey } from "@/utils/validate.js";
  95. import { regionData, codeToText } from "element-china-area-data";
  96. export default {
  97. components: {
  98. KtCommonTable,
  99. },
  100. data() {
  101. return {
  102. value5: "",
  103. //地区编码数据
  104. areaOptions: regionData,
  105. regionalCode: [],
  106. accountsRequest: {
  107. //录入信息
  108. employeeId: "", //工号
  109. province: "", //省
  110. city: "", //市
  111. county: "", //区
  112. group: "", //组
  113. member: "", //组员
  114. account: "", //收款人账户
  115. payee: "", // 收款人名称
  116. bank: "", // 收款人开户行
  117. },
  118. pageRequest: {
  119. //查询的默认条件
  120. insuranceId: "", //保险公司
  121. yearMonthStr: "",
  122. pageNum:"1",
  123. pageSize:"10",
  124. },
  125. companyList: [],
  126. dateTime: [],
  127. institutionOptions: [],
  128. dialogVisible: false,
  129. companyList: [], //保险公司数据
  130. // 右侧列表查询数据Start
  131. pageResult: [],
  132. columns: [
  133. //数据列
  134. { prop: "day", label: " 日期", minWidth: 160 },
  135. { prop: "yearmonth", label: " 月份", minWidth: 160 },
  136. { prop: "insuranceName", label: "保险公司名称", minWidth: 160 },
  137. { prop: "jqPremiumTax", label: "交强", minWidth: 160 },
  138. { prop: "syPremiumTax", label: "商业", minWidth: 160 },
  139. { prop: "taxamount", label: "车船税", minWidth: 160 },
  140. { prop: "nonCarPremiumTax", label: "非车", minWidth: 160 },
  141. { prop: "totalPermium", label: "保费合计", minWidth: 160 },
  142. { prop: "premium", label: "手续费", minWidth: 100 },
  143. { prop: "nonCopying", label: "车跟单", minWidth: 160 },
  144. { prop: "totalReceivable", label: "应收合计", minWidth: 160 },
  145. { prop: "subsidyAmount", label: "补贴金额", minWidth: 160 },
  146. { prop: "totalReceivableAmount", label: "总应收金额", minWidth: 160 },
  147. ],
  148. imcccsw: "",
  149. };
  150. },
  151. created() {
  152. //获取当前年和月
  153. let date = new Date();
  154. let month = date.getMonth() + 1;
  155. month = month > 9 ? month : "0" + month;
  156. let year = date.getFullYear();
  157. this.pageRequest.yearMonthStr = year + "-" + month;
  158. this.companyInt();
  159. },
  160. mounted() {},
  161. methods: {
  162. //省市区
  163. areahandleChange(event) {
  164. if (event[0] != null && event[1] != null && event[2] != null) {
  165. this.accountsRequest.province = codeToText[event[0]];
  166. this.accountsRequest.city = codeToText[event[1]];
  167. this.accountsRequest.county = codeToText[event[2]];
  168. }
  169. },
  170. Search() {
  171. this.findPage();
  172. },
  173. companyInt() {
  174. this.$api.letter.gainTopList().then((res) => {
  175. this.companyList = res.data;
  176. });
  177. },
  178. // 右侧列表的方法Start
  179. findPage(data) {
  180. // 获取分页数据
  181. let that = this;
  182. if(that.pageRequest.yearMonthStr==''||that.pageRequest.yearMonthStr==null||that.pageRequest.yearMonthStr==undefined){
  183. that.$message.error('月份不能为空!')
  184. return
  185. }
  186. that.$api.task
  187. .accountsResult(
  188. that.pageRequest.yearMonthStr,
  189. that.pageRequest.insuranceId
  190. )
  191. .then((res) => {
  192. that.pageResult = res.data;
  193. })
  194. .then(data != null ? data.callback : "");
  195. },
  196. //修改
  197. accountUpdate({ row, column }) {
  198. this.dialogType = "edit";
  199. this.dialogTitle = "渠道账户修改";
  200. this.accountsRequest = row;
  201. const cityObject = {
  202. province: row.province,
  203. city: row.city,
  204. county: row.county,
  205. };
  206. this.regionalCode = searchkey(Object.values(cityObject));
  207. this.dialogVisible = true;
  208. },
  209. //删除
  210. accountDelete({ row, column }) {
  211. this.$confirm("此操作将永久删除, 是否继续?", "提示", {
  212. confirmButtonText: "确定",
  213. cancelButtonText: "取消",
  214. type: "error",
  215. })
  216. .then(() => {
  217. this.$api.task.channelAccountDelete(row.id).then((res) => {
  218. if (res.code == "200") {
  219. this.$message({
  220. type: "success",
  221. message: "删除成功!",
  222. });
  223. this.findPage();
  224. } else {
  225. this.$message({
  226. type: "error",
  227. message: res.msg,
  228. });
  229. }
  230. });
  231. })
  232. .catch(() => {});
  233. },
  234. //导出
  235. handlePrint() {
  236. this.$api.task.excelExport(this.pageRequest).then((res) => {
  237. let blob = new Blob([res], {
  238. type: "application/vnd.ms-excel",
  239. }); // 2.获取请求返回的response对象中的blob 设置文件类型,这里以excel为例
  240. let url = window.URL.createObjectURL(blob); // 3.创建一个临时的url指向blob对象
  241. // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
  242. let a = document.createElement("a");
  243. a.href = url;
  244. a.download = "手续费管理清单.xlsx";
  245. a.click();
  246. // 5.释放这个临时的对象url
  247. window.URL.revokeObjectURL(url);
  248. });
  249. },
  250. //联级选择器触发事件
  251. handleChange(val) {
  252. if (val.length !== 0) {
  253. this.pageRequest.deptId = val.at(-1);
  254. } else {
  255. this.pageRequest.deptId = "";
  256. }
  257. },
  258. //-- formatter begin--
  259. agreetypeFormatter(row, column) {
  260. //协议类型
  261. let agreetype = row.agreetype;
  262. return CommonUtil.getDataName({
  263. dataList: this.agreementtypeoptions,
  264. value: "value",
  265. label: "label",
  266. data: agreetype,
  267. });
  268. },
  269. inscompanyFormatter(row, column) {
  270. //协议类型
  271. let inscompany = row.inscompany;
  272. return CommonUtil.getDataName({
  273. dataList: this.global.insCompanyList,
  274. value: "code",
  275. label: "name",
  276. data: inscompany,
  277. });
  278. },
  279. timeFormatter(row, column) {
  280. let time = this.transformTime(row.createTime);
  281. return time;
  282. },
  283. totalmoenyFormatter(row, column) {
  284. //协议类型
  285. let inscompany = row.inscompany;
  286. return (row.feeamount + row.disamount).toFixed(2);
  287. },
  288. //点击查询按钮
  289. //--数据字典 begin --
  290. getDictItems: function (typeName) {
  291. let that = this;
  292. that.$api.dict
  293. .findByLableName(typeName)
  294. .then(function (res) {
  295. that[typeName + "options"] = res.data; // 把获取到的数据赋给this.data
  296. })
  297. .catch(function (error) {
  298. that[typeName + "options"] = [];
  299. });
  300. },
  301. //--数据字典 end --
  302. transformTime(date) {
  303. var d = new Date(date);
  304. var strYear = d.getFullYear();
  305. var strMonth = d.getMonth() + 1;
  306. var strDay = d.getDate();
  307. var hh = d.getHours();
  308. var minutes = d.getMinutes(); // 分
  309. var Seconds = d.getSeconds();
  310. if (hh < 10) {
  311. hh = "0" + hh;
  312. }
  313. if (minutes < 10) {
  314. minutes = "0" + minutes;
  315. }
  316. if (Seconds < 10) {
  317. Seconds = "0" + Seconds;
  318. }
  319. if (strMonth < 10) {
  320. strMonth = "0" + strMonth;
  321. }
  322. if (strDay < 10) {
  323. strDay = "0" + strDay;
  324. }
  325. var datetime =
  326. strYear +
  327. "-" +
  328. strMonth +
  329. "-" +
  330. strDay +
  331. " " +
  332. hh +
  333. ":" +
  334. minutes +
  335. ":" +
  336. Seconds;
  337. return datetime;
  338. },
  339. lastMonth() {
  340. // 获取当前日期
  341. var currentDate = new Date();
  342. // 获取上个月的年份和月份
  343. var year = currentDate.getFullYear();
  344. var month = currentDate.getMonth() - 1;
  345. // 如果当前是1月份,则年份减1,月份变为12月
  346. if (month < 0) {
  347. year--;
  348. month = 11;
  349. }
  350. // 获取上个月的最后一天
  351. var lastDayOfLastMonth = new Date(year, month + 1, 0);
  352. // 格式化为两位数的字符串
  353. var formatNumber = function (num) {
  354. return num < 10 ? "0" + num : num;
  355. };
  356. // 上月1日的日期字符串
  357. var startDate = year + "-" + formatNumber(month + 1) + "-01";
  358. // 上月最后一日的日期字符串
  359. var endDate =
  360. year +
  361. "-" +
  362. formatNumber(month + 1) +
  363. "-" +
  364. formatNumber(lastDayOfLastMonth.getDate());
  365. return [startDate, endDate];
  366. },
  367. },
  368. };
  369. </script>
  370. <style lang="scss" scoped>
  371. .widths {
  372. width: 220px;
  373. }
  374. </style>