detail.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div class="urgentItemsOffsetDetail-page-wrapper">
  3. <!-- 操作 -->
  4. <a-page-header :ghost="false" @back="handleBack" class="urgentItemsOffsetDetail-operation-wrapper">
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="urgentItemsOffsetDetail-btn-back" href="javascript:;" @click="handleBack">返回列表</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 ? 1330 : '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 { getOperationalPrecision } from '@/libs/tools.js'
  57. import { urgentDetail } from '@/api/urgent'
  58. import { urgentDetailList } from '@/api/urgentDetail'
  59. import { STable, VSelect } from '@/components'
  60. export default {
  61. components: { STable, VSelect },
  62. data () {
  63. return {
  64. unColumns: [
  65. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  66. { title: '产品编码', dataIndex: 'productCode', width: 160, align: 'center' },
  67. { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
  68. { title: '原厂编码', dataIndex: 'productOrigCode', width: 200, align: 'center' },
  69. { title: '库存数量', scopedSlots: { customRender: 'inventoryQuantity' }, width: 100, align: 'center' },
  70. { title: '未冲减数量', dataIndex: 'qty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  71. { title: '单位', dataIndex: 'productOrigUnit', width: 100, align: 'center' }
  72. ],
  73. columns: [
  74. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  75. { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center' },
  76. { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
  77. { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center' },
  78. { title: '入库时间', dataIndex: 'stockInDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  79. { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  80. { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  81. { title: '成本价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '已冲减数量', dataIndex: 'qty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  83. { title: '单位', dataIndex: 'productOrigUnit', width: 100, align: 'center' },
  84. { title: '成本小计', dataIndex: 'costSubtotal', width: 100, align: 'center' }
  85. ],
  86. // 加载数据方法 必须为 Promise 对象
  87. loadData: parameter => {
  88. this.disabled = true
  89. return urgentDetailList(Object.assign(parameter, { urgentBillSn: this.$route.params.sn })).then(res => {
  90. const data = res.data
  91. const no = (data.pageNo - 1) * data.pageSize
  92. for (var i = 0; i < data.list.length; i++) {
  93. data.list[i].no = no + i + 1
  94. const productCode = (data.list[i].productEntity && data.list[i].productEntity.code) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.code)
  95. const productName = (data.list[i].productEntity && data.list[i].productEntity.name) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.name)
  96. const productOrigCode = (data.list[i].productEntity && data.list[i].productEntity.origCode) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.origCode)
  97. const productOrigUnit = (data.list[i].productEntity && data.list[i].productEntity.unit) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.unit)
  98. data.list[i].productCode = productCode || '--'
  99. data.list[i].productName = productName || '--'
  100. data.list[i].productOrigCode = productOrigCode || '--'
  101. data.list[i].productOrigUnit = productOrigUnit || '--'
  102. data.list[i].warehouseName = data.list[i].warehouseEntity && data.list[i].warehouseEntity.name || '--'
  103. data.list[i].warehouseLocationName = data.list[i].warehouseLocationEntity && data.list[i].warehouseLocationEntity.name || '--'
  104. // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  105. data.list[i].costSubtotal = getOperationalPrecision(data.list[i].price, data.list[i].qty)
  106. }
  107. this.disabled = false
  108. return data
  109. })
  110. },
  111. detailData: null // 详情数据
  112. }
  113. },
  114. computed: {
  115. isWriteDown () {
  116. return this.detailData && this.detailData.status == 'FINISH'
  117. }
  118. },
  119. methods: {
  120. // 返回
  121. handleBack () {
  122. this.$router.push({ path: '/salesManagement/urgentItemsOffset/list' })
  123. },
  124. // 详情
  125. getDetail () {
  126. urgentDetail({ id: this.$route.params.id }).then(res => {
  127. if (res.status == 200) {
  128. this.detailData = res.data
  129. } else {
  130. this.detailData = null
  131. }
  132. })
  133. },
  134. // 冲减
  135. handleSubmit () {
  136. const _this = this
  137. this.$confirm({
  138. title: '提示',
  139. content: '确定要进行冲减吗?',
  140. okText: '确定',
  141. cancelText: '取消',
  142. centered: true,
  143. onOk () {
  144. // delectRolePower({
  145. // id: row.id
  146. // }).then(res => {
  147. // console.log(res, 'res1111')
  148. // if (res.status == 200) {
  149. // _this.$message.success(res.message)
  150. // _this.$refs.table.refresh()
  151. // }
  152. // })
  153. }
  154. })
  155. },
  156. // 快速打印
  157. handlePrint () {
  158. },
  159. // 打印预览
  160. handlePreview () {
  161. }
  162. },
  163. mounted () {
  164. this.getDetail()
  165. }
  166. }
  167. </script>
  168. <style lang="less">
  169. .urgentItemsOffsetDetail-page-wrapper{
  170. .urgentItemsOffsetDetail-info-wrapper{
  171. margin: 15px 0;
  172. .item-cont {
  173. margin-bottom: 15px;
  174. display: flex;
  175. .item-label {
  176. width: 115px;
  177. font-size: 14px;
  178. color: rgba(0, 0, 0, 0.85);
  179. flex-shrink: 0;
  180. }
  181. .item-main {
  182. flex-grow: 1;
  183. word-break: break-all;
  184. }
  185. }
  186. }
  187. .urgentItemsOffsetDetail-table-wrapper{
  188. .red{
  189. color: #ed1c24;
  190. }
  191. }
  192. }
  193. </style>