detail.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="urgentItemsOffsetDetail-page-wrapper">
  3. <!-- 操作 -->
  4. <a-page-header :ghost="false" :backIcon="false" class="urgentItemsOffsetDetail-operation-wrapper" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="urgentItemsOffsetDetail-btn-back" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. </template>
  9. <!-- 操作区,位于 title 行的行尾 -->
  10. <template slot="extra">
  11. <a-button key="3" type="danger" v-if="!isWriteDown" @click="handleSubmit" id="urgentItemsOffsetDetail-btn-submit">冲减</a-button>
  12. <a-button key="2" @click="handlePreview" id="urgentItemsOffsetDetail-btn-preview">打印预览</a-button>
  13. <a-button key="1" type="primary" @click="handlePrint" id="urgentItemsOffsetDetail-btn-print">快速打印</a-button>
  14. </template>
  15. </a-page-header>
  16. <!-- 急件单信息 -->
  17. <a-card size="small" :bordered="false" class="urgentItemsOffsetDetail-info-wrapper">
  18. <a-collapse :activeKey="['1']">
  19. <a-collapse-panel key="1" header="基础信息">
  20. <a-descriptions :column="3" v-if="detailData">
  21. <a-descriptions-item label="客户名称">{{ detailData.buyerName || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="客户地址">{{ detailData.shippingAddressProvinceName || '--' }}{{ detailData.shippingAddressCityName || '--' }}{{ detailData.shippingAddressCountyName || '--' }}{{ detailData.shippingAddress || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="支付方式">{{ detailData.buyerName || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="联系电话">{{ detailData.consigneeTel || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="收款方式">{{ detailData.buyerName || '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="急件单号">{{ detailData.urgentBillNo || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="状态">{{ detailData.statusDictValue || '--' }}</a-descriptions-item>
  28. </a-descriptions>
  29. </a-collapse-panel>
  30. </a-collapse>
  31. </a-card>
  32. <!-- 表格 -->
  33. <a-card size="small" :bordered="false" class="urgentItemsOffsetDetail-table-wrapper">
  34. <!-- 合计 -->
  35. <a-alert type="info" showIcon style="margin-bottom:15px" v-if="detailData">
  36. <div class="ftext" slot="message">总款数:<strong>{{ detailData.totalCategory || 0 }}</strong>;总数量:<strong>{{ detailData.totalQty || 0 }}</strong>。</div>
  37. </a-alert>
  38. <s-table
  39. class="sTable"
  40. ref="table"
  41. size="default"
  42. :rowKey="(record) => record.id"
  43. :columns="isWriteDown ? columns : unColumns"
  44. :data="loadData"
  45. :scroll="{ x: isWriteDown ? 1570 : '100%' }"
  46. bordered>
  47. <!-- 库存数量 -->
  48. <template slot="inventoryQuantity" slot-scope="text, record">
  49. <span :class="[record.stockEntity.currentStockQty < record.qty ? 'red' : '']" :style="{fontWeight: record.stockEntity.currentStockQty < record.qty?'bold':''}">{{ record.stockEntity.currentStockQty }}</span>
  50. </template>
  51. </s-table>
  52. </a-card>
  53. </div>
  54. </template>
  55. <script>
  56. import { STable, VSelect } from '@/components'
  57. import { urgentWriteDown, urgentDetailSn, urgentDetailList } from '@/api/urgent'
  58. export default {
  59. components: { STable, VSelect },
  60. data () {
  61. return {
  62. unColumns: [
  63. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  64. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 200, align: 'center' },
  65. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true },
  66. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 200, align: 'center' },
  67. { title: '库存数量', scopedSlots: { customRender: 'inventoryQuantity' }, width: 100, align: 'center' },
  68. { title: '未冲减数量', dataIndex: 'qty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  69. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
  70. ],
  71. columns: [
  72. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  73. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 200, align: 'center' },
  74. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true },
  75. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  76. { title: '入库时间', dataIndex: 'stockInDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  77. { title: '仓库', dataIndex: 'warehouseName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  78. { title: '仓位', dataIndex: 'warehouseLocationName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  79. { title: '成本价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  80. { title: '已冲减数量', dataIndex: 'qty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  81. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  82. { title: '成本小计', dataIndex: 'totalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  83. ],
  84. // 加载数据方法 必须为 Promise 对象
  85. loadData: parameter => {
  86. this.disabled = true
  87. return urgentDetailList(Object.assign(parameter, { urgentBillSn: this.$route.params.sn })).then(res => {
  88. const data = res.data
  89. const no = (data.pageNo - 1) * data.pageSize
  90. for (var i = 0; i < data.list.length; i++) {
  91. data.list[i].no = no + i + 1
  92. data.list[i].warehouseName = data.list[i].warehouseEntity && data.list[i].warehouseEntity.name || '--'
  93. data.list[i].warehouseLocationName = data.list[i].warehouseLocationEntity && data.list[i].warehouseLocationEntity.name || '--'
  94. }
  95. this.disabled = false
  96. return data
  97. })
  98. },
  99. detailData: null // 详情数据
  100. }
  101. },
  102. computed: {
  103. isWriteDown () {
  104. return this.detailData && this.detailData.status == 'FINISH'
  105. }
  106. },
  107. methods: {
  108. // 返回
  109. handleBack () {
  110. this.$router.push({ path: '/salesManagement/urgentItemsOffset/list' })
  111. },
  112. // 详情
  113. getDetail () {
  114. urgentDetailSn({ sn: this.$route.params.sn }).then(res => {
  115. if (res.status == 200) {
  116. this.detailData = res.data
  117. } else {
  118. this.detailData = null
  119. }
  120. })
  121. },
  122. // 冲减
  123. handleSubmit () {
  124. const _this = this
  125. this.$confirm({
  126. title: '提示',
  127. content: '确定要进行冲减吗?',
  128. centered: true,
  129. onOk () {
  130. urgentWriteDown({ urgentBillSn: _this.$route.params.sn }).then(res => {
  131. if (res.status == 200) {
  132. _this.$message.success(res.message)
  133. _this.getDetail()
  134. _this.$refs.table.refresh()
  135. }
  136. })
  137. }
  138. })
  139. },
  140. // 快速打印
  141. handlePrint () {
  142. },
  143. // 打印预览
  144. handlePreview () {
  145. }
  146. },
  147. mounted () {
  148. this.getDetail()
  149. }
  150. }
  151. </script>
  152. <style lang="less">
  153. .urgentItemsOffsetDetail-page-wrapper{
  154. .urgentItemsOffsetDetail-info-wrapper{
  155. margin: 15px 0;
  156. .item-cont {
  157. margin-bottom: 15px;
  158. display: flex;
  159. .item-label {
  160. width: 115px;
  161. font-size: 14px;
  162. color: rgba(0, 0, 0, 0.85);
  163. flex-shrink: 0;
  164. }
  165. .item-main {
  166. flex-grow: 1;
  167. word-break: break-all;
  168. }
  169. }
  170. }
  171. .urgentItemsOffsetDetail-table-wrapper{
  172. .red{
  173. color: #ed1c24;
  174. }
  175. }
  176. }
  177. </style>