detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div class="urgentItemsOffsetDetail-page-wrapper" :style="{'paddingBottom': (!isWriteDown&&$hasPermissions('B_urgentWriteDown')) ? '64px' : '0px'}">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 操作 -->
  5. <a-page-header :ghost="false" :backIcon="false" class="urgentItemsOffsetDetail-operation-wrapper" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }" >
  6. <!-- 自定义的二级文字标题 -->
  7. <template slot="subTitle" v-if="!outBizSn">
  8. <a id="urgentItemsOffsetDetail-btn-back" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  9. </template>
  10. </a-page-header>
  11. <!-- 急件单信息 -->
  12. <a-card size="small" :bordered="false" class="urgentItemsOffsetDetail-info-wrapper">
  13. <a-collapse :activeKey="['1']" v-if="detailData&&detailData.bizType!='REPLENISH'">
  14. <a-collapse-panel key="1" header="基础信息">
  15. <a-descriptions :column="3">
  16. <a-descriptions-item label="客户名称">{{ (detailData&&detailData.buyerNameCurrent) || '--' }}{{ detailData&&detailData.buyerName?detailData.buyerName==detailData.buyerNameCurrent?'':'('+detailData.buyerName+')':'' }}</a-descriptions-item>
  17. <a-descriptions-item label="单位地址">
  18. <div v-if="detailData&&(detailData.shippingAddressProvinceName || detailData.shippingAddressCityName || detailData.shippingAddressCountyName || detailData.shippingAddress)">
  19. {{ (detailData&&detailData.shippingAddressProvinceName) || '' }}
  20. {{ (detailData&&detailData.shippingAddressCityName) || '' }}
  21. {{ (detailData&&detailData.shippingAddressCountyName) || '' }}
  22. {{ (detailData&&detailData.shippingAddress) || '' }}
  23. </div>
  24. <span v-else>--</span>
  25. </a-descriptions-item>
  26. <a-descriptions-item label="联系电话">{{ detailData&&detailData.consigneeTel || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleDictValue || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="急件单号">{{ (detailData&&detailData.urgentBillNo) || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="状态">{{ (detailData&&detailData.statusDictValue) || '--' }}</a-descriptions-item>
  30. </a-descriptions>
  31. </a-collapse-panel>
  32. </a-collapse>
  33. <a-collapse :activeKey="['1']" v-else>
  34. <a-collapse-panel key="1" header="基础信息">
  35. <a-descriptions :column="3">
  36. <a-descriptions-item label="关联客户">{{ (detailData&&detailData.customerName) || '--' }}</a-descriptions-item>
  37. <a-descriptions-item label="货架名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  38. <a-descriptions-item label="急件单号">{{ (detailData&&detailData.urgentBillNo) || '--' }}</a-descriptions-item>
  39. <a-descriptions-item label="状态">{{ (detailData&&detailData.statusDictValue) || '--' }}</a-descriptions-item>
  40. </a-descriptions>
  41. </a-collapse-panel>
  42. </a-collapse>
  43. </a-card>
  44. <!-- 表格 -->
  45. <a-card size="small" :bordered="false" class="urgentItemsOffsetDetail-table-wrapper">
  46. <!-- 合计 -->
  47. <a-alert type="info" style="margin-bottom:15px" v-if="detailData">
  48. <div class="ftext" slot="message">
  49. 总款数:<strong>{{ (detailData&&(detailData.totalCategory || detailData.totalCategory == 0)) ? detailData.totalCategory : '--' }}</strong>;
  50. 总数量:<strong>{{ (detailData&&(detailData.totalQty || detailData.totalQty == 0)) ? detailData.totalQty : '--' }}</strong>。
  51. </div>
  52. </a-alert>
  53. <s-table
  54. class="sTable"
  55. ref="table"
  56. size="small"
  57. :rowKey="(record) => record.id"
  58. :columns="isWriteDown ? columns : unColumns"
  59. :data="loadData"
  60. :defaultLoadData="false"
  61. bordered>
  62. <!-- 库存数量 -->
  63. <template slot="inventoryQuantity" slot-scope="text, record">
  64. <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>
  65. <span v-else>--</span>
  66. </template>
  67. </s-table>
  68. </a-card>
  69. </a-spin>
  70. <div class="affix-cont" v-if="!isWriteDown&&$hasPermissions('B_urgentWriteDown')&&!spinning">
  71. <a-button
  72. size="large"
  73. style="padding: 0 60px;"
  74. type="primary"
  75. :disabled="spinning"
  76. class="button-primary"
  77. @click="handleSubmit"
  78. id="urgentItemsOffsetDetail-btn-submit">冲减</a-button>
  79. </div>
  80. </div>
  81. </template>
  82. <script>
  83. import { commonMixin } from '@/utils/mixin'
  84. import { STable, VSelect } from '@/components'
  85. import { urgentWriteDown, urgentDetailSn, urgentDetailList } from '@/api/urgent'
  86. export default {
  87. name: 'UrgentOffsetDetail',
  88. components: { STable, VSelect },
  89. mixins: [commonMixin],
  90. props: {
  91. outBizSn: { // 有值则为弹框,无值则为页面
  92. type: [Number, String],
  93. default: ''
  94. }
  95. },
  96. data () {
  97. const _this = this
  98. return {
  99. spinning: false,
  100. unColumns: [
  101. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  102. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  103. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  104. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '20%', customRender: function (text) { return text || '--' }, align: 'center' },
  105. { title: '库存数量', scopedSlots: { customRender: 'inventoryQuantity' }, width: '12%', align: 'center' },
  106. { title: '未冲减数量', dataIndex: 'qty', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  107. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '11%', align: 'center', customRender: function (text) { return text || '--' } }
  108. ],
  109. // 加载数据方法 必须为 Promise 对象
  110. loadData: parameter => {
  111. this.disabled = true
  112. return urgentDetailList(Object.assign(parameter, { urgentBillSn: this.outBizSn || this.$route.params.sn })).then(res => {
  113. let data
  114. if (res.status == 200) {
  115. data = res.data
  116. const no = (data.pageNo - 1) * data.pageSize
  117. for (var i = 0; i < data.list.length; i++) {
  118. data.list[i].no = no + i + 1
  119. data.list[i].warehouseName = data.list[i].warehouseEntity && data.list[i].warehouseEntity.name || '--'
  120. data.list[i].warehouseLocationName = data.list[i].warehouseLocationEntity && data.list[i].warehouseLocationEntity.name || '--'
  121. }
  122. this.disabled = false
  123. }
  124. return data
  125. })
  126. },
  127. detailData: null // 详情数据
  128. }
  129. },
  130. computed: {
  131. isWriteDown () {
  132. return this.detailData && this.detailData.status == 'FINISH'
  133. },
  134. columns () {
  135. const _this = this
  136. const arr = [
  137. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  138. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  139. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '17%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  140. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
  141. { title: '入库时间', dataIndex: 'stockInDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  142. { title: '仓库', dataIndex: 'warehouseName', width: '7%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  143. { title: '仓位', dataIndex: 'warehouseLocationName', width: '7%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  144. // { title: '成本价', dataIndex: 'cost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  145. { title: '已冲减数量', dataIndex: 'qty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  146. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } }
  147. // { title: '成本小计', dataIndex: 'totalCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  148. ]
  149. if (this.$hasPermissions('M_ShowAllCost')) {
  150. arr.splice(7, 0, { title: '成本价', dataIndex: 'cost', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  151. arr.splice(10, 0, { title: '成本小计', dataIndex: 'totalCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  152. }
  153. return arr
  154. }
  155. },
  156. methods: {
  157. // 返回
  158. handleBack () {
  159. this.$router.push({ path: '/salesManagement/urgentItemsOffset/list' })
  160. },
  161. // 详情
  162. getDetail () {
  163. urgentDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
  164. if (res.status == 200) {
  165. this.detailData = res.data
  166. } else {
  167. this.detailData = null
  168. }
  169. })
  170. },
  171. // 冲减
  172. handleSubmit () {
  173. const _this = this
  174. this.$confirm({
  175. title: '提示',
  176. content: '确定要进行冲减吗?',
  177. centered: true,
  178. onOk () {
  179. _this.spinning = true
  180. urgentWriteDown({ urgentBillSn: _this.outBizSn || _this.$route.params.sn }).then(res => {
  181. if (res.status == 200) {
  182. _this.$message.success(res.message)
  183. _this.getDetail()
  184. _this.$refs.table.refresh()
  185. _this.spinning = false
  186. } else {
  187. _this.spinning = false
  188. }
  189. })
  190. }
  191. })
  192. }
  193. },
  194. mounted () {
  195. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新 或 为弹框时调用
  196. this.$refs.table.refresh(true)
  197. this.getDetail()
  198. }
  199. },
  200. activated () {
  201. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  202. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  203. this.$refs.table.refresh(true)
  204. this.getDetail()
  205. }
  206. },
  207. beforeRouteEnter (to, from, next) {
  208. next(vm => {})
  209. }
  210. }
  211. </script>
  212. <style lang="less">
  213. .urgentItemsOffsetDetail-page-wrapper{
  214. position: relative;
  215. height: 100%;
  216. box-sizing: border-box;
  217. >.ant-spin-nested-loading{
  218. overflow-y: auto;
  219. height: 100%;
  220. }
  221. .urgentItemsOffsetDetail-info-wrapper{
  222. margin: 10px 0;
  223. .item-cont {
  224. margin-bottom: 10px;
  225. display: flex;
  226. .item-label {
  227. width: 115px;
  228. font-size: 14px;
  229. color: rgba(0, 0, 0);
  230. flex-shrink: 0;
  231. }
  232. .item-main {
  233. flex-grow: 1;
  234. word-break: break-all;
  235. }
  236. }
  237. }
  238. .urgentItemsOffsetDetail-table-wrapper{
  239. .red{
  240. color: #ed1c24;
  241. }
  242. }
  243. }
  244. </style>