sales_detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header @back="goBack" :content="!edit ? '详情' : '编辑'"></el-page-header>
  4. <div id="printMe">
  5. <div class="main-title">
  6. <div class="title">出库单信息</div>
  7. </div>
  8. <div class="diy-table-1">
  9. <el-row :gutter="0">
  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.orderTime }}</div>
  17. </el-col>
  18. <el-col :span="8" class="item">
  19. <div class="label">单据状态</div>
  20. <div class="value">
  21. {{ detailData.examineStatus | statusFilter }}
  22. </div>
  23. </el-col>
  24. <el-col :span="8" class="item">
  25. <div class="label">发货单号</div>
  26. <div class="value">{{ detailData.orderNo }}</div>
  27. </el-col>
  28. <el-col :span="16" class="item">
  29. <div class="label">经销商</div>
  30. <div class="value">{{ detailData.customerName }}</div>
  31. </el-col>
  32. <el-col :span="8" class="item">
  33. <div class="label">仓库</div>
  34. <div class="value">{{ detailData.correspondName }}</div>
  35. </el-col>
  36. <el-col :span="16" class="item">
  37. <div class="label">备注</div>
  38. <div class="value">
  39. <el-input v-model="detailData.remark" :readonly="!edit" placeholder="请输入备注"></el-input>
  40. </div>
  41. </el-col>
  42. <el-col :span="24" class="item file" style="width: 100%; height: auto">
  43. <div class="label">附件</div>
  44. <div class="value">
  45. <div class="file-list">
  46. <div class="file-item" v-for="item in detailData.salesOrderPictures">
  47. <el-image
  48. v-if="checkFileType(item.fileUrl) == 'image'"
  49. class="img"
  50. :fit="fill"
  51. :src="$imageUrl + item.fileUrl"
  52. :preview-src-list="[$imageUrl + item.fileUrl]"
  53. ></el-image>
  54. <div v-else class="box2" @click="openLink(item.fileUrl)">
  55. <img src="@/assets/common/word.png" v-if="checkFileType(item.fileUrl) == 'word'" />
  56. <img src="@/assets/common/excel.png" v-if="checkFileType(item.fileUrl) == 'excel'" />
  57. <img src="@/assets/common/ppt.png" v-if="checkFileType(item.fileUrl) == 'ppt'" />
  58. <img src="@/assets/common/pdf.png" v-if="checkFileType(item.fileUrl) == 'pdf'" />
  59. <div class="name ellipsis-3">{{ item.fileName }}</div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </el-col>
  65. </el-row>
  66. </div>
  67. <div class="fileUpload" v-if="edit">
  68. <div class="main-title">
  69. <div class="title">上传附件</div>
  70. </div>
  71. <fileUpload :fileList="fileList" multiple />
  72. </div>
  73. <div class="main-title">
  74. <div class="title">货品信息</div>
  75. </div>
  76. <div class="table">
  77. <el-table
  78. :data="detailData.saleOrderData"
  79. element-loading-text="Loading"
  80. border
  81. fit
  82. highlight-current-row
  83. stripe
  84. max-height="400"
  85. show-summary
  86. :summary-method="$getSummaries"
  87. >
  88. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  89. <el-table-column align="center" label="销售订单号" prop="mainOrderId" min-width="180" show-overflow-tooltip>
  90. <template slot-scope="scope">
  91. {{
  92. scope.row.orderType === 'TRADE' ||
  93. scope.row.orderType === 'HOME' ||
  94. scope.row.orderType === 'REQUISITION_TRADE' ||
  95. scope.row.orderType === 'REQUISITION_HOME'
  96. ? scope.row.enginOrderNo
  97. : scope.row.mainOrderId
  98. }}
  99. </template>
  100. </el-table-column>
  101. <el-table-column
  102. align="center"
  103. label="物料编码"
  104. prop="materialCode"
  105. min-width="120"
  106. show-overflow-tooltip
  107. ></el-table-column>
  108. <el-table-column
  109. align="center"
  110. label="产品编码"
  111. prop="materialOldNumber"
  112. min-width="120"
  113. show-overflow-tooltip
  114. ></el-table-column>
  115. <el-table-column
  116. align="center"
  117. label="产品名称"
  118. prop="materialName"
  119. min-width="160"
  120. show-overflow-tooltip
  121. ></el-table-column>
  122. <el-table-column
  123. align="center"
  124. label="规格型号"
  125. prop="specification"
  126. min-width="160"
  127. show-overflow-tooltip
  128. ></el-table-column>
  129. <el-table-column
  130. align="center"
  131. label="单位"
  132. prop="unit"
  133. min-width="100"
  134. show-overflow-tooltip
  135. ></el-table-column>
  136. <el-table-column align="right" label="数量" prop="refundableQty" min-width="100" show-overflow-tooltip>
  137. <template slot-scope="scope">
  138. <template v-if="edit">
  139. <el-input
  140. size="mini"
  141. class="input"
  142. v-model="scope.row.refundableQty"
  143. placeholder="请输入数量"
  144. ></el-input>
  145. </template>
  146. <template v-else>
  147. {{ scope.row.refundableQty }}
  148. </template>
  149. </template>
  150. </el-table-column>
  151. <!-- <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  152. <template slot-scope="scope">
  153. {{ scope.row.price | numToFixed }}
  154. </template>
  155. </el-table-column>
  156. <el-table-column align="right" label="订单金额" prop="payAmount" min-width="100" show-overflow-tooltip>
  157. <template slot-scope="scope">
  158. {{ scope.row.payAmount | numToFixed }}
  159. </template>
  160. </el-table-column> -->
  161. <el-table-column align="left" label="表头备注" prop="headerRemark" min-width="160" show-overflow-tooltip>
  162. <template slot-scope="scope">
  163. <template v-if="edit">
  164. <el-input
  165. size="mini"
  166. class="input"
  167. v-model="scope.row.headerRemark"
  168. placeholder="请输入表头备注"
  169. ></el-input>
  170. </template>
  171. <template v-else>
  172. {{ scope.row.headerRemark }}
  173. </template>
  174. </template>
  175. </el-table-column>
  176. <!-- <el-table-column align="left" label="发货申请备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column> -->
  177. <el-table-column align="left" label="表体备注" prop="invoiceRemark" min-width="160" show-overflow-tooltip>
  178. <template slot-scope="scope">
  179. <template v-if="edit">
  180. <el-input
  181. size="mini"
  182. class="input"
  183. v-model="scope.row.invoiceRemark"
  184. placeholder="请输表体备注"
  185. ></el-input>
  186. </template>
  187. <template v-else>
  188. {{ scope.row.invoiceRemark }}
  189. </template>
  190. </template>
  191. </el-table-column>
  192. <el-table-column
  193. align="left"
  194. label="表头业务员"
  195. prop="k3ServiceName"
  196. min-width="100"
  197. show-overflow-tooltip
  198. ></el-table-column>
  199. <el-table-column
  200. align="left"
  201. label="表体业务员"
  202. prop="serviceName"
  203. min-width="100"
  204. show-overflow-tooltip
  205. ></el-table-column>
  206. <el-table-column
  207. align="left"
  208. label="打印时间"
  209. prop="printTime"
  210. min-width="100"
  211. show-overflow-tooltip
  212. sortable
  213. ></el-table-column>
  214. <el-table-column
  215. align="left"
  216. label="打印状态"
  217. prop="printStatus"
  218. min-width="100"
  219. show-overflow-tooltip
  220. sortable
  221. >
  222. <template slot-scope="scope">
  223. {{ scope.row.printStatus == 1 ? '已打印' : '未打印' }}
  224. </template>
  225. </el-table-column>
  226. </el-table>
  227. </div>
  228. <div class="main-title">
  229. <div class="title">审批记录</div>
  230. </div>
  231. <div class="diy-table-1">
  232. <el-row :gutter="0">
  233. <el-col :xs="12" :sm="12" :lg="12" class="item">
  234. <div class="label">审批人</div>
  235. <div class="value">{{ detailData.approvalName }}</div>
  236. </el-col>
  237. <el-col :xs="12" :sm="12" :lg="12" class="item">
  238. <div class="label">制单人</div>
  239. <div class="value">{{ detailData.createBy }}</div>
  240. </el-col>
  241. <el-col :xs="12" :sm="12" :lg="12" class="item">
  242. <div class="label">审批结果</div>
  243. <div class="value">
  244. {{ detailData.examineStatus | statusFilter }}
  245. </div>
  246. </el-col>
  247. <el-col :xs="12" :sm="12" :lg="12" class="item">
  248. <div class="label">审批时间</div>
  249. <div class="value">{{ detailData.approvalTime }}</div>
  250. </el-col>
  251. <el-col :xs="24" :sm="24" :lg="24" class="item">
  252. <div class="label">审批说明</div>
  253. <div class="value">{{ detailData.approvalRemark }}</div>
  254. </el-col>
  255. </el-row>
  256. </div>
  257. </div>
  258. <div style="margin: 10px" v-if="edit">
  259. <el-button type="primary" @click="updateNum">保存</el-button>
  260. </div>
  261. </div>
  262. </template>
  263. <script>
  264. import print from 'vue-print-nb'
  265. import { getDetail, updateNum } from '@/api/supply/sales'
  266. import { getFileUrl } from '@/api/common'
  267. import fileUpload from '@/components/Common/file-upload.vue'
  268. export default {
  269. name: 'SalesDetail',
  270. componentName: 'SalesDetail',
  271. props: ['listItem', 'edit'],
  272. components: {
  273. fileUpload
  274. },
  275. directives: {
  276. print
  277. },
  278. filters: {
  279. statusFilter(val) {
  280. const statusList = [
  281. { label: '已保存', value: 'SAVE' },
  282. { label: '待审核', value: 'WAIT' },
  283. { label: '审核通过', value: 'OK' }
  284. // { label: '审核驳回', value: 'FAIL' },,
  285. ]
  286. let obj = statusList.find(o => o.value == val)
  287. return obj ? obj.label : ''
  288. }
  289. },
  290. data() {
  291. return {
  292. printObj: {
  293. id: 'printMe'
  294. },
  295. detailData: {},
  296. srcList: [],
  297. fileList: [],
  298. }
  299. },
  300. created() {
  301. this.getDetail()
  302. },
  303. methods: {
  304. // 返回列表
  305. goBack() {
  306. this.$emit('backListFormDetail')
  307. this.$parent.edit = false
  308. },
  309. updateNum() {
  310. this.detailData.saleOrderData.forEach(item => {
  311. item.remark = item.invoiceRemark
  312. item.invoiceNum = +item.refundableQty
  313. })
  314. const salesOrderPictures = []
  315. if (this.fileList.length) {
  316. this.fileList.forEach(k => {
  317. salesOrderPictures.push({
  318. fileName: k.name,
  319. fileUrl: k.url,
  320. salesId: this.detailData.id
  321. })
  322. })
  323. }
  324. updateNum({
  325. ...this.detailData,
  326. salesOrderPictures:[...this.detailData.salesOrderPictures,...salesOrderPictures]
  327. }).then(res => {
  328. this.$successMsg('修改成功')
  329. this.$parent.edit = false
  330. this.goBack()
  331. this.$parent.getList()
  332. })
  333. },
  334. // 打开链接
  335. openLink(url) {
  336. getFileUrl({ key: url }).then(res => {
  337. window.open(res.data)
  338. })
  339. },
  340. // 检查文件类型
  341. checkFileType(url) {
  342. if (!url) return ''
  343. const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
  344. if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
  345. return 'image'
  346. } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
  347. return 'word'
  348. } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
  349. return 'excel'
  350. } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
  351. return 'ppt'
  352. } else if (['pdf'].includes(fileSuffix)) {
  353. return 'pdf'
  354. } else if (['zip', 'rar', 'gz', 'apk'].includes(fileSuffix)) {
  355. return 'file'
  356. } else {
  357. return ''
  358. }
  359. },
  360. // 获取详情
  361. getDetail() {
  362. getDetail({ id: this.listItem.id }).then(res => {
  363. if (res.data.saleOrderData) {
  364. res.data.saleOrderData.forEach(item => {
  365. item.sums1 = ['refundableQty']
  366. item.sums2 = ['payAmount', 'price']
  367. })
  368. }
  369. this.detailData = res.data
  370. this.srcList = [this.$imageUrl + this.detailData.fileUrl]
  371. })
  372. }
  373. }
  374. }
  375. </script>
  376. <style scoped lang="scss">
  377. .detail-container {
  378. width: 100%;
  379. height: 100%;
  380. .input {
  381. ::v-deep .el-input__inner {
  382. text-align: right !important;
  383. }
  384. }
  385. }
  386. .img-box {
  387. height: 150px;
  388. display: flex;
  389. align-items: center;
  390. }
  391. .file {
  392. width: 64px;
  393. height: 64px;
  394. }
  395. .fileUpload{
  396. margin-right: 10px;
  397. }
  398. </style>