apply_detail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <div class="detail-container">
  3. <div v-show="!isShowPrint">
  4. <el-page-header @back="goBack" content="详情"></el-page-header>
  5. <div class="main-title">
  6. <div class="title">发货申请单信息</div>
  7. </div>
  8. <div class="diy-table-1">
  9. <el-row>
  10. <el-col :span="8" class="item">
  11. <div class="label">发货申请单号</div>
  12. <div class="value">{{detailData.id}}</div>
  13. </el-col>
  14. <el-col :span="8" class="item">
  15. <div class="label">申请日期</div>
  16. <div class="value">{{detailData.createTime}}</div>
  17. </el-col>
  18. <el-col :span="8" class="item">
  19. <div class="label">单据状态</div>
  20. <div class="value">{{detailData.examineStatus | statusFilter}}</div>
  21. </el-col>
  22. <el-col :span="8" class="item">
  23. <div class="label">经销商编号</div>
  24. <div class="value">{{detailData.customerNumber}}</div>
  25. </el-col>
  26. <el-col :span="16" class="item">
  27. <div class="label">经销商名称</div>
  28. <div class="value">{{detailData.customerName}}</div>
  29. </el-col>
  30. <el-col :span="24" class="item">
  31. <div class="label">仓库</div>
  32. <div class="value">{{detailData.correspondName}}</div>
  33. </el-col>
  34. <!-- <el-col :span="16" class="item">
  35. <div class="label">文件编号</div>
  36. <div class="value">{{detailData.fileNo}}</div>
  37. </el-col> -->
  38. <el-col :span="24" class="item">
  39. <div class="label">备注</div>
  40. <div class="value">
  41. <!-- {{detailData.remark}} -->
  42. <el-input v-model="detailData.remark" placeholder="填写备注" clearable ></el-input>
  43. </div>
  44. </el-col>
  45. <el-col :span="24" class="item file">
  46. <div class="label">附件</div>
  47. <div class="value">
  48. <div class="file-list" v-if="detailData.fileUrl">
  49. <div class="file-item">
  50. <el-image v-if="checkFileType(detailData.fileUrl) == 'image'" class="img" :src="imageURL + detailData.fileUrl" :preview-src-list="[imageURL + detailData.fileUrl]"></el-image>
  51. <div v-else class="box2" @click="openLink(detailData.fileUrl)">
  52. <img src="@/assets/common/word.png" v-if="checkFileType(detailData.fileUrl) == 'word'" />
  53. <img src="@/assets/common/excel.png" v-if="checkFileType(detailData.fileUrl) == 'excel'" />
  54. <img src="@/assets/common/ppt.png" v-if="checkFileType(detailData.fileUrl) == 'ppt'" />
  55. <img src="@/assets/common/pdf.png" v-if="checkFileType(detailData.fileUrl) == 'pdf'" />
  56. <div class="name ellipsis-3">{{ detailData.fileName }}</div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </el-col>
  62. <el-col :span="6" class="item">
  63. <div class="label">制单人</div>
  64. <div class="value">{{detailData.createBy}}</div>
  65. </el-col>
  66. <el-col :span="6" class="item">
  67. <div class="label">制单日期</div>
  68. <div class="value">{{detailData.createTime}}</div>
  69. </el-col>
  70. <el-col :span="6" class="item">
  71. <div class="label">审核人</div>
  72. <div class="value">{{detailData.approvalName}}</div>
  73. </el-col>
  74. <el-col :span="6" class="item">
  75. <div class="label">审核日期</div>
  76. <div class="value">{{detailData.approvalTime}}</div>
  77. </el-col>
  78. <el-col :span="24" class="item">
  79. <div class="label">审批说明</div>
  80. <div class="value">{{detailData.approvalRemark}}</div>
  81. </el-col>
  82. </el-row>
  83. </div>
  84. <div class="main-title">
  85. <div class="title">货品信息</div>
  86. </div>
  87. <div class="table" style="margin-top: 20px">
  88. <el-table
  89. :data="detailData.orders"
  90. element-loading-text="Loading"
  91. border
  92. fit
  93. highlight-current-row
  94. stripe
  95. show-summary
  96. :summary-method="$getSummaries">
  97. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  98. <el-table-column align="left" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
  99. <el-table-column align="left" label="销售订单号" prop="mainOrderId" min-width="120" show-overflow-tooltip></el-table-column>
  100. <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip></el-table-column>
  101. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="120" show-overflow-tooltip></el-table-column>
  102. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  103. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip></el-table-column>
  104. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  105. <el-table-column align="left" label="文件编号" prop="fileNo" min-width="100" show-overflow-tooltip></el-table-column>
  106. <el-table-column align="right" label="含税单价" prop="singlePayPrice" min-width="100" show-overflow-tooltip>
  107. <template slot-scope="scope">
  108. {{scope.row.singlePayPrice | numToFixed}}
  109. </template>
  110. </el-table-column>
  111. <el-table-column align="right" label="价税合计" prop="payAmount" min-width="100" show-overflow-tooltip>
  112. <template slot-scope="scope">
  113. {{scope.row.payAmount | numToFixed}}
  114. </template>
  115. </el-table-column>
  116. <el-table-column align="right" label="返利金额" prop="payRebateAmount" min-width="100" show-overflow-tooltip>
  117. <template slot-scope="scope">
  118. {{scope.row.payRebateAmount | numToFixed}}
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="right" label="格力折扣" prop="totalDiscAmount" min-width="100" show-overflow-tooltip>
  122. <template slot-scope="scope">
  123. {{scope.row.totalDiscAmount | numToFixed}}
  124. </template>
  125. </el-table-column>
  126. <el-table-column align="right" label="销售政策名称" prop="policyTitle" min-width="100" show-overflow-tooltip></el-table-column>
  127. <el-table-column align="right" label="申请数量" prop="invoiceNum" min-width="100" show-overflow-tooltip></el-table-column>
  128. <el-table-column align="right" label="审批数量" prop="approvalNumber" min-width="100" show-overflow-tooltip></el-table-column>
  129. <el-table-column align="right" label="已退数量" prop="retiredQty" min-width="100" show-overflow-tooltip v-if="detailData.type !== 2"></el-table-column>
  130. <el-table-column align="left" label="表头备注" prop="headerRemark" min-width="160" show-overflow-tooltip></el-table-column>
  131. <!-- <el-table-column align="left" label="发货申请备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column> -->
  132. <el-table-column align="left" label="表体备注" prop="invoiceRemark" min-width="160" show-overflow-tooltip></el-table-column>
  133. <el-table-column align="left" label="业务员" prop="serviceName" min-width="100" show-overflow-tooltip></el-table-column>
  134. <el-table-column align="left" label="表头业务员" prop="k3ServiceName" min-width="100" show-overflow-tooltip></el-table-column>
  135. </el-table>
  136. </div>
  137. <div v-if="isExamine">
  138. <div class="main-title">
  139. <div class="title">审批记录</div>
  140. </div>
  141. <div class="diy-table-1">
  142. <el-row :gutter="0">
  143. <el-col :span="12" class="item">
  144. <div class="label">审批人</div>
  145. <div class="value">{{detailData.approvalName}}</div>
  146. </el-col>
  147. <el-col :span="12" class="item">
  148. <div class="label">审批结果</div>
  149. <div class="value">{{detailData.examineStatus | statusFilter}}</div>
  150. </el-col>
  151. <el-col :span="24" class="item">
  152. <div class="label">审批说明</div>
  153. <div class="value">{{detailData.approvalRemark}}</div>
  154. </el-col>
  155. </el-row>
  156. </div>
  157. </div>
  158. <div class="page-footer">
  159. <div class="footer">
  160. <el-button type="primary" icon="el-icon-printer" @click="toPrint" :disabled="detailData.examineStatus !== 'OK'">打 印</el-button>
  161. <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
  162. <el-button slot="reference">关 闭</el-button>
  163. </el-popconfirm>
  164. </div>
  165. </div>
  166. </div>
  167. <print-preview ref="preView" />
  168. <!-- <CommonPrint :printId="printId" :printType="printType" v-if="isShowPrint" @backDetail="backDetail" /> -->
  169. </div>
  170. </template>
  171. <script>
  172. import { disAutoConnect, hiprint, defaultElementTypeProvider } from 'vue-plugin-hiprint'
  173. disAutoConnect();
  174. import panel from './design/panel'
  175. import { getDetail, detailArr } from './design/print-data'
  176. import printPreview from './design/preview.vue'
  177. import { getApplyDetail } from "@/api/supply/apply";
  178. import { getFileUrl } from '@/api/common';
  179. import CommonPrint from "@/views/supply/deliver/components/common_print";
  180. export default {
  181. name: 'ApplyDetail',
  182. componentName: 'ApplyDetail',
  183. props: ['listItem'],
  184. components: {
  185. CommonPrint,
  186. printPreview
  187. },
  188. filters: {
  189. statusFilter(val) {
  190. const statusList = [
  191. { label: '已保存', value: 'SAVE' },
  192. { label: '待审核', value: 'WAIT' },
  193. { label: '审核通过', value: 'OK' },
  194. // { label: '审核驳回', value: 'FAIL' },,
  195. { label: '已关闭', value: 'CLOSE' },
  196. ];
  197. let obj = statusList.find(o => o.value == val);
  198. return obj ? obj.label : ''
  199. }
  200. },
  201. data() {
  202. return {
  203. imageURL: this.$imageUrl,
  204. detailData: {},
  205. printType: 1,
  206. printId: '',
  207. isShowPrint: false,
  208. curPaper: {
  209. type: 'A5',
  210. width: 500,
  211. height: 147.6
  212. },
  213. paperTypes: {
  214. 'A3': {
  215. width: 420,
  216. height: 296.6
  217. },
  218. 'A4': {
  219. width: 210,
  220. height: 296.6
  221. },
  222. 'A5': {
  223. width: 210,
  224. height: 147.6
  225. },
  226. 'B3': {
  227. width: 500,
  228. height: 352.6
  229. },
  230. 'B4': {
  231. width: 250,
  232. height: 352.6
  233. },
  234. 'B5': {
  235. width: 250,
  236. height: 175.6
  237. }
  238. },
  239. scaleValue: 1,
  240. scaleMax: 5,
  241. scaleMin: 0.5,
  242. hiprintTemplate:'',
  243. }
  244. },
  245. computed: {
  246. isExamine() {
  247. return this.detailData.examineStatus === 'OK' || this.detailData.examineStatus === "FAIL"
  248. },
  249. curPaperType() {
  250. let type = 'other'
  251. let types = this.paperTypes
  252. for (const key in types) {
  253. let item = types[key]
  254. let { width, height } = this.curPaper
  255. if (item.width === width && item.height === height) {
  256. type = key
  257. }
  258. }
  259. return type
  260. }
  261. },
  262. created() {
  263. this.getDetail();
  264. },
  265. mounted() {
  266. this.initPrint()
  267. },
  268. // activated(){
  269. // this.initPrint()
  270. // },
  271. methods: {
  272. initPrint(){
  273. hiprint.init({
  274. providers: [new defaultElementTypeProvider()]
  275. });
  276. // 还原配置
  277. hiprint.setConfig()
  278. // 替换配置
  279. hiprint.setConfig({
  280. movingDistance: 2.5,
  281. text: {
  282. supportOptions: [
  283. {
  284. name: 'styler',
  285. hidden: true
  286. },
  287. {
  288. name: 'formatter',
  289. hidden: true
  290. },
  291. ]
  292. }
  293. })
  294. // eslint-disable-next-line no-undef
  295. hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
  296. this.hiprintTemplate = new hiprint.PrintTemplate({
  297. template: panel,
  298. settingContainer: '#PrintElementOptionSetting',
  299. paginationContainer: '.hiprint-printPagination'
  300. });
  301. this.hiprintTemplate.design('#hiprint-printTemplate');
  302. // 获取当前放大比例, 当zoom时传true 才会有
  303. // this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
  304. }
  305. ,
  306. // 返回列表
  307. goBack() {
  308. this.$emit('backListFormDetail');
  309. },
  310. // 获取详情
  311. getDetail() {
  312. getApplyDetail({id: this.listItem.id}).then(res => {
  313. if(res.data.orders) {
  314. res.data.orders.forEach(item => {
  315. item.sums1 = ['invoiceNum', 'approvalNumber', 'retiredQty'];
  316. item.sums2 = ['singlePayPrice', 'payAmount', 'payRebateAmount', 'totalDiscAmount'];
  317. })
  318. }
  319. this.detailData = res.data;
  320. })
  321. },
  322. // 检查文件类型
  323. checkFileType(url) {
  324. if(!url) return '';
  325. const fileSuffix = url.substring(url.lastIndexOf(".") + 1);
  326. if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
  327. return 'image';
  328. }else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
  329. return 'word';
  330. }else if(['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
  331. return 'excel';
  332. }else if(['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
  333. return 'ppt';
  334. }else if(['pdf'].includes(fileSuffix)) {
  335. return 'pdf';
  336. }else {
  337. return '';
  338. }
  339. },
  340. // 打开链接
  341. openLink(url) {
  342. getFileUrl({key: url}).then(res => {
  343. window.open(res.data);
  344. })
  345. },
  346. // 点击打印
  347. toPrint() {
  348. this.printId = this.listItem.id;
  349. // this.isShowPrint = true;
  350. getDetail(this.listItem.id)
  351. this.$refs.preView.show(this.hiprintTemplate, detailArr)
  352. },
  353. backDetail() {
  354. this.printId = '';
  355. this.isShowPrint = false;
  356. },
  357. /**
  358. * 设置纸张大小
  359. * @param type [A3, A4, A5, B3, B4, B5, other]
  360. * @param value {width,height} mm
  361. */
  362. setPaper(type, value) {
  363. try {
  364. if (Object.keys(this.paperTypes).includes(type)) {
  365. this.curPaper = { type: type, width: value.width, height: value.height }
  366. this.hiprintTemplate.setPaper(value.width, value.height)
  367. } else {
  368. this.curPaper = { type: 'other', width: value.width, height: value.height }
  369. this.hiprintTemplate.setPaper(value.width, value.height)
  370. }
  371. } catch (error) {
  372. this.$message.error(`操作失败: ${error}`)
  373. }
  374. },
  375. }
  376. }
  377. </script>
  378. <style scoped lang="scss">
  379. .detail-container {
  380. width: 100%;
  381. height: 100%;
  382. }
  383. .main-title {
  384. display: flex;
  385. justify-content: space-between;
  386. align-items: center;
  387. margin-top: 20px;
  388. height: 60px;
  389. border-bottom: 1px solid #DCDFE6;
  390. margin-bottom: 20px;
  391. .title {
  392. font-size: 16px;
  393. font-weight: 600;
  394. padding-left: 10px;
  395. }
  396. }
  397. </style>