detail.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="salesDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="salesDetail-cont">
  4. <template slot="subTitle">
  5. <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
  6. </template>
  7. <template slot="extra">
  8. <span>打印字段:</span>
  9. <a-select key="1" style="width:150px" id="salesDetail-pritKey" placeholder="请选择打印字段" allowClear>
  10. <a-select-option v-for="item in pritKey" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
  11. </a-select>
  12. <span><i style="color: red;">*</i>打印模板:</span>
  13. <a-select key="2" style="width:150px" id="salesDetail-pritKey" placeholder="请选择打印模板" allowClear>
  14. <a-select-option v-for="item in pritModal" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
  15. </a-select>
  16. <a-button key="3" id="salesDetail-preview-btn">打印预览</a-button>
  17. <a-button key="4" type="primary" id="salesDetail-print-btn">快速打印</a-button>
  18. <a-button key="5" id="salesDetail-export-btn">导出</a-button>
  19. </template>
  20. </a-page-header>
  21. <!-- 基础信息 -->
  22. <a-card size="small" :bordered="false" class="salesDetail-cont">
  23. <a-collapse :activeKey="['1']">
  24. <a-collapse-panel key="1" header="基础信息">
  25. <a-descriptions size="small" :column="3" v-if="detailData">
  26. <a-descriptions-item label="客户名称">{{ detailData.buyerName || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="收货地址">{{ detailData.shippingAddressProvinceName || '--' }}{{ detailData.shippingAddressCityName || '--' }}{{ detailData.shippingAddressCountyName || '--' }}{{ detailData.shippingAddress || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="收款方式">{{ detailData.settleStyleSn || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="收货人">{{ detailData.operatorName || '--' }}</a-descriptions-item>
  30. <a-descriptions-item label="收货电话">{{ detailData.consigneeTel || '--' }}</a-descriptions-item>
  31. <a-descriptions-item label="备注">{{ detailData.remarks || '--' }}</a-descriptions-item>
  32. <a-descriptions-item label="审核时间">{{ detailData.auditDate || '--' }}</a-descriptions-item>
  33. <a-descriptions-item label="业务状态">{{ detailData.billStatusDictValue || '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="财务状态">{{ detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
  35. </a-descriptions>
  36. </a-collapse-panel>
  37. </a-collapse>
  38. </a-card>
  39. <a-card size="small" :bordered="false" class="pages-wrap">
  40. <!-- alert -->
  41. <a-alert type="info" style="margin-bottom: 15px;" v-if="detailData">
  42. <div slot="message">
  43. 总销售数量:<strong>{{ detailData.totalQty || 0 }}</strong>;已取消数量:<strong>{{ detailData.cancelQty || 0 }}</strong>;已下推数量:<strong>{{ detailData.pushedQty || 0 }}</strong>;待下推数量:<strong>{{ detailData.unpushedQty || 0 }}</strong>;<br/>
  44. 总售价:<strong>{{ detailData.totalAmount || 0 }}</strong>;总成本:<strong>{{ detailData.totalCost || 0 }}</strong>;总毛利:<strong>{{ detailData.grossProfit || 0 }}</strong>;已取消金额:<strong>{{ detailData.totalCancelAmount || 0 }}</strong>;已下推金额:<strong>{{ detailData.totalPushedAmount || 0 }}%</strong>;待下推金额:<strong>{{ detailData.totalUnpushedAmount || 0 }}</strong>;
  45. </div>
  46. </a-alert>
  47. <!-- 列表 -->
  48. <s-table
  49. class="sTable"
  50. ref="table"
  51. size="default"
  52. :rowKey="(record) => record.id"
  53. :columns="columns"
  54. :data="loadData"
  55. :scroll="{ x: 1660 }"
  56. bordered>
  57. </s-table>
  58. </a-card>
  59. <a-card size="small" :bordered="false" class="footer-cont">
  60. <a-button
  61. type="primary"
  62. class="button-info"
  63. size="large"
  64. style="width: 150px;"
  65. id="salesDetail-edit-btn"
  66. v-if="detailData&&detailData.salesBillSource != 'PURCHASE' && (detailData.billStatus == 'WAIT_SUBMIT' || detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'AUDIT_REJECT')"
  67. @click="handleEdit(record)"
  68. >
  69. 编辑
  70. </a-button>
  71. <a-button
  72. size="large"
  73. style="width: 150px;"
  74. type="primary"
  75. class="button-info"
  76. id="salesDetail-edit-btn"
  77. v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')"
  78. @click="handleEdit(record)"
  79. >
  80. 改单
  81. </a-button>
  82. </a-card>
  83. </div>
  84. </template>
  85. <script>
  86. import { STable, VSelect } from '@/components'
  87. import { salesDetailBySn } from '@/api/sales'
  88. import { salesDetailList } from '@/api/salesDetail'
  89. export default {
  90. name: 'SalesDetail',
  91. components: { STable, VSelect },
  92. data () {
  93. return {
  94. disabled: false,
  95. pritKey: [
  96. { id: 0, name: '打印促销' },
  97. { id: 1, name: '打印支付方式' },
  98. { id: 2, name: '打印收款方式' }
  99. ],
  100. pritModal: [
  101. { id: 0, name: '普通模板一' },
  102. { id: 1, name: '普通模板二' },
  103. { id: 2, name: '仓库模板一' }
  104. ],
  105. // 表头
  106. columns: [
  107. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  108. { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center' },
  109. { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  110. { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  111. { title: '成本价', dataIndex: 'realCost', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
  112. { title: '销售价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
  113. { title: '单位', dataIndex: 'productOrigUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  114. { title: '可用库存数量', dataIndex: 'refundableQty', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  115. { title: '销售数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  116. { title: '已取消数', dataIndex: 'cancelQty', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  117. { title: '已下推数', dataIndex: 'pushedQty', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  118. { title: '待下推数', dataIndex: 'unpushedQty', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
  119. ],
  120. // 加载数据方法 必须为 Promise 对象
  121. loadData: parameter => {
  122. this.disabled = true
  123. return salesDetailList(Object.assign(parameter, { salesBillSn: this.$route.params.sn })).then(res => {
  124. const data = res.data
  125. const no = (data.pageNo - 1) * data.pageSize
  126. for (var i = 0; i < data.list.length; i++) {
  127. data.list[i].no = no + i + 1
  128. const productCode = (data.list[i].productEntity && data.list[i].productEntity.code) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.code)
  129. const productName = (data.list[i].productEntity && data.list[i].productEntity.name) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.name)
  130. const productOrigCode = (data.list[i].productEntity && data.list[i].productEntity.origCode) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.origCode)
  131. const productOrigUnit = (data.list[i].productEntity && data.list[i].productEntity.unit) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.unit)
  132. data.list[i].productCode = productCode || '--'
  133. data.list[i].productName = productName || '--'
  134. data.list[i].productOrigCode = productOrigCode || '--'
  135. data.list[i].productOrigUnit = productOrigUnit || '--'
  136. }
  137. this.disabled = false
  138. return data
  139. })
  140. },
  141. detailData: null // 详情数据
  142. }
  143. },
  144. methods: {
  145. // 返回
  146. handleBack () {
  147. // this.$router.push({ name: 'salesQueryList' })
  148. this.$router.back()
  149. },
  150. // 编辑
  151. handleEdit () {
  152. const row = this.detailData
  153. this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn } })
  154. },
  155. // 详情
  156. getDetail () {
  157. salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
  158. if (res.status == 200) {
  159. this.detailData = res.data
  160. } else {
  161. this.detailData = null
  162. }
  163. })
  164. }
  165. },
  166. mounted () {
  167. this.getDetail()
  168. }
  169. }
  170. </script>
  171. <style lang="less">
  172. .salesDetail-wrap{
  173. .salesDetail-cont{
  174. margin-bottom: 15px;
  175. }
  176. .footer-cont{
  177. margin-top: 5px;
  178. text-align: center;
  179. }
  180. }
  181. </style>