detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <div class="salesReturnDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="salesReturnDetail-cont">
  5. <template slot="subTitle">
  6. <a href="javascript:;" @click="handleBack">
  7. <a-icon type="left"></a-icon>
  8. 返回列表
  9. </a>
  10. </template>
  11. <!-- 操作区,位于 title 行的行尾 -->
  12. <template slot="extra">
  13. <a-button
  14. key="3"
  15. type="default"
  16. class="button-info"
  17. id="salesReturnEdit-preview-btn"
  18. v-if="$hasPermissions('B_salesReturnPrint')"
  19. :disabled="chooseLoadData.length==0"
  20. @click="handlePrint('preview')">打印预览</a-button>
  21. <a-button
  22. key="2"
  23. type="primary"
  24. class="button-info"
  25. id="salesReturnEdit-print-btn"
  26. v-if="$hasPermissions('B_salesReturnPrint')"
  27. :disabled="chooseLoadData.length==0"
  28. @click="handlePrint('print')">快捷打印</a-button>
  29. <a-divider type="vertical" />
  30. <a-button
  31. key="1"
  32. type="primary"
  33. class="button-warning"
  34. id="salesReturnEdit-export-btn"
  35. v-if="$hasPermissions('B_salesReturnExport')"
  36. :disabled="chooseLoadData.length==0"
  37. @click="handlePrint('export')">导出Excel</a-button>
  38. </template>
  39. </a-page-header>
  40. <!-- 基础信息 -->
  41. <a-card size="small" :bordered="false" class="salesReturnDetail-cont">
  42. <a-collapse :activeKey="['1']">
  43. <a-collapse-panel key="1" header="基础信息">
  44. <a-descriptions size="small" :column="3">
  45. <a-descriptions-item label="单据来源">{{ detailData&&detailData.salesReturnBillSourceDictValue || '--' }}</a-descriptions-item>
  46. <a-descriptions-item label="销售退货单号">{{ detailData&&detailData.salesReturnBillNo || '--' }}</a-descriptions-item>
  47. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  48. <a-descriptions-item label="客户采退申请单号">{{ detailData&&detailData.purchaseReturnApplyNo || '--' }}</a-descriptions-item>
  49. <a-descriptions-item label="是否同步给客户">{{ detailData&&detailData.syncFlag ? ['否', '是'][detailData.syncFlag] : '--' }}</a-descriptions-item>
  50. <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
  51. <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
  52. <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditTime || '--' }}</a-descriptions-item>
  53. </a-descriptions>
  54. </a-collapse-panel>
  55. </a-collapse>
  56. </a-card>
  57. <a-card size="small" :bordered="false" class="pages-wrap">
  58. <a-tabs>
  59. <a-tab-pane key="1" tab="产品明细" force-render>
  60. <a-alert style="margin-bottom: 10px;" type="info">
  61. <div slot="message" class="total-bar">
  62. <div>
  63. <span>申请退货数量:{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }};</span>
  64. <span>仓库实收数量:{{ detailData&&(detailData.totalReceiveQty || detailData.totalReceiveQty==0) ? detailData.totalReceiveQty : '--' }};</span>
  65. <span>坏件数量:{{ detailData&&(detailData.totalBadQty || detailData.totalBadQty==0) ? detailData.totalBadQty : '--' }};</span>
  66. <span>良品数量:{{ detailData&&(detailData.totalGoodQty || detailData.totalGoodQty==0) ? detailData.totalGoodQty : '--' }};</span>
  67. <span>返库数量:{{ detailData&&(detailData.totalBackStockQty || detailData.totalBackStockQty==0) ? detailData.totalBackStockQty : '--' }};</span>
  68. <span v-if="$hasPermissions('B_isShowPrice')">
  69. 参考退货金额:{{ detailData&&(detailData.initialAmount || detailData.initialAmount==0) ? detailData.initialAmount : '--' }}元;
  70. 实际退货金额:{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? detailData.totalAmount : '--' }}元;
  71. </span>
  72. </div>
  73. </div>
  74. </a-alert>
  75. <div style="display:flex;align-items:center;justify-content: space-between;margin-bottom: 10px;">
  76. <div>说明:红色行表示收货时新增的产品;黄色表示客服确认时新增的产品</div>
  77. </div>
  78. <!-- 列表 -->
  79. <s-table
  80. class="sTable"
  81. :rowClassName="(record, index) => record.addFlag == '1' ? (record.addType == 'WAREHOUSE_RECEIVE'?'redBg-row':'orgBg-row'):''"
  82. ref="table"
  83. size="small"
  84. :pageSize="10"
  85. :rowKey="record => record.id"
  86. :columns="columns"
  87. :data="loadData"
  88. :defaultLoadData="false"
  89. bordered></s-table>
  90. </a-tab-pane>
  91. <a-tab-pane key="2" tab="审核进度" >
  92. <auditDetail v-if="$hasPermissions('B_salesReturnAudit')" ref="auditDetail" businessType="SALES_RETURN" :itemSn="$route.params.sn"></auditDetail>
  93. <span v-else>您没有权限查看审核进度</span>
  94. </a-tab-pane>
  95. <a-tab-pane key="3" tab="操作记录">
  96. <s-table
  97. class="sTable"
  98. ref="operateTable"
  99. size="small"
  100. :rowKey="record => record.id"
  101. :columns="operateColumns"
  102. :data="operateLoadData"
  103. bordered></s-table>
  104. </a-tab-pane>
  105. </a-tabs>
  106. </a-card>
  107. </a-spin>
  108. <!-- 打印 -->
  109. <div id="print"></div>
  110. </div>
  111. </template>
  112. <script>
  113. import { commonMixin } from '@/utils/mixin'
  114. import { STable, VSelect } from '@/components'
  115. import { printFun, exportExcel } from '@/libs/JGPrint.js'
  116. import auditDetail from '@/views/common/auditDetail.vue'
  117. import { salesReturnDetail, salesReturnChangeLogList, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
  118. import { salesReturnDetailList } from '@/api/salesReturnDetail'
  119. export default {
  120. name: 'SalesReturnDetail',
  121. mixins: [commonMixin],
  122. components: { STable, VSelect, auditDetail },
  123. data () {
  124. return {
  125. spinning: false,
  126. disabled: false,
  127. // 加载数据方法 必须为 Promise 对象
  128. loadData: parameter => {
  129. this.disabled = true
  130. const params = Object.assign(parameter, { salesReturnBillSn: this.$route.params.sn })
  131. return salesReturnDetailList(params).then(res => {
  132. let data
  133. if (res.status == 200) {
  134. data = res.data
  135. const no = (data.pageNo - 1) * data.pageSize
  136. for (var i = 0; i < data.list.length; i++) {
  137. data.list[i].no = no + i + 1
  138. }
  139. this.chooseLoadData = data.list
  140. this.disabled = false
  141. }
  142. return data
  143. })
  144. },
  145. chooseLoadData: [],
  146. detailData: null, // 详情数据
  147. visibleAudit: false,
  148. spinningAudit: false,
  149. queryStrList: [
  150. { code: 0, text: '不显示退货单价/金额' },
  151. { code: 1, text: '显示——按照申请退货数量计算' },
  152. { code: 2, text: '显示——按照仓库实收数量计算' }
  153. ],
  154. showFlag: undefined,
  155. // 操作记录
  156. operateColumns: [
  157. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  158. { title: '操作时间', dataIndex: 'createDate', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
  159. { title: '操作人员', dataIndex: 'changeUserName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  160. { title: '操作类型', dataIndex: 'logTypeName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  161. { title: '操作内容', dataIndex: 'logContent', width: '70%', align: 'center', customRender: function (text) { return text || '--' } }
  162. ],
  163. // 加载数据方法 必须为 Promise 对象
  164. operateLoadData: parameter => {
  165. this.disabled = true
  166. const params = Object.assign(parameter, { salesReturnBillSn: this.$route.params.sn })
  167. return salesReturnChangeLogList(params).then(res => {
  168. let data
  169. if (res.status == 200) {
  170. 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. }
  175. this.disabled = false
  176. }
  177. return data
  178. })
  179. }
  180. }
  181. },
  182. computed: {
  183. columns () {
  184. const arr = [
  185. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  186. { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
  187. { title: '产品名称', dataIndex: 'productEntity.name', width: '19%', align: 'left', customRender: function (text) { return text || '--' } },
  188. { title: '单位', dataIndex: 'productEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  189. { title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  190. { title: '仓库实收数量', dataIndex: 'receiveQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  191. { title: '坏件数量', dataIndex: 'badQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  192. { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  193. { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  194. { title: '退货原因', dataIndex: 'returnReasonDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  195. // { title: '参考退货单价', dataIndex: 'initialPrice', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  196. // { title: '参考退货金额', dataIndex: 'initialAmount', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  197. // { title: '实际退货单价', dataIndex: 'price', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  198. // { title: '实际退货金额', dataIndex: 'totalAmount', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  199. { title: '实际退货单价说明', dataIndex: 'priceRemark', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
  200. ]
  201. if (this.$hasPermissions('B_isShowPrice') && this.showFlag != 0) { // 售价权限
  202. arr.splice(10, 0, { title: '参考退货单价', dataIndex: 'initialPrice', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  203. arr.splice(11, 0, { title: '参考退货金额', dataIndex: 'initialAmount', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  204. arr.splice(12, 0, { title: '实际退货单价', dataIndex: 'price', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  205. arr.splice(13, 0, { title: '实际退货金额', dataIndex: 'totalAmount', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  206. }
  207. return arr
  208. }
  209. },
  210. methods: {
  211. // 返回
  212. handleBack () {
  213. this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
  214. },
  215. // 明细筛选
  216. changeQueryStr (v) {
  217. },
  218. // 详情
  219. getDetail () {
  220. salesReturnDetail({ sn: this.$route.params.sn }).then(res => {
  221. if (res.status == 200) {
  222. this.detailData = res.data
  223. } else {
  224. this.detailData = null
  225. }
  226. })
  227. },
  228. // 打印预览/快捷打印
  229. handlePrint (type) {
  230. const _this = this
  231. const a = ['WAIT_CUSTOMER_SERVICE_CONFIRM', 'WAIT_FINANCIAL_AUDIT', 'FINANCIAL_REJECT', 'FINISH'].find(item => item == this.detailData.billStatus)
  232. const status = a ? 'SALES_RETURN_AMOUNT' : 'SALES_RETURN_REASON'
  233. const params = { sn: this.$route.params.sn, status: status }
  234. _this.spinning = true
  235. // 导出
  236. if (type == 'export') {
  237. exportExcel(salesReturnExport, params, '销售退货', function () {
  238. _this.spinning = false
  239. })
  240. } else {
  241. // 打印或预览
  242. printFun(salesReturnPrint, params, type, '销售退货', () => {
  243. _this.spinning = false
  244. })
  245. }
  246. }
  247. },
  248. mounted () {
  249. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  250. this.$refs.table.refresh(true)
  251. this.getDetail()
  252. }
  253. },
  254. activated () {
  255. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  256. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  257. this.$refs.table.refresh(true)
  258. this.getDetail()
  259. }
  260. },
  261. beforeRouteEnter (to, from, next) {
  262. next(vm => {})
  263. }
  264. }
  265. </script>
  266. <style lang="less">
  267. .salesReturnDetail-wrap {
  268. .salesReturnDetail-cont {
  269. margin-bottom: 10px;
  270. }
  271. .footer-cont{
  272. margin-top: 5px;
  273. text-align: center;
  274. }
  275. .redBg-row{
  276. background-color: #f5beb4;
  277. }
  278. .orgBg-row{
  279. background-color: #fffca2;
  280. }
  281. }
  282. </style>