detail.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 { urgentDetail, urgentWriteDown } from '@/api/urgent'
  58. import { urgentDetailList } from '@/api/urgentDetail'
  59. export default {
  60. components: { STable, VSelect },
  61. data () {
  62. return {
  63. unColumns: [
  64. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  65. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 200, align: 'center' },
  66. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true },
  67. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 200, align: 'center' },
  68. { title: '库存数量', scopedSlots: { customRender: 'inventoryQuantity' }, width: 100, align: 'center' },
  69. { title: '未冲减数量', dataIndex: 'qty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  70. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
  71. ],
  72. columns: [
  73. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  74. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 200, align: 'center' },
  75. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true },
  76. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  77. { title: '入库时间', dataIndex: 'stockInDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  78. { title: '仓库', dataIndex: 'warehouseName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  79. { title: '仓位', dataIndex: 'warehouseLocationName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  80. { title: '成本价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  81. { title: '已冲减数量', dataIndex: 'qty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  83. { title: '成本小计', dataIndex: 'totalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  84. ],
  85. // 加载数据方法 必须为 Promise 对象
  86. loadData: parameter => {
  87. this.disabled = true
  88. return urgentDetailList(Object.assign(parameter, { urgentBillSn: this.$route.params.sn })).then(res => {
  89. const 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. data.list[i].warehouseName = data.list[i].warehouseEntity && data.list[i].warehouseEntity.name || '--'
  94. data.list[i].warehouseLocationName = data.list[i].warehouseLocationEntity && data.list[i].warehouseLocationEntity.name || '--'
  95. }
  96. this.disabled = false
  97. return data
  98. })
  99. },
  100. detailData: null // 详情数据
  101. }
  102. },
  103. computed: {
  104. isWriteDown () {
  105. return this.detailData && this.detailData.status == 'FINISH'
  106. }
  107. },
  108. methods: {
  109. // 返回
  110. handleBack () {
  111. this.$router.push({ path: '/salesManagement/urgentItemsOffset/list' })
  112. },
  113. // 详情
  114. getDetail () {
  115. urgentDetail({ id: this.$route.params.id }).then(res => {
  116. if (res.status == 200) {
  117. this.detailData = res.data
  118. } else {
  119. this.detailData = null
  120. }
  121. })
  122. },
  123. // 冲减
  124. handleSubmit () {
  125. const _this = this
  126. this.$confirm({
  127. title: '提示',
  128. content: '确定要进行冲减吗?',
  129. centered: true,
  130. onOk () {
  131. urgentWriteDown({ id: _this.$route.params.id }).then(res => {
  132. if (res.status == 200) {
  133. _this.$message.success(res.message)
  134. _this.getDetail()
  135. _this.$refs.table.refresh()
  136. }
  137. })
  138. }
  139. })
  140. },
  141. // 快速打印
  142. handlePrint () {
  143. },
  144. // 打印预览
  145. handlePreview () {
  146. }
  147. },
  148. mounted () {
  149. this.getDetail()
  150. }
  151. }
  152. </script>
  153. <style lang="less">
  154. .urgentItemsOffsetDetail-page-wrapper{
  155. .urgentItemsOffsetDetail-info-wrapper{
  156. margin: 15px 0;
  157. .item-cont {
  158. margin-bottom: 15px;
  159. display: flex;
  160. .item-label {
  161. width: 115px;
  162. font-size: 14px;
  163. color: rgba(0, 0, 0, 0.85);
  164. flex-shrink: 0;
  165. }
  166. .item-main {
  167. flex-grow: 1;
  168. word-break: break-all;
  169. }
  170. }
  171. }
  172. .urgentItemsOffsetDetail-table-wrapper{
  173. .red{
  174. color: #ed1c24;
  175. }
  176. }
  177. }
  178. </style>