sales_detail.vue 13 KB

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