Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

purchaseOrderPrint.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-row style="float: right">
  6. <el-col :span="24">
  7. <el-button
  8. size="small"
  9. icon="el-icon-printer"
  10. type="primary"
  11. @click="printAction"
  12. >打印</el-button
  13. >
  14. </el-col>
  15. </el-row>
  16. </div>
  17. <div class="app-container" style="background-color: white">
  18. <div id="print_content">
  19. <div class="print_main_content">
  20. <div class="order_title_panl">
  21. <div style="font-size: 22px; font-weight: bold">{{ orgName }}</div>
  22. <span style="font-weight: 500; font-size: 18px">采购订单</span>
  23. </div>
  24. <div style="display: flex; justify-content: space-between">
  25. <div style="text-align: left; margin-bottom: 1px; font-size: 18px">
  26. 供应商:{{ getSupplyName(supplier_id) }}
  27. </div>
  28. <div style="margin-bottom: 1px; font-size: 18px">
  29. 单据日期:{{ getTimes(document_date) }}
  30. </div>
  31. <div style="margin-bottom: 1px; font-size: 18px">
  32. 单据编号:{{ number }}
  33. </div>
  34. <div style="margin-bottom: 1px; font-size: 18px">币别:RMB</div>
  35. </div>
  36. <div class="table_panel">
  37. <table class="table">
  38. <thead>
  39. <tr>
  40. <td style="line-height: 18px" width="80">序号</td>
  41. <td style="line-height: 18px" width="80">商品</td>
  42. <td style="line-height: 18px" width="80">单位</td>
  43. <td style="line-height: 18px" width="80">数量</td>
  44. <td style="line-height: 18px" width="80">采购单价</td>
  45. <td style="line-height: 18px" width="60">采购金额</td>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. <tr v-for="(item, index) in tableList" :key="index">
  50. <td style="line-height: 18px">
  51. <span>{{ index + 1 }}</span>
  52. </td>
  53. <td style="line-height: 18px">
  54. <span>{{ item.name }}</span>
  55. </td>
  56. <td style="line-height: 18px">
  57. <span>{{ item.supply_unit }}</span>
  58. </td>
  59. <td style="line-height: 18px">
  60. <span>{{ item.count }}</span>
  61. </td>
  62. <td style="line-height: 18px">
  63. <span>{{ item.price }}</span>
  64. </td>
  65. <td style="line-height: 18px">
  66. <span>{{ (item.count * item.price).toFixed(2) }}</span>
  67. </td>
  68. </tr>
  69. <tr>
  70. <td colspan="3" style="line-height: 18px">合计</td>
  71. <td colspan="1" style="line-height: 18px">{{getAllCount()}}</td>
  72. <td colspan="1" style="line-height: 18px"></td>
  73. <td colspan="2" style="line-height: 18px">{{getTotalPrice()}}</td>
  74. </tr>
  75. <tr>
  76. <td colspan="6" style="line-height: 18px">合计 金额大写 {{getAllPrice()}}</td>
  77. </tr>
  78. </tbody>
  79. </table>
  80. <!-- <div style="margin-top: 1px">
  81. <div style="width: 100px">折扣额:</div>
  82. <div style="width: 100px"></div>
  83. <div style="width: 100px">折扣金额:</div>
  84. <div style="width: 100px"><span></span></div>
  85. <div style="width: 100px">本次付款:</div>
  86. <div style="width: 100px"><span></span></div>
  87. <div style="width: 100px">本次欠款:</div>
  88. <div style="width: 100px"></div>
  89. </div>
  90. <div style="margin-top: 1px">
  91. <div style="width: 100px">备注</div>
  92. <div style="width: 100px"></div>
  93. </div>
  94. <div style="margin-top: 1px">
  95. <div style="width: 100px">制单人:</div>
  96. <div style="width: 100px"></div>
  97. <div style="width: 100px">收货人签字:</div>
  98. <div style="width: 100px"><span></span></div>
  99. <div style="width: 100px">供应商签字:</div>
  100. <div style="width: 100px"><span></span></div>
  101. </div> -->
  102. </div>
  103. <div
  104. style="
  105. width: 100%;
  106. display: flex;
  107. flex: 1;
  108. justify-content: flex-start;
  109. flex-wrap: wrap;
  110. "
  111. >
  112. <div
  113. style="
  114. width: 25%;
  115. text-align: left;
  116. margin-bottom: 1px;
  117. font-size: 18px;
  118. "
  119. >
  120. 优惠率:<span v-if="rate_of_concession>0">{{rate_of_concession}}%</span>
  121. </div>
  122. <div
  123. style="
  124. width: 25%;
  125. text-align: left;
  126. margin-bottom: 1px;
  127. font-size: 18px;
  128. "
  129. >
  130. 优惠金额:<span v-if="discount_amount>0">{{discount_amount}}</span>
  131. </div>
  132. <div
  133. style="
  134. width: 100%;
  135. text-align: left;
  136. margin-bottom: 1px;
  137. font-size: 18px;
  138. "
  139. >
  140. 备注:{{return_remake}}
  141. </div>
  142. <div
  143. style="
  144. width: 25%;
  145. text-align: left;
  146. margin-bottom: 1px;
  147. font-size: 18px;
  148. "
  149. >
  150. 制单人:{{getXuserName(creater)}}
  151. </div>
  152. <div
  153. style="
  154. width: 25%;
  155. text-align: left;
  156. margin-bottom: 1px;
  157. font-size: 18px;
  158. "
  159. >
  160. 收货人签字:
  161. </div>
  162. <div
  163. style="
  164. width: 25%;
  165. text-align: left;
  166. margin-bottom: 1px;
  167. font-size: 18px;
  168. "
  169. >
  170. 供应商签字:
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. </template>
  178. <script>
  179. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  180. import { fetchAllAdminUsers } from "@/api/doctor";
  181. import { getPurchaseOrderDetail } from "@/api/supply";
  182. import print from "print-js";
  183. import { getLodop } from "@/assets/LodopFuncs";
  184. const moment = require("moment");
  185. import { uParseTime } from "@/utils/tools";
  186. export default {
  187. components: {
  188. BreadCrumb,
  189. },
  190. data() {
  191. return {
  192. size: "medium ",
  193. crumbs: [
  194. { path: false, name: "库存管理" },
  195. { path: false, name: "耗材管理" },
  196. { path: false, name: "入库单打印" },
  197. ],
  198. isEdit: 0,
  199. checked: false,
  200. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  201. time_now: moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
  202. orgName: "",
  203. orgId: "",
  204. adminUserOptions: [],
  205. tableList: [],
  206. number: "",
  207. id: "",
  208. supplier_id: "",
  209. rate_of_concession: "",
  210. discount_amount: "",
  211. supplyList: [],
  212. document_date: "",
  213. return_remake:"",
  214. creater:""
  215. };
  216. },
  217. methods: {
  218. printAction: function () {
  219. const style =
  220. "@media print { .print_main_content { background-color: white; width:960px; margin:0 auto; padding: 0 0 20px 0; } .order_title_panl { text-align: center; } .main_title { font-size: 18px; line-height: 40px; font-weight: 500; } .table_panel { } .table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } thead tr td { border: 1px solid; text-align: center; font-size: 14px; padding: 1px 5px; } tbody tr td { border: 1px solid; text-align: center; font-size: 12px; padding: 10px 5px; white-space: pre-line;} .proj { padding: 5px 0; text-align: left; } .proj_title { font-size: 16px; font-weight: 500; line-height: 25px; } .proj_item { font-size: 15px; line-height: 20px; } .zone_name { font-weight: 500; } }";
  221. printJS({
  222. printable: "print_content",
  223. type: "html",
  224. documentTitle: " ",
  225. style: style,
  226. scanStyles: false,
  227. });
  228. },
  229. // 打印功能
  230. btnClickPrint: function () {
  231. let LODOP = getLodop(); //调用getLodop获取LODOP对象
  232. LODOP.PRINT_INIT("打印控件功能演示_Lodop功能_整页缩放打印输出");
  233. LODOP.ADD_PRINT_BARCODE(15, 15, 300, 300, "QRCode", "xxxxxxxxxxxxx");
  234. LODOP.SET_PRINT_STYLEA(0, "Stretch", 1); //(可变形)扩展缩放模式
  235. LODOP.PREVIEW(); //预览(预览打印无脚标)
  236. // LODOP.PRINT(); //打印
  237. LODOP.RINT_DESIGN();
  238. },
  239. getTime(val) {
  240. if (val < 0) {
  241. return "";
  242. }
  243. if (val == "") {
  244. return "";
  245. } else {
  246. return uParseTime(val, "{y}-{m}-{d}");
  247. }
  248. },
  249. fetchAllAdminUsers() {
  250. fetchAllAdminUsers().then((response) => {
  251. if (response.data.state == 1) {
  252. this.adminUserOptions = response.data.data.users;
  253. }
  254. });
  255. },
  256. getXuserName(id) {
  257. if (id <= 0) {
  258. return "";
  259. }
  260. var name = "";
  261. if (
  262. this.adminUserOptions == null ||
  263. typeof this.adminUserOptions.length === "undefined"
  264. ) {
  265. return name;
  266. }
  267. var leng = this.adminUserOptions.length;
  268. if (leng == 0) {
  269. return name;
  270. }
  271. for (let index = 0; index < leng; index++) {
  272. if (this.adminUserOptions[index].id == id) {
  273. name = this.adminUserOptions[index].name;
  274. break;
  275. }
  276. }
  277. return name;
  278. },
  279. getPurchaseOrderDetail() {
  280. var id = this.$route.query.id;
  281. getPurchaseOrderDetail(id).then((response) => {
  282. if (response.data.state == 1) {
  283. var info = response.data.data.info;
  284. this.is_check = info.is_check;
  285. this.number = info.number;
  286. this.id = info.id;
  287. this.supplier_id = info.supplier_id;
  288. this.rate_of_concession = info.rate_of_concession;
  289. this.discount_amount = info.discount_amount;
  290. this.document_date = info.document_date;
  291. var orderInfo = response.data.data.orderInfo;
  292. var supplyList = response.data.data.supplyList;
  293. this.return_remake = info.return_remake
  294. this.creater = info.creater
  295. this.supplyList = supplyList;
  296. for (let i = 0; i < orderInfo.length; i++) {
  297. orderInfo[i].supply_count = orderInfo[i].count;
  298. orderInfo[i].supply_price = orderInfo[i].price;
  299. orderInfo[i].supply_remake = orderInfo[i].remark;
  300. orderInfo[i].type = orderInfo[i].is_source;
  301. orderInfo[i].project_id = orderInfo[i].project_id;
  302. }
  303. console.log("orderINFO23323232", orderInfo);
  304. this.tableList = orderInfo;
  305. }
  306. });
  307. },
  308. getSupplyName(id) {
  309. var name = "";
  310. for (let i = 0; i < this.supplyList.length; i++) {
  311. if (id == this.supplyList[i].id) {
  312. name = this.supplyList[i].supplier_name;
  313. }
  314. }
  315. return name;
  316. },
  317. getTimes(time) {
  318. if (time === "") {
  319. return "";
  320. }
  321. return uParseTime(time, "{y}-{m}-{d}");
  322. },
  323. getAllPrice() {
  324. var total_price = 0;
  325. for (let i = 0; i < this.tableList.length; i++) {
  326. total_price +=(this.tableList[i].price *this.tableList[i].count)
  327. }
  328. this.total_price = total_price;
  329. if(total_price > 0){
  330. return this.smallToBIG(total_price.toFixed(2));
  331. }else{
  332. return ""
  333. }
  334. },
  335. smallToBIG(price) {
  336. let fraction = ['角', '分'];
  337. let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
  338. let unit = [['元.', '万,', '亿,'], ['', '拾', '佰', '仟']];
  339. let head = price < 0 ? '欠' : '';
  340. price = Math.abs(price);
  341. console.log("price",price)
  342. let upper = '';
  343. for (let i = 0; i < fraction.length; i++) {
  344. upper += (digit[Math.floor(price * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
  345. }
  346. upper = upper || '整';
  347. console.log("price",upper)
  348. price = Math.floor(price);
  349. for (let i = 0; i < unit[0].length && price > 0; i++) {
  350. let p = '';
  351. for (let j = 0; j < unit[1].length && price > 0; j++) {
  352. p = digit[price % 10] + unit[1][j] + p;
  353. price = Math.floor(price / 10);
  354. }
  355. upper = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + upper;
  356. }
  357. var zhongwen = head + upper.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
  358. var ztr = zhongwen.replaceAll(".","");
  359. return ztr
  360. },
  361. getAllCount(){
  362. var total = 0
  363. for(let i=0;i<this.tableList.length;i++){
  364. total +=this.tableList[i].count
  365. }
  366. if(total > 0){
  367. return total
  368. }else{
  369. return ""
  370. }
  371. },
  372. getTotalPrice(){
  373. var total = 0
  374. for(let i=0;i<this.tableList.length;i++){
  375. total +=(this.tableList[i].count*this.tableList[i].price)
  376. }
  377. if(total > 0){
  378. return total.toFixed(2)
  379. }else{
  380. return ""
  381. }
  382. }
  383. },
  384. created() {
  385. this.orgName = this.$store.getters.xt_user.org.org_name;
  386. this.orgId = this.$store.getters.xt_user.org.id;
  387. this.fetchAllAdminUsers();
  388. this.getPurchaseOrderDetail();
  389. },
  390. };
  391. </script>
  392. <style rel="stylesheet/scss" lang="scss" scoped>
  393. .print_main_content {
  394. background-color: white;
  395. max-width: 1500px;
  396. margin: 0 auto;
  397. padding: 0 0 20px 0;
  398. .order_title_panl {
  399. text-align: center;
  400. .main_title {
  401. font-size: 18px;
  402. line-height: 40px;
  403. font-weight: 500;
  404. }
  405. }
  406. .table_panel {
  407. .table {
  408. width: 100%;
  409. border: 1px solid;
  410. border-collapse: collapse;
  411. padding: 2px;
  412. thead {
  413. tr {
  414. td {
  415. border: 1px solid;
  416. text-align: center;
  417. font-size: 18px;
  418. padding: 1px 5px;
  419. }
  420. }
  421. }
  422. tbody {
  423. tr {
  424. td {
  425. border: 1px solid;
  426. text-align: center;
  427. font-size: 18px;
  428. padding: 10px 5px;
  429. white-space: pre-line;
  430. .proj {
  431. padding: 5px 0;
  432. text-align: left;
  433. .proj_title {
  434. font-size: 16px;
  435. font-weight: 500;
  436. line-height: 25px;
  437. }
  438. .proj_item {
  439. font-size: 15px;
  440. line-height: 20px;
  441. .zone_name {
  442. font-weight: 500;
  443. }
  444. }
  445. }
  446. }
  447. }
  448. }
  449. }
  450. }
  451. }
  452. .description {
  453. width: 100%;
  454. display: flex;
  455. flex: 1;
  456. justify-content: flex-start;
  457. flex-wrap: wrap;
  458. .content {
  459. width: 25%;
  460. text-align: left;
  461. margin-bottom: 1px;
  462. font-size: 18px;
  463. }
  464. .content_1 {
  465. width: 100%;
  466. text-align: left;
  467. margin-bottom: 1px;
  468. font-size: 18px;
  469. }
  470. // .content_2{
  471. // width: 33%;
  472. // }
  473. }
  474. </style>