stockOrderDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div class="signWarehousingDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="signWarehousingDetail-cont" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }">
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="signWarehousingDetail-back-btn" href="javascript:;" @click="handleBack" v-if="!outBizSn"><a-icon type="left" /> 返回列表</a>
  8. <span class="billno">
  9. 单号:{{ detail&&detail.purchaseBillNo }}
  10. <span v-if="detail&&detail.sendBillNo">(发货单号:{{ detail&&detail.sendBillNo || '--' }})</span>
  11. </span>
  12. </template>
  13. <!-- 操作区,位于 title 行的行尾 -->
  14. <template slot="extra">
  15. <!-- <Print v-if="$hasPermissions('B_purchasePrint')" :disabled="localDataSource.length==0" @handlePrint="handlePrint"></Print> -->
  16. <a-button
  17. key="1"
  18. type="primary"
  19. class="button-warning"
  20. v-if="$hasPermissions('B_signWarehousingExport')"
  21. id="signWarehousingDetail-export-btn"
  22. :disabled="localDataSource.length==0"
  23. @click="handleExportProduct()">导出Excel</a-button>
  24. </template>
  25. </a-page-header>
  26. <!-- 基础信息 -->
  27. <a-card size="small" :bordered="false" class="purchaseOrderDetail-cont">
  28. <a-collapse :activeKey="['1']">
  29. <a-collapse-panel key="1" header="基础信息">
  30. <a-descriptions :column="3">
  31. <a-descriptions-item label="供应商">{{ (detail&&detail.purchaseTargetName) || '--' }}</a-descriptions-item>
  32. <a-descriptions-item label="支付方式">{{ (detail&&detail.purchaseBill&&detail.purchaseBill.settleStyleSnDictValue) || '--' }}</a-descriptions-item>
  33. <a-descriptions-item label="采购员工" v-if="detail&&detail.purchaseBill&&detail.purchaseBill.purchaseBillSource=='PURCHASE'">{{ detail&&detail.purchaseBill&&detail.purchaseBill.operatorName || '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="收货人">{{ detail&&detail.purchaseBill&&detail.purchaseBill.consigneeName || '--' }}<span v-if="detail&&detail.purchaseBill&&detail.purchaseBill.consigneeTel">({{ detail&&detail.purchaseBill&&detail.purchaseBill.consigneeTel }})</span></a-descriptions-item>
  35. <a-descriptions-item label="收货地址">
  36. <div v-if="detail&&detail.purchaseBill&&(detail.purchaseBill.shippingAddressProvinceName || detail.purchaseBill.shippingAddressCityName || detail.purchaseBill.shippingAddressCountyName || detail.purchaseBill.shippingAddress)">
  37. {{ detail&&detail.purchaseBill&&detail.purchaseBill.shippingAddressProvinceName || '' }}
  38. {{ detail&&detail.purchaseBill&&detail.purchaseBill.shippingAddressCityName || '' }}
  39. {{ detail&&detail.purchaseBill&&detail.purchaseBill.shippingAddressCountyName || '' }}
  40. {{ detail&&detail.purchaseBill&&detail.purchaseBill.shippingAddress || '' }}
  41. </div>
  42. <span v-else>--</span>
  43. </a-descriptions-item>
  44. </a-descriptions>
  45. </a-collapse-panel>
  46. </a-collapse>
  47. </a-card>
  48. <a-card size="small" :bordered="false" class="signWarehousingDetail-cont">
  49. <!-- 总计 -->
  50. <a-alert type="info" style="margin-bottom:10px">
  51. <div slot="message">
  52. 产品款数:<strong>{{ detail && (detail.totalPutCategory || detail.totalPutCategory==0) ? detail.totalPutCategory : '--' }}</strong>,
  53. 本次发货数量合计:<strong>{{ detail && (detail.totalPutQty || detail.totalPutQty==0) ? detail.totalPutQty : '--' }}</strong>,
  54. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">本次发货金额合计:<strong>{{ detail && (detail.totalPutAmount || detail.totalPutAmount==0) ? toThousands(detail.totalPutAmount, 2) : '--' }}</strong>,</div>
  55. 本次入库数量合计:<strong>{{ detail && (detail.totalRealPutQty || detail.totalRealPutQty==0) ? detail.totalRealPutQty : '--' }}</strong>
  56. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">,
  57. 本次入库金额合计:<strong>{{ detail && (detail.totalRealPutAmount || detail.totalRealPutAmount==0) ? toThousands(detail.totalRealPutAmount, 2) : '--' }}</strong>
  58. </div>
  59. </div>
  60. </a-alert>
  61. <!-- 列表 -->
  62. <s-table
  63. class="sTable"
  64. ref="table"
  65. size="small"
  66. :rowKey="(record) => record.id"
  67. :columns="columns"
  68. :data="loadData"
  69. :defaultLoadData="false"
  70. bordered>
  71. <!-- 产品编码 -->
  72. <template slot="code" slot-scope="text, record">
  73. <span>{{ record.dealerProductEntity.code }}</span>
  74. <a-badge v-if="record.promotionFlag && record.promotionFlag=='GIFT'" count="促" :number-style="{ backgroundColor: '#52c41a', zoom:'80%',marginLeft:'5px' }"></a-badge>
  75. <a-badge v-if="record.promotionFlag && record.promotionFlag=='DISCOUNT'" count="特" :number-style="{ backgroundColor: '#faad14', zoom:'80%',marginLeft:'5px' }"></a-badge>
  76. </template>
  77. <!-- 采购数量 -->
  78. <template slot="qty" slot-scope="text, record">
  79. <div>{{ record.qty }}</div>
  80. </template>
  81. <!-- 缺货数量 -->
  82. <template slot="outOfStockNum" slot-scope="text, record">
  83. <span>{{ record.outOfStockNum }}</span>
  84. </template>
  85. <!-- 采购单价 -->
  86. <template slot="unitPrice" slot-scope="text, record">
  87. <span v-if="record.promotionFlag && (record.promotionFlag=='GIFT' || record.promotionFlag=='DISCOUNT')">{{ (record.discountedPrice||record.discountedPrice==0)? toThousands(record.discountedPrice): '--' }}{{ record.origPrice ? '(' + toThousands(record.origPrice) + ')' : '' }}</span>
  88. <span v-else>{{ toThousands(record.discountedPrice) }}</span>
  89. </template>
  90. </s-table>
  91. </a-card>
  92. </a-spin>
  93. </div>
  94. </template>
  95. <script>
  96. import { commonMixin } from '@/utils/mixin'
  97. import { STable, VSelect } from '@/components'
  98. import { purchaseDetailPrint, purchaseDetailExport, purchaseExportDetail } from '@/api/purchase'
  99. import { receivingDetailSn, receivingDetailList, receivingExport } from '@/api/receiving'
  100. import Print from '@/views/common/print.vue'
  101. import { hdPrint } from '@/libs/JGPrint'
  102. export default {
  103. name: 'SignWareHousingStockOrderDetail',
  104. components: { STable, VSelect, Print },
  105. mixins: [commonMixin],
  106. props: {
  107. outBizSn: { // 有值则为弹框,无值则为页面
  108. type: [Number, String],
  109. default: ''
  110. }
  111. },
  112. data () {
  113. return {
  114. spinning: false,
  115. // 加载数据方法 必须为 Promise 对象
  116. loadData: parameter => {
  117. this.disabled = true
  118. return receivingDetailList(Object.assign(parameter, { receivingBillSn: this.outBizSn || this.$route.params.sn })).then(res => {
  119. const data = res.data
  120. const no = (data.pageNo - 1) * data.pageSize
  121. for (var i = 0; i < data.list.length; i++) {
  122. data.list[i].no = no + i + 1
  123. }
  124. this.localDataSource = data.list
  125. this.disabled = false
  126. return data
  127. })
  128. },
  129. detail: null, // 详情数据
  130. localDataSource: [],
  131. printerType: 'NEEDLE' // 打印机类型
  132. }
  133. },
  134. computed: {
  135. columns () {
  136. const _this = this
  137. const arr = [
  138. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  139. { title: '产品编码', dataIndex: 'dealerProductEntity.code', scopedSlots: { customRender: 'code' }, width: '15%', align: 'center' },
  140. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  141. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  142. { title: '采购数量', width: '6%', align: 'center', scopedSlots: { customRender: 'qty' } },
  143. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  144. { title: '本次发货数量', dataIndex: 'putQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  145. { title: '本次入库数量', dataIndex: 'realPutQty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } }
  146. ]
  147. if (this.$hasPermissions('M_ShowAllCost')) {
  148. arr.splice(4, 0, { title: '采购单价', dataIndex: 'discountedPrice', width: '10%', align: 'right', scopedSlots: { customRender: 'unitPrice' } })
  149. arr.splice(8, 0, { title: '本次发货金额', dataIndex: 'discountedAmount', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  150. arr.splice(10, 0, { title: '本次入库金额', dataIndex: 'realPutAmount', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  151. }
  152. return arr
  153. }
  154. },
  155. methods: {
  156. // 返回列表
  157. handleBack () {
  158. this.$router.push({ path: '/purchasingManagement/signWarehousing/list', query: { closeLastOldTab: true } })
  159. },
  160. // 详情
  161. getDetail () {
  162. receivingDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
  163. if (res.status == 200) {
  164. this.detail = res.data
  165. } else {
  166. this.detail = null
  167. }
  168. })
  169. },
  170. // 打印预览/快捷打印
  171. handlePrint (type, printerType) {
  172. const _this = this
  173. _this.spinning = true
  174. let url = purchaseDetailPrint
  175. let params = { sn: this.outBizSn || this.$route.params.sn, type: printerType }
  176. if (type == 'export') { // 导出
  177. url = purchaseExportDetail
  178. params = { sn: this.outBizSn || this.$route.params.sn }
  179. }
  180. // 打印或导出
  181. hdPrint(printerType, type, url, params, '备货单', function () {
  182. _this.spinning = false
  183. })
  184. },
  185. // 导出产品
  186. handleExportProduct () {
  187. const _this = this
  188. _this.spinning = true
  189. // 打印或导出
  190. hdPrint('', 'export', receivingExport, { receivingBillSn: this.outBizSn || this.$route.params.sn }, '备货单', function () {
  191. _this.spinning = false
  192. })
  193. }
  194. },
  195. mounted () {
  196. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新时调用
  197. this.$refs.table.refresh(true)
  198. this.getDetail()
  199. }
  200. },
  201. activated () {
  202. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  203. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  204. this.$refs.table.refresh(true)
  205. this.getDetail()
  206. }
  207. },
  208. beforeRouteEnter (to, from, next) {
  209. next(vm => {})
  210. }
  211. }
  212. </script>
  213. <style lang="less">
  214. .signWarehousingDetail-cont{
  215. margin-bottom: 10px;
  216. .timeline-box{
  217. margin-top: 30px;
  218. .auxiliary-txt{
  219. color: #808695;
  220. }
  221. }
  222. }
  223. .signWarehousingDetail-wrap{
  224. .billno{
  225. font-size: 16px;
  226. font-weight: bold;
  227. margin: 0 15px;
  228. }
  229. }
  230. </style>