detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div class="salesReturnDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="salesReturnDetail-cont">
  4. <template slot="subTitle">
  5. <a href="javascript:;" @click="handleBack">
  6. <a-icon type="left"></a-icon>
  7. 返回列表
  8. </a>
  9. </template>
  10. <template slot="extra">
  11. <a-button key="3" id="salesReturnDetail-preview-btn">打印预览</a-button>
  12. <a-button key="4" type="primary" id="salesReturnDetail-print-btn">快速打印</a-button>
  13. </template>
  14. </a-page-header>
  15. <!-- 基础信息 -->
  16. <a-card size="small" :bordered="false" class="salesReturnDetail-cont">
  17. <a-collapse :activeKey="['1']">
  18. <a-collapse-panel key="1" header="基础信息">
  19. <a-descriptions size="small" :column="3" v-if="detailData">
  20. <a-descriptions-item label="客户名称">{{ detailData.buyerName || '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="销退单号">{{ detailData.salesReturnBillNo || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="创建时间">{{ detailData.createDate || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="退货数量">{{ detailData.totalQty || detailData.totalQty == 0 ? detailData.totalQty : '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="坏件数量">{{ detailData.totalBadQty || detailData.totalBadQty == 0 ? detailData.totalBadQty : '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="返库数量">{{ detailData.totalBackStockQty || detailData.totalBackStockQty == 0 ? detailData.totalBackStockQty : '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="退货金额">{{ detailData.totalAmount || detailData.totalAmount == 0 ? detailData.totalAmount : '--' }}元</a-descriptions-item>
  27. </a-descriptions>
  28. </a-collapse-panel>
  29. </a-collapse>
  30. </a-card>
  31. <a-card size="small" :bordered="false" class="pages-wrap">
  32. <!-- 列表 -->
  33. <s-table
  34. class="sTable"
  35. ref="table"
  36. size="small"
  37. :rowKey="record => record.id"
  38. :columns="columns"
  39. :data="loadData"
  40. :scroll="{ x: 1430 }"
  41. bordered></s-table>
  42. </a-card>
  43. <a-card size="small" :bordered="false" class="footer-cont">
  44. <a-button
  45. type="primary"
  46. class="button-warning"
  47. style="width: 150px;"
  48. size="large"
  49. v-if="detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')"
  50. @click="handleEexamine()"
  51. id="salesReturn-eexamine-btn">审核</a-button>
  52. <a-button
  53. type="primary"
  54. class="button-info"
  55. size="large"
  56. style="width: 150px;"
  57. id="salesDetail-edit-btn"
  58. v-if="detailData&&detailData.salesReturnBillSource == 'SALES' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'WAIT_SUBMIT')"
  59. @click="handleEdit()"
  60. >
  61. 编辑
  62. </a-button>
  63. <a-button
  64. size="large"
  65. style="width: 150px;"
  66. v-if="detailData&&detailData.salesReturnBillSource != 'SALES' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')"
  67. type="primary"
  68. class="button-info"
  69. @click="handleEdit()"
  70. id="salesReturn-edit-btn">改单</a-button>
  71. </a-card>
  72. </div>
  73. </template>
  74. <script>
  75. import { getOperationalPrecision } from '@/libs/tools.js'
  76. import { STable, VSelect } from '@/components'
  77. import { salesReturnDetail, salesReturnAudit } from '@/api/salesReturn'
  78. import { salesReturnDetailList } from '@/api/salesReturnDetail'
  79. export default {
  80. name: 'SalesReturnDetail',
  81. components: { STable, VSelect },
  82. data () {
  83. return {
  84. disabled: false,
  85. // 表头
  86. columns: [
  87. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  88. { title: '采购单号', dataIndex: 'purchaseBillNo', align: 'center', width: 200, customRender: function (text) { return text || '--' } },
  89. {
  90. title: '产品编码',
  91. dataIndex: 'productEntity.code',
  92. align: 'center',
  93. width: 160,
  94. customRender: function (text) { return text || '--' }
  95. },
  96. {
  97. title: '产品名称',
  98. dataIndex: 'productEntity.name',
  99. align: 'center',
  100. width: 200,
  101. customRender: function (text) { return text || '--' },
  102. ellipsis: true
  103. },
  104. {
  105. title: '售价',
  106. dataIndex: 'price',
  107. width: 100,
  108. align: 'center',
  109. customRender: function (text) {
  110. return ((text || text == 0) ? '¥' + text : '--')
  111. }
  112. },
  113. {
  114. title: '退货数量',
  115. dataIndex: 'qty',
  116. width: 100,
  117. align: 'center',
  118. customRender: function (text) {
  119. return text || text == 0 ? text : '--'
  120. }
  121. },
  122. {
  123. title: '坏件数量',
  124. dataIndex: 'badQty',
  125. width: 100,
  126. align: 'center',
  127. customRender: function (text) {
  128. return text || text == 0 ? text : '--'
  129. }
  130. },
  131. {
  132. title: '返库数量',
  133. dataIndex: 'backStockQty',
  134. width: 100,
  135. align: 'center',
  136. customRender: function (text) {
  137. return text || text == 0 ? text : '--'
  138. }
  139. },
  140. {
  141. title: '单位',
  142. dataIndex: 'productEntity.unit',
  143. align: 'center',
  144. width: 100,
  145. customRender: function (text) { return text || '--' }
  146. },
  147. {
  148. title: '退货金额小计',
  149. dataIndex: 'saleReturnSubtotal',
  150. width: 120,
  151. align: 'center',
  152. customRender: function (text) {
  153. return ((text || text == 0) ? '¥' + text : '--')
  154. }
  155. },
  156. {
  157. title: '退货原因',
  158. dataIndex: 'remark',
  159. width: 150,
  160. align: 'center',
  161. customRender: function (text) { return text || '--' },
  162. ellipsis: true
  163. }
  164. ],
  165. // 加载数据方法 必须为 Promise 对象
  166. loadData: parameter => {
  167. this.disabled = true
  168. const params = Object.assign(parameter, { salesReturnBillSn: this.$route.params.sn })
  169. return salesReturnDetailList(params).then(res => {
  170. const data = res.data
  171. const no = (data.pageNo - 1) * data.pageSize
  172. for (var i = 0; i < data.list.length; i++) {
  173. data.list[i].no = no + i + 1
  174. // 折后退货金额小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  175. data.list[i].saleReturnSubtotal = getOperationalPrecision(data.list[i].price, data.list[i].qty)
  176. }
  177. this.disabled = false
  178. return data
  179. })
  180. },
  181. detailData: null // 详情数据
  182. }
  183. },
  184. methods: {
  185. // 返回
  186. handleBack () {
  187. this.$router.push({ name: 'salesReturnList' })
  188. },
  189. // 审核
  190. handleEexamine () {
  191. const _this = this
  192. const row = this.detailData
  193. this.$confirm({
  194. title: '提示',
  195. content: '请点击下方按钮确认操作?',
  196. centered: true,
  197. closable: true,
  198. okText: '审核通过',
  199. cancelText: '审核不通过',
  200. onOk () {
  201. _this.auditOrder(row.salesReturnBillSn, 'WAIT_CHECK')
  202. },
  203. onCancel (e) {
  204. if (!e.triggerCancel) {
  205. _this.auditOrder(row.salesReturnBillSn, 'AUDIT_REJECT')
  206. }
  207. _this.$destroyAll()
  208. }
  209. })
  210. },
  211. auditOrder (salesReturnBillSn, billStatus) {
  212. salesReturnAudit({
  213. salesReturnBillSn,
  214. billStatus
  215. }).then(res => {
  216. if (res.status == 200) {
  217. this.$message.success(res.message)
  218. this.$refs.table.refresh()
  219. }
  220. })
  221. },
  222. // 编辑
  223. handleEdit () {
  224. const row = this.detailData
  225. this.$router.push({ name: row.grabFlag == 1 ? 'salesReturnGrabEdit' : 'salesReturnEdit', params: { sn: row.salesReturnBillSn, buyerSn: row.buyerSn } })
  226. },
  227. // 详情
  228. getDetail () {
  229. salesReturnDetail({ sn: this.$route.params.sn }).then(res => {
  230. if (res.status == 200) {
  231. this.detailData = res.data
  232. } else {
  233. this.detailData = null
  234. }
  235. })
  236. }
  237. },
  238. mounted () {
  239. this.getDetail()
  240. }
  241. }
  242. </script>
  243. <style lang="less">
  244. .salesReturnDetail-wrap {
  245. .salesReturnDetail-cont {
  246. margin-bottom: 10px;
  247. }
  248. .footer-cont{
  249. margin-top: 5px;
  250. text-align: center;
  251. }
  252. }
  253. </style>