detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <div class="allocateBillDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="allocateBillDetail-back" :style="{ padding: pageType=='pages' ? '16px 24px' : '0px 24px' }" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle" v-if="pageType=='pages'">
  7. <a id="allocateBillDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <a-button
  9. v-if="isEdit"
  10. type="primary"
  11. size="small"
  12. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  13. id="allocateBillDetail-edit-btn"
  14. @click.stop="handleEdit">编辑</a-button>
  15. </template>
  16. <!-- 操作区,位于 title 行的行尾 -->
  17. <template slot="extra" v-if="pageType=='pages'">
  18. <print :params="{allocateReturnSn: $route.params.sn || outBizSn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
  19. </template>
  20. </a-page-header>
  21. <a-card size="small" :bordered="false" class="allocateBillDetail-cont">
  22. <a-collapse :activeKey="['1']">
  23. <a-collapse-panel key="1" header="基础信息">
  24. <a-descriptions :column="3">
  25. <a-descriptions-item label="调拨退货单号">{{ (basicInfoData&&basicInfoData.allocateReturnNo) || '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.targetTypeDictValue) || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="调拨退货类型">{{ (basicInfoData&&basicInfoData.allocateReturnTypeName) || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="是否抓单">{{ basicInfoData&&basicInfoData.grabFlagDictValue || '--' }}</a-descriptions-item>
  30. <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
  31. <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
  32. </a-descriptions>
  33. </a-collapse-panel>
  34. </a-collapse>
  35. </a-card>
  36. <a-card size="small" :bordered="false" class="allocateBillDetail-cont">
  37. <!-- 总计 -->
  38. <a-alert type="info" style="margin-bottom:10px">
  39. <div slot="message">
  40. 退货总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0)) ? basicInfoData.totalQty : '--' }}</strong> ,
  41. 坏件总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalBadQty || basicInfoData.totalBadQty==0)) ? basicInfoData.totalBadQty : '--' }}</strong> ,
  42. 返库总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalBackStockQty || basicInfoData.totalBackStockQty==0)) ? basicInfoData.totalBackStockQty : '--' }}</strong> ,
  43. <span>退货总金额(¥):<strong>{{ (basicInfoData&&(basicInfoData.totalPrice || basicInfoData.totalPrice==0)) ? basicInfoData.totalPrice : '--' }}</strong></span>;
  44. </div>
  45. </a-alert>
  46. <!-- 列表 -->
  47. <s-table
  48. class="sTable"
  49. ref="table"
  50. size="small"
  51. :rowKey="(record) => record.id"
  52. :columns="columns"
  53. :data="loadData"
  54. :defaultLoadData="false"
  55. bordered>
  56. </s-table>
  57. </a-card>
  58. </a-spin>
  59. </div>
  60. </template>
  61. <script>
  62. import { commonMixin } from '@/utils/mixin'
  63. import { STable, VSelect } from '@/components'
  64. import print from './print.vue'
  65. import { allocReturnDetailQueryPage, allocateReturnQueryBySn } from '@/api/allocateReturn'
  66. export default {
  67. name: 'TransferReturnDetail',
  68. mixins: [commonMixin],
  69. components: { STable, VSelect, print },
  70. props: {
  71. outBizSn: { // 有值则为弹框,无值则为页面
  72. type: [Number, String],
  73. default: ''
  74. },
  75. pageType: {
  76. type: String,
  77. default: 'pages'
  78. }
  79. },
  80. data () {
  81. return {
  82. spinning: false,
  83. // 加载数据方法 必须为 Promise 对象
  84. loadData: parameter => {
  85. this.spinning = true
  86. return allocReturnDetailQueryPage(Object.assign(parameter, { allocateReturnSn: this.outBizSn || this.$route.params.sn })).then(res => {
  87. let data
  88. if (res.status == 200) {
  89. data = res.data
  90. const no = (data.pageNo - 1) * data.pageSize
  91. for (var i = 0; i < data.list.length; i++) {
  92. data.list[i].no = no + i + 1
  93. }
  94. this.localDataSource = data.list
  95. }
  96. this.spinning = false
  97. return data
  98. })
  99. },
  100. basicInfoData: null, // 基本信息
  101. localDataSource: [],
  102. openModal: false,
  103. nowType: null
  104. }
  105. },
  106. computed: {
  107. isEdit () {
  108. return this.basicInfoData && ((this.basicInfoData.state == 'WAIT_SUBMIT') || (this.basicInfoData.state == 'FINANCIAL_REJECT') || (this.basicInfoData.state == 'AUDIT_REJECT')) && this.$hasPermissions('B_transferReturnEdit')
  109. },
  110. columns () {
  111. const arr = [
  112. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  113. { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  114. { title: '产品名称', dataIndex: 'product.name', width: '27%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  115. { title: '单位', dataIndex: 'product.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  116. { title: '退货单价(¥)', dataIndex: 'price', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  117. { title: '退货数量', dataIndex: 'returnQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  118. { title: '坏件数量', dataIndex: 'badQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  119. { title: '返库数量', dataIndex: 'backStockQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  120. { title: '退货金额(¥)', dataIndex: 'totalReturnPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  121. ]
  122. if (this.basicInfoData && this.basicInfoData.grabFlag == '1') {
  123. arr.splice(1, 0, { title: '调拨单号', dataIndex: 'allocateNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } })
  124. }
  125. return arr
  126. }
  127. },
  128. methods: {
  129. // 返回列表
  130. handleBack () {
  131. this.$router.push({ name: 'transferReturnList', query: { closeLastOldTab: true } })
  132. },
  133. // 基本信息
  134. getDetail () {
  135. allocateReturnQueryBySn({ allocateReturnSn: this.outBizSn || this.$route.params.sn }).then(res => {
  136. if (res.status == 200) {
  137. this.basicInfoData = res.data
  138. } else {
  139. this.basicInfoData = null
  140. }
  141. })
  142. },
  143. // 编辑
  144. handleEdit () {
  145. const row = this.basicInfoData
  146. this.$router.push({ name: row.grabFlag == 1 ? 'transferReturnGrpEdit' : 'transferReturnEdit', params: { sn: row.allocateReturnSn, targetType: row.targetType, dealerLevel: row.dealerLevel } })
  147. },
  148. pageInit () {
  149. if (this.outBizSn || this.$route.params.sn) {
  150. this.$refs.table.refresh(true)
  151. this.getDetail()
  152. }
  153. }
  154. },
  155. mounted () {
  156. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新 或 为弹框时调用
  157. this.pageInit()
  158. }
  159. },
  160. activated () {
  161. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  162. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  163. this.pageInit()
  164. }
  165. },
  166. watch: {
  167. outBizSn (newValue, oldValue) {
  168. if (newValue) {
  169. this.pageInit()
  170. }
  171. }
  172. },
  173. beforeRouteEnter (to, from, next) {
  174. next(vm => {})
  175. }
  176. }
  177. </script>
  178. <style lang="less">
  179. .allocateBillDetail-wrap{
  180. .allocateBillDetail-back{
  181. margin-bottom: 10px;
  182. }
  183. .allocateBillDetail-cont{
  184. margin-bottom: 10px;
  185. }
  186. }
  187. </style>