dislogPrint.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. <template>
  2. <div>
  3. <BaseDialog
  4. :width="printType == 1 || type == 1 ? '1100px' : '1300px'"
  5. :isShow.sync="isShow"
  6. :title="printType == 1 ? '单据打印' : '明细打印'"
  7. @submit="submitForm"
  8. @close="close"
  9. @open="init"
  10. :confirmStatus="false"
  11. >
  12. <div id="print" v-loading="loading">
  13. <h3 style="text-align: center">
  14. {{ printType == 1 ? "费用支出单据" : "费用支出明细" }}
  15. </h3>
  16. <template v-if="printType == 1">
  17. <table
  18. class="table1"
  19. border
  20. cellspacing="0"
  21. cellpadding="5"
  22. width="100%"
  23. >
  24. <tr>
  25. <td>
  26. 款项用途:{{
  27. ["", "机构分成", "业务提成", "佣金结算", "供应商结算"][type]
  28. }}
  29. </td>
  30. <td>付款日期:{{ $methodsTools.onlyForma(formData.payTime) }}</td>
  31. <td>付款金额:{{ formData.payMoney | formatPrice }}</td>
  32. </tr>
  33. <tr>
  34. <td>
  35. <p>用途详细:</p>
  36. <p>机构名称:{{ formData.tenantName }}</p>
  37. <template v-if="type !== 1">
  38. <p>业务员:{{ formData.createUsername }}</p>
  39. <p>业务号:{{ formData.createNo }}</p>
  40. </template>
  41. <template v-if="type !== 3">
  42. <p>
  43. 账款类型:{{
  44. ["", "月份", "季度", "半年", "年度"][formData.billType]
  45. }}
  46. </p>
  47. <p>账款时间:{{ activeData.monthTime }}</p>
  48. </template>
  49. <template v-if="type == 3">
  50. <p>订单单号:{{ formData.orderSn }}</p>
  51. <p>下单企业:{{ formData.purchaseOrg }}</p>
  52. </template>
  53. </td>
  54. <td>
  55. <p>收款信息:</p>
  56. <p>
  57. 收款方式:{{
  58. [
  59. "",
  60. "微信支付",
  61. "支付宝支付",
  62. "金币支付",
  63. "现金支付",
  64. "网银支付",
  65. "协议支付",
  66. "对公转账",
  67. ][formData.payType]
  68. }}
  69. </p>
  70. <template v-if="formData.toBankAcount">
  71. <p>收款账户:{{ formData.toBankName }}</p>
  72. <p>收款银行:{{ formData.toBankTypeName }}</p>
  73. <p>收款账号:{{ formData.toBankAcount }}</p>
  74. </template>
  75. </td>
  76. <td>
  77. <p>款项明细:</p>
  78. <template v-if="type == 3">
  79. <p>结算佣金:{{ formData.brokerage | formatPrice }}</p>
  80. <p>税前佣金:{{ formData.pretaxBrokerage | formatPrice }}</p>
  81. <p>佣金税占比:{{ formData.pretax * 100 || 0 }}%</p>
  82. </template>
  83. <template v-else>
  84. <p>应付分成:{{ formData.payMoney | formatPrice }}</p>
  85. <p>
  86. 完单分成:{{
  87. (formData.payMoney + formData.deductMoney) | formatPrice
  88. }}
  89. </p>
  90. <p>退款扣除:{{ formData.deductMoney | formatPrice }}</p>
  91. </template>
  92. </td>
  93. </tr>
  94. <tr>
  95. <td colspan="3">
  96. <p>审核进度:</p>
  97. <el-steps
  98. style="padding-left: 30px"
  99. :space="200"
  100. :active="checkRoles.length"
  101. finish-status="success"
  102. align-center
  103. >
  104. <el-step
  105. v-for="(item, index) in checkRoles"
  106. :title="item"
  107. :key="index"
  108. ></el-step>
  109. </el-steps>
  110. </td>
  111. </tr>
  112. </table>
  113. </template>
  114. <template v-if="printType == 2">
  115. <table
  116. border
  117. width="100%"
  118. cellspacing="0"
  119. cellpadding="5"
  120. class="table2"
  121. >
  122. <thead>
  123. <tr>
  124. <td width="50">序号</td>
  125. <td
  126. v-for="(item, index) in tableSet"
  127. :key="index"
  128. :width="item.width"
  129. >
  130. {{ item.label }}
  131. </td>
  132. </tr>
  133. </thead>
  134. <tbody>
  135. <tr v-for="(item, index) in tableData" :key="index">
  136. <td>{{ index + 1 }}</td>
  137. <td v-for="(items, indexs) in tableSet" :key="indexs">
  138. <span v-if="items.scope === 'time'">{{
  139. $methodsTools.onlyForma(item[items.prop])
  140. }}</span>
  141. <span v-else-if="items.scope === 'formatPrice'">
  142. {{ item[items.prop] | formatPrice }}
  143. </span>
  144. <span v-else-if="items.scope === 'type'">
  145. {{ items.values[item[items.prop]] }}
  146. </span>
  147. <div v-else-if="items.scope === 'businessList'">
  148. <div v-for="(bus, i) in item[items.prop]" :key="i">
  149. {{ bus }}
  150. </div>
  151. </div>
  152. <div v-else-if="items.scope === 'pretax'">
  153. {{ item.pretax * 100 }}%
  154. </div>
  155. <span v-else>
  156. {{ item[items.prop] || "-" }}
  157. </span>
  158. </td>
  159. </tr>
  160. <tr>
  161. <td :colspan="setLen - 2">合计</td>
  162. <td>
  163. {{ computedMoney(tableData, setLen - 3) | formatPrice }}
  164. </td>
  165. <td v-if="type !== 3">
  166. {{ computedMoney(tableData, setLen - 2) | formatPrice }}
  167. </td>
  168. <td v-else></td>
  169. <td>
  170. {{ computedMoney(tableData, setLen - 1) | formatPrice }}
  171. </td>
  172. </tr>
  173. </tbody>
  174. </table>
  175. </template>
  176. </div>
  177. <template slot="slotBtnRight">
  178. <el-button v-print="'#print'" type="primary">打印</el-button>
  179. </template>
  180. </BaseDialog>
  181. </div>
  182. </template>
  183. <script>
  184. import {
  185. withPrint,
  186. monthOrderListWithPrint,
  187. commissionPrint,
  188. } from "@/api/financed/index";
  189. export default {
  190. name: "",
  191. props: {
  192. dialogVisible: {
  193. type: Boolean,
  194. default: false,
  195. },
  196. activeData: {
  197. type: Object,
  198. default: () => {
  199. return {};
  200. },
  201. },
  202. },
  203. data() {
  204. return {
  205. formData: {},
  206. checkRoles: ["统计", "会计/财务", "总经理", "出纳"],
  207. tableData: [],
  208. loading: false,
  209. };
  210. },
  211. methods: {
  212. init() {
  213. this.loading = true;
  214. let { id } = this.activeData;
  215. if (this.printType == 2) {
  216. id = {
  217. divideLogId: id,
  218. };
  219. }
  220. // 佣金的
  221. if (this.type == 3) {
  222. id = {
  223. orderSn: this.activeData.orderSn,
  224. };
  225. }
  226. const fn =
  227. this.type == 3
  228. ? commissionPrint
  229. : [withPrint, monthOrderListWithPrint][this.printType - 1];
  230. fn(id)
  231. .then((res) => {
  232. if (this.printType == 1) {
  233. this.formData = res.data;
  234. }
  235. if (this.printType == 2) {
  236. this.tableData = this.type == 3 ? [res.data] : res.data;
  237. }
  238. })
  239. .finally(() => {
  240. this.loading = false;
  241. });
  242. },
  243. close() {},
  244. submitForm() {},
  245. },
  246. computed: {
  247. computedMoney: function () {
  248. return function (array, index) {
  249. const property = this.tableSet[index].prop;
  250. return array.reduce((a, b) => a + b[property], 0);
  251. };
  252. },
  253. isShow: {
  254. get() {
  255. return this.dialogVisible;
  256. },
  257. set(val) {
  258. this.$emit("update:dialogVisible", false);
  259. },
  260. },
  261. printType() {
  262. return this.activeData.printType;
  263. },
  264. type() {
  265. return this.activeData.type;
  266. },
  267. tableSet() {
  268. if (this.type != 3) {
  269. let tableSet = [
  270. { label: "完单时间", prop: "orderTime", width: "160", scope: "time" },
  271. {
  272. label: "订单日期",
  273. prop: "orderCreateTime",
  274. width: "160",
  275. scope: "time",
  276. },
  277. { label: "订单号", prop: "orderSn", width: "200" },
  278. { label: "业务员", prop: "createUsername", width: "80" },
  279. { label: "业务号", prop: "createNo", width: "80" },
  280. {
  281. label: "业务类型",
  282. prop: "businessList",
  283. scope: "businessList",
  284. width: "160",
  285. },
  286. {
  287. label: "分成类型",
  288. prop: "orderType",
  289. scope: "type",
  290. values: {
  291. 1: "完单分成",
  292. 2: "退款扣除",
  293. },
  294. },
  295. { label: "订单金额", prop: "orderPrice", scope: "formatPrice" },
  296. { label: "税前佣金", prop: "pretaxBrokerage", scope: "formatPrice" },
  297. {
  298. label: "应付分成",
  299. prop: this.type == 1 ? "divideCompanyMoney" : "divideSellerMoney",
  300. scope: "formatPrice",
  301. },
  302. ];
  303. console.log(tableSet,789)
  304. if (this.type == 1) {
  305. tableSet.splice(3, 2);
  306. }
  307. return tableSet;
  308. } else {
  309. return [
  310. {
  311. label: "订单日期",
  312. prop: "createTime",
  313. width: "160",
  314. scope: "time",
  315. },
  316. { label: "订单号", prop: "orderSn", width: "200" },
  317. { label: "业务员", prop: "createUsername", width: "80" },
  318. { label: "业务号", prop: "createNo", width: "80" },
  319. { label: "下单企业", prop: "purchaseOrg", width: "130" },
  320. {
  321. label: "业务类型",
  322. prop: "businessList",
  323. scope: "businessList",
  324. width: "160",
  325. },
  326. {
  327. label: "支付方式",
  328. prop: "payType",
  329. scope: "type",
  330. values: {
  331. 1: "微信",
  332. 2: "支付宝",
  333. 3: "金币",
  334. 4: "现金",
  335. 5: "网银支付",
  336. 6: "协议",
  337. 7: "对公转账",
  338. },
  339. },
  340. { label: "税前佣金", prop: "pretaxBrokerage", scope: "formatPrice" },
  341. { label: "佣金税占比", prop: "pretax", scope: "pretax" },
  342. { label: "结算佣金", prop: "brokerage", scope: "formatPrice" },
  343. ];
  344. }
  345. },
  346. setLen() {
  347. return this.tableSet.length;
  348. },
  349. },
  350. };
  351. </script>
  352. <style lang="scss" scoped>
  353. #print {
  354. h3 {
  355. text-align: center;
  356. }
  357. table {
  358. table-layout: fixed;
  359. }
  360. .table1 {
  361. td {
  362. vertical-align: top;
  363. padding-left: 16px;
  364. }
  365. }
  366. td {
  367. padding: 10px 5px;
  368. p:first-child {
  369. font-weight: bold;
  370. }
  371. }
  372. /deep/ .el-step__head.is-success {
  373. color: #000;
  374. border-color: #000;
  375. }
  376. /deep/ .el-step__title.is-success {
  377. color: #000;
  378. }
  379. }
  380. .table2 {
  381. td {
  382. text-align: center;
  383. word-break: break-all;
  384. }
  385. }
  386. </style>