detail.vue 8.7 KB

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