cashierItem.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <div>
  3. <el-dialog title="指示" :visible.sync="dialogVisible" append-to-body width="60%" :before-close="handleClose">
  4. <avue-crud
  5. v-if="dialogVisible"
  6. :option="option"
  7. :table-loading="loading"
  8. :data="data"
  9. ref="crud"
  10. id="out-table"
  11. :header-cell-class-name="headerClassName"
  12. @selection-change="selectionChange"
  13. @on-load="onLoad"
  14. >
  15. <template slot="status" slot-scope="{ row }">
  16. <span v-if="row.status == 0">{{ row.dc == "D" ? "未收款" : "未支付" }}</span>
  17. <span v-if="row.status == 1">{{ row.dc == "D" ? "已收款" : "已支付" }}</span>
  18. <span v-if="row.status == 2">{{ row.dc == "D" ? "部分收款" : "部分支付" }}</span>
  19. </template>
  20. <template slot="applyCashierAmount" slot-scope="{ row }">
  21. <el-popover width="700" trigger="click">
  22. <avue-crud :data="cashierData" :option="cashierOption"></avue-crud>
  23. <span style="color: #409EFF;cursor: pointer" slot="reference" @click="viewCashier(row)">{{ row.applyCashierAmount }}</span>
  24. </el-popover>
  25. </template>
  26. <template slot="thisAmount" slot-scope="{ row }">
  27. <el-input-number
  28. style="width: 100%;"
  29. v-model="row.thisAmount"
  30. label="请输入本次金额"
  31. size="small"
  32. :max="row.remainingCashierAmount"
  33. @change="calculateChange(row)"
  34. :controls="false"
  35. :disabled="row.status == 1"
  36. ></el-input-number>
  37. </template>
  38. </avue-crud>
  39. <span slot="footer" class="dialog-footer">
  40. <el-button @click="dialogVisible = false" size="mini">取 消</el-button>
  41. <el-button size="mini" type="danger" @click="allClick('撤销出纳')" :disabled="selectionList.length == 0"
  42. >撤销{{ form.dc == "D" ? "收款" : "支付" }}</el-button
  43. >
  44. <el-button size="mini" type="success" @click="allClick('确认出纳')" :disabled="selectionList.length == 0"
  45. >确认{{ form.dc == "D" ? "收款" : "支付" }}</el-button
  46. >
  47. </span>
  48. </el-dialog>
  49. </div>
  50. </template>
  51. <script>
  52. import { MktSlotQuotation, quotationImportBatch } from "@/api/iosBasicData/bills";
  53. import dicSelect from "@/components/dicSelect/main";
  54. import { getListAll, confirmCashier, revokeConfirmCashier, confirmCashier2, revokeConfirmCashier2, cashierList } from "@/api/iosBasicData/cashier.js";
  55. import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
  56. export default {
  57. props: {},
  58. components: { dicSelect },
  59. data() {
  60. return {
  61. cashierData: [],
  62. cashierOption: {
  63. header: false,
  64. menu: false,
  65. align: "center",
  66. column: [
  67. {
  68. label: "收/付",
  69. prop: "dc",
  70. width: "60",
  71. type: "select",
  72. dicData: [
  73. {
  74. label: "收",
  75. value: "D"
  76. },
  77. {
  78. label: "付",
  79. value: "C"
  80. }
  81. ],
  82. overHidden: true
  83. },
  84. {
  85. label: "币别",
  86. prop: "curCode",
  87. width: "60",
  88. overHidden: true
  89. },
  90. {
  91. label: "汇率",
  92. prop: "exrate",
  93. width: "80",
  94. overHidden: true
  95. },
  96. {
  97. label: "金额",
  98. prop: "amount",
  99. width: "100",
  100. overHidden: true
  101. },
  102. {
  103. label: "转汇后金额",
  104. prop: "amountLoc",
  105. width: "100",
  106. overHidden: true
  107. },
  108. {
  109. label: "税率(%)",
  110. prop: "taxRate",
  111. width: "80",
  112. overHidden: true
  113. },
  114. {
  115. label: "净额",
  116. prop: "amountNet",
  117. width: "100",
  118. overHidden: true
  119. },
  120. {
  121. label: "税额",
  122. prop: "amountTax",
  123. width: "80",
  124. overHidden: true
  125. },
  126. {
  127. label: "创建人",
  128. prop: "createUserName",
  129. width: "100",
  130. overHidden: true
  131. },
  132. {
  133. label: "创建时间",
  134. prop: "createTime",
  135. width: "100",
  136. overHidden: true
  137. }
  138. ]
  139. },
  140. selectionList: [],
  141. form: {},
  142. data: [],
  143. options: [
  144. {
  145. value: 0,
  146. label: "不含税"
  147. },
  148. {
  149. value: 1,
  150. label: "含税"
  151. }
  152. ],
  153. dialogVisible: false,
  154. loading: false,
  155. option: {
  156. height: 500,
  157. calcHeight: 30,
  158. border: true,
  159. index: true,
  160. addBtn: false,
  161. viewBtn: false,
  162. delBtn: false,
  163. editBtn: false,
  164. menu: false,
  165. menuWidth: 100,
  166. header: false,
  167. align: "center",
  168. selection: true,
  169. tip: false,
  170. column: [
  171. {
  172. label: "状态",
  173. prop: "status",
  174. width: "60",
  175. overHidden: true
  176. },
  177. {
  178. label: "收/付",
  179. prop: "dc",
  180. width: "60",
  181. type: "select",
  182. dicData: [
  183. {
  184. label: "收",
  185. value: "D"
  186. },
  187. {
  188. label: "付",
  189. value: "C"
  190. }
  191. ],
  192. overHidden: true
  193. },
  194. {
  195. label: "币别",
  196. prop: "curCode",
  197. width: "60",
  198. overHidden: true
  199. },
  200. {
  201. label: "汇率",
  202. prop: "exrate",
  203. width: "80",
  204. overHidden: true
  205. },
  206. {
  207. label: "金额",
  208. prop: "amount",
  209. width: "100",
  210. overHidden: true
  211. },
  212. {
  213. label: "已出纳金额",
  214. prop: "applyCashierAmount",
  215. width: "100",
  216. overHidden: true
  217. },
  218. {
  219. label: "剩余出纳金额",
  220. prop: "remainingCashierAmount",
  221. width: "100",
  222. overHidden: true
  223. },
  224. {
  225. label: "本次金额",
  226. prop: "thisAmount",
  227. width: "100",
  228. overHidden: true
  229. },
  230. {
  231. label: "转汇后金额",
  232. prop: "amountLoc",
  233. width: "100",
  234. overHidden: true
  235. },
  236. {
  237. label: "税率(%)",
  238. prop: "taxRate",
  239. width: "80",
  240. overHidden: true
  241. },
  242. {
  243. label: "净额",
  244. prop: "amountNet",
  245. width: "100",
  246. overHidden: true
  247. },
  248. {
  249. label: "税额",
  250. prop: "amountTax",
  251. width: "80",
  252. overHidden: true
  253. },
  254. {
  255. label: "经办人",
  256. prop: "cashierName",
  257. width: "100",
  258. overHidden: true
  259. },
  260. {
  261. label: "经办时间",
  262. prop: "cashierTime",
  263. width: "100",
  264. overHidden: true
  265. },
  266. {
  267. label: "创建人",
  268. prop: "createUserName",
  269. width: "100",
  270. overHidden: true
  271. },
  272. {
  273. label: "创建时间",
  274. prop: "createTime",
  275. width: "100",
  276. overHidden: true
  277. },
  278. {
  279. label: "备注",
  280. prop: "remarks",
  281. width: 120,
  282. overHidden: true
  283. }
  284. ]
  285. }
  286. };
  287. },
  288. async created() {
  289. // this.option = await this.getColumnData(this.getColumnName(309.6), this.optionBack);
  290. },
  291. methods: {
  292. viewCashier(row) {
  293. this.cashierData = [];
  294. cashierList({ pid: row.id }).then(res => {
  295. this.cashierData = res.data.data.records;
  296. });
  297. },
  298. selectionChange(list) {
  299. this.selectionList = list;
  300. },
  301. calculateChange(row) {
  302. row.amountLoc = Number(Number(row.thisAmount ? row.thisAmount : 0) * Number(row.exrate ? row.exrate : 0)).toFixed(2);
  303. row.amountTax = Number(Number(row.amountLoc ? row.amountLoc : 0) * Number(row.taxRate ? row.taxRate / 100 : 0)).toFixed(2);
  304. row.amountNet = Number(Number(row.amountLoc ? row.amountLoc : 0) - Number(row.amountTax ? row.amountTax : 0)).toFixed(2);
  305. },
  306. allClick(name) {
  307. if (name == "确认出纳") {
  308. for (let item of this.selectionList) {
  309. if (item.status == 1) {
  310. return this.$message.error("请选择未出纳的数据");
  311. }
  312. }
  313. let obj = {
  314. applyCashierList: this.selectionList
  315. };
  316. const loading = this.$loading({
  317. lock: true,
  318. text: "加载中",
  319. spinner: "el-icon-loading",
  320. background: "rgba(255,255,255,0.7)"
  321. });
  322. // 对账和付费申请
  323. if (!this.form.type) {
  324. confirmCashier(obj)
  325. .then(res => {
  326. this.openDialog(this.form);
  327. })
  328. .finally(() => {
  329. loading.close();
  330. });
  331. }
  332. // 发票申请
  333. if (this.form.type == "销项") {
  334. confirmCashier2(obj)
  335. .then(res => {
  336. this.openDialog(this.form);
  337. })
  338. .finally(() => {
  339. loading.close();
  340. });
  341. }
  342. }
  343. if (name == "撤销出纳") {
  344. for (let item of this.selectionList) {
  345. if (item.status == 0) {
  346. return this.$message.error("请选择已出纳的数据");
  347. }
  348. }
  349. this.$confirm("是否撤销?", "提示", {
  350. confirmButtonText: "确定",
  351. cancelButtonText: "取消",
  352. type: "warning"
  353. }).then(() => {
  354. let obj = {
  355. applyCashierList: this.selectionList
  356. };
  357. const loading = this.$loading({
  358. lock: true,
  359. text: "加载中",
  360. spinner: "el-icon-loading",
  361. background: "rgba(255,255,255,0.7)"
  362. });
  363. // 对账和付费申请
  364. if (!this.form.type) {
  365. revokeConfirmCashier(obj)
  366. .then(res => {
  367. this.openDialog(this.form);
  368. })
  369. .finally(() => {
  370. loading.close();
  371. });
  372. }
  373. // 发票申请
  374. if (this.form.type == "销项") {
  375. revokeConfirmCashier2(obj)
  376. .then(res => {
  377. this.openDialog(this.form);
  378. })
  379. .finally(() => {
  380. loading.close();
  381. });
  382. }
  383. });
  384. }
  385. },
  386. openDialog(row) {
  387. this.dialogVisible = true;
  388. this.form = row;
  389. let obj = {
  390. srcIds: row.id
  391. };
  392. this.loading = true;
  393. getListAll(obj)
  394. .then(res => {
  395. this.data = res.data.data;
  396. })
  397. .finally(() => {
  398. this.loading = false;
  399. });
  400. },
  401. //自定义列保存
  402. async saveColumn(ref, option, optionBack, code) {
  403. /**
  404. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  405. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  406. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  407. */
  408. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  409. if (inSave) {
  410. this.$message.success("保存成功");
  411. //关闭窗口
  412. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  413. this.searchReset();
  414. }
  415. },
  416. //自定义列重置
  417. async resetColumn(ref, option, optionBack, code) {
  418. this[option] = this[optionBack];
  419. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  420. if (inSave) {
  421. this.$message.success("重置成功");
  422. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  423. }
  424. },
  425. // 更改表格颜色
  426. headerClassName(tab) {
  427. //颜色间隔
  428. let back = "";
  429. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  430. if (tab.columnIndex % 2 === 0) {
  431. back = "back-one";
  432. } else if (tab.columnIndex % 2 === 1) {
  433. back = "back-two";
  434. }
  435. }
  436. return back;
  437. }
  438. }
  439. };
  440. </script>
  441. <style scoped>
  442. ::v-deep#out-table .back-one {
  443. background: #ecf5ff !important;
  444. text-align: center;
  445. padding: 4px 0;
  446. }
  447. ::v-deep#out-table .back-two {
  448. background: #ecf5ff !important;
  449. text-align: center;
  450. padding: 4px 0;
  451. }
  452. </style>