supplierDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <!-- 商品退货管理————待确认 -->
  3. <div>
  4. <div class="right-button">
  5. <el-button type="primary" v-print="printObj">打印</el-button>
  6. <el-button type="primary" v-if="isShow" @click="handleConfirm" :loading="sureLoading"
  7. >确 认</el-button
  8. >
  9. </div>
  10. <div class="common-card">
  11. <h3>基本信息</h3>
  12. <el-form
  13. :model="listForm"
  14. ref="listform"
  15. label-width="180px"
  16. class="grid-form-class"
  17. >
  18. <div class="form-body">
  19. <div class="flex-css">
  20. <el-form-item label="对账单号" prop="stmtNo">
  21. <div class="content">
  22. {{ listForm.stmtNo }}
  23. </div>
  24. </el-form-item>
  25. <el-form-item label="客户名称" prop="branchName">
  26. <div class="content">
  27. {{ listForm.branchName }}
  28. </div>
  29. </el-form-item>
  30. <el-form-item label="对账类型" prop="isFas">
  31. <div class="content">
  32. {{ listForm.isFas }}
  33. </div>
  34. </el-form-item>
  35. </div>
  36. <div class="flex-css">
  37. <el-form-item label="对账周期" prop="stmtPrd">
  38. <div class="content">
  39. {{ listForm.stmtPrd }}
  40. </div>
  41. </el-form-item>
  42. <el-form-item label="对账金额" prop="amt">
  43. <div class="content">
  44. {{ listForm.amt }}
  45. </div>
  46. </el-form-item>
  47. <el-form-item label="状态" prop="stas">
  48. <div class="content">
  49. {{ listForm.stas }}
  50. </div>
  51. </el-form-item>
  52. </div>
  53. </div>
  54. </el-form>
  55. </div>
  56. <div class="common-card">
  57. <h3>明细信息</h3>
  58. <div id="printMe">
  59. <el-table
  60. ref="table"
  61. v-loading="listLoading"
  62. element-loading-text="加载中"
  63. :data="list"
  64. show-summary
  65. :summary-method="getSummaries"
  66. :span-method="arraySpanMethod"
  67. show-summary
  68. :header-cell-style="getRowClass"
  69. class="print-table"
  70. >
  71. <template slot="empty">
  72. <img src="@/assets/nopage.png" alt />
  73. <p>暂无数据</p>
  74. </template>
  75. <el-table-column
  76. :label="tableLabel"
  77. align="center"
  78. >
  79. <!-- :header-cell-style="{background:'#ccc',borderColor:'#000'}" -->
  80. <el-table-column type="index" label="序号" border align="center"/>
  81. <el-table-column label="商品名称" prop="prodName" align="center"/>
  82. <el-table-column label="规格" prop="spec"align="center" />
  83. <el-table-column label="型号" prop="mol" align="center">
  84. </el-table-column>
  85. <el-table-column label="数量" prop="cnt" align="center"/>
  86. <el-table-column label="单位" prop="unt" align="center"/>
  87. <el-table-column label="单价" prop="pric" align="center"/>
  88. <el-table-column label="总计" prop="amt" align="center"/>
  89. <el-table-column label="类别" prop="mcsType" align="center">
  90. <template #default="{ row }">
  91. <span v-if="row.mcsType == '0'">普通耗材</span>
  92. <span v-if="row.mcsType == '1'">高值耗材</span>
  93. <span v-if="row.mcsType == '2'">试剂</span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="是否集采" prop="isFas" align="center">
  97. <template #default="{ row }">
  98. <span v-if="row.isFas == '0'">非集采</span>
  99. <span v-if="row.isFas == '1'">集采</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="批次" prop="lotNum" align="center">
  103. </el-table-column>
  104. <!-- <el-table-column label="生产日期" prop="retnCnt" align="center"/>
  105. <el-table-column label="有效期" prop="prodEntp" align="center"/> -->
  106. <el-table-column label="厂商" prop="prodEntp" align="center"/>
  107. </el-table-column>
  108. </el-table-column>
  109. <p class="price-css">共计{{total}}条</p>
  110. </el-table>
  111. </div>
  112. <!-- <p class="price-css">合计数量:{{}} <span></span>合计金额: {{}}</p> -->
  113. </div>
  114. </div>
  115. </template>
  116. <script>
  117. import ylStep from "@/components/yl-step";
  118. import ylPagination from "@/components/yl-pagination";
  119. import mcsInfo from "@/views/components/mcs-info.vue";
  120. import { selectRetnDetl, acpRetnOrd } from "@/api/productreturnmanage-sup/returnList";
  121. import {selectSetlStmtDetlD} from "@/api/procurement-settlement/index"
  122. export default {
  123. components: {
  124. ylStep,
  125. ylPagination,
  126. mcsInfo,
  127. },
  128. data() {
  129. return {
  130. total:"",
  131. listForm: {
  132. stmtNo:"",
  133. branchName:"",
  134. isFas:"",
  135. amt:"",
  136. stmtPrd:"",
  137. stas:"",
  138. },
  139. stasOptions: [
  140. { value: "A", lable: "待确认" },
  141. { value: "B", lable: "已确认" },
  142. ],
  143. isFasOptions: [
  144. { value: "0", lable: "非集采" },
  145. { value: "1", lable: "集采" },
  146. ],
  147. listLoading: false,
  148. list: [],
  149. isShow: false,
  150. sureLoading: false,
  151. printLoading: false,
  152. tableLabel:"",
  153. // 打印
  154. printObj: {
  155. id: "printMe",
  156. popTitle: "", // 打印配置页上方标题
  157. extraHead: "", //最上方的头部文字,附加在head标签上的额外标签,使用逗号分隔
  158. preview: "", // 是否启动预览模式,默认是false(开启预览模式,可以先预览后打印)
  159. previewTitle: "", // 打印预览的标题(开启预览模式后出现),
  160. previewPrintBtnLabel: "", // 打印预览的标题的下方按钮文本,点击可进入打印(开启预览模式后出现)
  161. zIndex: "", // 预览的窗口的z-index,默认是 20002(此值要高一些,这涉及到预览模式是否显示在最上面)
  162. beforeEntryIframe () {
  163. const cells = document.querySelectorAll('.cell')
  164. for (let k7 = 0; k7 < cells.length; k7++) {
  165. const cell = cells[k7]
  166. // 在这里添加样式只是修改了打印的样式,不会污染原页面的样式
  167. // 为了让表格中的内容自动换行,不需要的话可以删掉
  168. cell.style.whiteSpace = 'pre-wrap'
  169. }
  170. },
  171. // beforeEntryIframe(copy) {
  172. // console.log(copy,"copy")
  173. // // copy是ele对象的深度拷贝,修改copy对象不会更改页面中table表格的样式,只会更改打印预览生成的表格的样式
  174. // const cells = copy.querySelectorAll('.cell');
  175. // const tableNode = copy.querySelectorAll('.el-table__header,.el-table__body');
  176. // ;[].slice.call(cells).forEach(item => {
  177. // // 为了让表格中的内容自动换行,不需要的话可以删掉
  178. // item.style.whiteSpace = 'pre-wrap'
  179. // })
  180. // // el-table打印不全的问题
  181. // ;[].slice.call(tableNode).forEach(item => {
  182. // item.style.width = '100%';
  183. // const child = item.childNodes;
  184. // ;[].slice.call(child).forEach(element => {
  185. // if(element.localName === 'colgroup') {
  186. // element.innerHTML = ''
  187. // }
  188. // })
  189. // })
  190. // },
  191. previewBeforeOpenCallback() {}, //预览窗口打开之前的callback(开启预览模式调用)
  192. previewOpenCallback() {}, // 预览窗口打开之后的callback(开启预览模式调用)
  193. beforeOpenCallback: () => {}, // 开启打印前的回调事件
  194. openCallback() {}, // 调用打印之后的回调事件
  195. closeCallback() {}, //关闭打印的回调事件(无法确定点击的是确认还是取消)
  196. url: "",
  197. standard: "",
  198. extraCss: "",
  199. },
  200. };
  201. },
  202. created() {
  203. if (this.$route.query.stas == "A") {
  204. this.isShow = true;
  205. } else {
  206. this.isShow = false;
  207. }
  208. this.tableLabel = this.$route.query.branchName +"对账明细"
  209. this.listForm.stmtNo = this.$route.query.stmtNo;
  210. this.listForm.branchName = this.$route.query.branchName;
  211. this.listForm.amt = this.$route.query.amt;
  212. this.listForm.stmtPrd = this.$route.query.stmtPrd;
  213. this.stasOptions.forEach((i) => {
  214. if (i.value == this.$route.query.stas) {
  215. this.listForm.stas = i.lable;
  216. }
  217. });
  218. this.isFasOptions.forEach((i) => {
  219. if (i.value == this.$route.query.isFas) {
  220. this.listForm.isFas = i.lable;
  221. }
  222. });
  223. },
  224. mounted() {
  225. this.getData();
  226. },
  227. methods: {
  228. //设置表格第一行的颜色
  229. // getRowClass({ row, column, rowIndex, columnIndex }) {
  230. // return "background:#e2e1e1;text-align:center";
  231. // },
  232. arraySpanMethod() {
  233. //table合计行合并单元格
  234. setTimeout(() => {
  235. if (this.$refs.table.$el) {
  236. let current = this.$refs.table.$el
  237. .querySelector('.el-table__footer-wrapper')
  238. .querySelector('.el-table__footer')
  239. let cell = current.rows[0].cells
  240. cell[1].colSpan = '13'
  241. }
  242. }, 50)
  243. },
  244. getSummaries(param) {
  245. //table自定义合计行方法summary-method
  246. const { columns, data } = param
  247. const sums = []
  248. columns.forEach((column, index) => {
  249. if (index === 0) {
  250. sums[index] = '合计';
  251. return
  252. }
  253. if(index===7){
  254. const values = data.map(item => Number(item[column.property]))
  255. sums[1] = values.reduce((prev, curr) => {
  256. return prev + curr
  257. }, 0)
  258. sums[1]=sums[1].toFixed(2)+"元"
  259. }
  260. })
  261. return sums
  262. },
  263. getData() {
  264. this.listLoading = true;
  265. selectSetlStmtDetlD({ stmtNo: this.$route.query.stmtNo })
  266. .then((res) => {
  267. this.list = res.data;
  268. this.total = this.$route.query.detlCnt;
  269. this.listLoading = false;
  270. })
  271. .catch((err) => {
  272. this.listLoading = false;
  273. });
  274. },
  275. // 确认退货
  276. handleConfirm() {
  277. this.$confirm("确认对账", "提示", {
  278. confirmButtonText: "确定",
  279. cancelButtonText: "取消",
  280. type: "warning",
  281. }).then(() => {
  282. this.sureLoading = true;
  283. let data = {
  284. stmtNo: this.$route.query.stmtNo,
  285. spdId: this.$route.query.spdId,
  286. stas: "B",
  287. };
  288. updateSetlStmtDStas(data)
  289. .then((res) => {
  290. if (res.success == true) {
  291. this.sureLoading = false;
  292. this.$message.success("操作成功");
  293. this.$router.push({
  294. name: "reconciliation",
  295. query: { spdId: this.$route.query.spdId,activeNameTab:this.$route.query.activeNameTab },
  296. });
  297. } else {
  298. this.sureLoading = false;
  299. this.$message.error("确认失败");
  300. }
  301. })
  302. .catch((err) => {
  303. this.sureLoading = false;
  304. });
  305. });
  306. },
  307. },
  308. };
  309. </script>
  310. <style lang="scss" scoped>
  311. #printMe {
  312. ::v-deep .print-table {
  313. border: 1px solid #999;
  314. td,
  315. th {
  316. border-right: 1px solid #999;
  317. border-bottom: 1px solid #999;
  318. }
  319. }
  320. ::v-deep .price-css{
  321. margin-left: 94%;
  322. }
  323. }
  324. </style>