detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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="收货地址">
  28. {{ shippingAddress }}
  29. </a-descriptions-item>
  30. <a-descriptions-item label="收款方式">{{ detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
  31. <a-descriptions-item label="收货人">{{ detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
  32. <a-descriptions-item label="收货电话">{{ detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
  33. <a-descriptions-item label="备注">{{ detailData.remarks || '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="审核时间">{{ detailData.auditDate || '--' }}</a-descriptions-item>
  35. <a-descriptions-item label="业务状态">{{ detailData.billStatusDictValue || '--' }}</a-descriptions-item>
  36. <a-descriptions-item label="财务状态">{{ detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
  37. </a-descriptions>
  38. </a-collapse-panel>
  39. </a-collapse>
  40. </a-card>
  41. <a-card size="small" :bordered="false" class="pages-wrap">
  42. <!-- alert -->
  43. <a-alert type="info" style="margin-bottom: 10px;" v-if="detailData">
  44. <div slot="message">
  45. 总销售数量:<strong>{{ detailData.totalQty || 0 }}</strong>;已取消数量:<strong>{{ detailData.totalCancelQty || 0 }}</strong>;已下推数量:<strong>{{ detailData.totalPushedQty || 0 }}</strong>;待下推数量:<strong>{{ detailData.totalUnpushedQty || 0 }}</strong>;已发货数量:<strong>{{ detailData.totalDispatchQty || 0 }}</strong>;待发货数量:<strong>{{ detailData.totalUndispatchQty || 0 }}</strong>;<br/>
  46. 总售价:<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>;已发货金额:<strong>{{ detailData.totalDispatchAmount || 0 }}</strong>;待发货金额:<strong>{{ detailData.totalUndispatchAmount || 0 }}</strong>;
  47. </div>
  48. </a-alert>
  49. <!-- 列表 -->
  50. <s-table
  51. class="sTable"
  52. ref="table"
  53. size="small"
  54. :rowKey="(record) => record.id"
  55. :columns="columns"
  56. :data="loadData"
  57. :scroll="{ x: 1440 }"
  58. bordered>
  59. <!-- 产品编码 -->
  60. <template slot="productCode" slot-scope="text, record">
  61. <a-badge count="促" v-if="record.promotionFlag == 1">
  62. <div style="padding-right: 15px;">{{ text }}</div>
  63. </a-badge>
  64. <span v-else>{{ text }}</span>
  65. </template>
  66. </s-table>
  67. </a-card>
  68. <a-card size="small" :bordered="false" class="footer-cont">
  69. <a-button
  70. type="primary"
  71. class="button-info"
  72. size="large"
  73. style="width: 150px;"
  74. id="salesDetail-edit-btn"
  75. v-if="detailData&&detailData.salesBillSource != 'PURCHASE' && (detailData.billStatus == 'WAIT_SUBMIT' || detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'AUDIT_REJECT')&&$hasPermissions('B_salesEdit')"
  76. @click="handleEdit(record)"
  77. >
  78. 编辑
  79. </a-button>
  80. <a-button
  81. size="large"
  82. style="width: 150px;"
  83. type="primary"
  84. class="button-info"
  85. id="salesDetail-edit-btn"
  86. v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesEdit')"
  87. @click="handleEdit(record)"
  88. >
  89. 改单
  90. </a-button>
  91. </a-card>
  92. </div>
  93. </template>
  94. <script>
  95. import { STable, VSelect } from '@/components'
  96. import { salesDetailBySn } from '@/api/sales'
  97. import { salesDetailList } from '@/api/salesDetail'
  98. export default {
  99. name: 'SalesDetail',
  100. components: { STable, VSelect },
  101. data () {
  102. return {
  103. disabled: false,
  104. pritKey: [
  105. { id: 0, name: '打印促销' },
  106. { id: 1, name: '打印支付方式' },
  107. { id: 2, name: '打印收款方式' }
  108. ],
  109. pritModal: [
  110. { id: 0, name: '普通模板一' },
  111. { id: 1, name: '普通模板二' },
  112. { id: 2, name: '仓库模板一' }
  113. ],
  114. // 表头
  115. columns: [
  116. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  117. { title: '产品编码', dataIndex: 'productCode', width: 220, scopedSlots: { customRender: 'productCode' }, align: 'center' },
  118. { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  119. { title: '原厂编码', dataIndex: 'productOrigCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  120. { title: '成本价', dataIndex: 'showCost', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
  121. { title: '销售价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
  122. { title: '单位', dataIndex: 'productOrigUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  123. { title: '销售数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
  124. { title: '已取消数', dataIndex: 'cancelQty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
  125. { title: '已下推数', dataIndex: 'pushedQty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
  126. { title: '待下推数', dataIndex: 'unpushedQty', width: 100, align: 'center', customRender: function (text) { return text || 0 } }
  127. ],
  128. // 加载数据方法 必须为 Promise 对象
  129. loadData: parameter => {
  130. this.disabled = true
  131. return salesDetailList(Object.assign(parameter, { salesBillSn: this.$route.params.sn })).then(res => {
  132. const data = res.data
  133. const no = (data.pageNo - 1) * data.pageSize
  134. for (var i = 0; i < data.list.length; i++) {
  135. data.list[i].no = no + i + 1
  136. const productCode = (data.list[i].productEntity && data.list[i].productEntity.code) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.code)
  137. const productName = (data.list[i].productEntity && data.list[i].productEntity.name) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.name)
  138. const productOrigCode = (data.list[i].productEntity && data.list[i].productEntity.origCode) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.origCode)
  139. const productOrigUnit = (data.list[i].productEntity && data.list[i].productEntity.unit) || (data.list[i].dealerProductEntity && data.list[i].dealerProductEntity.unit)
  140. data.list[i].productCode = productCode || '--'
  141. data.list[i].productName = productName || '--'
  142. data.list[i].productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
  143. data.list[i].productOrigUnit = productOrigUnit || '--'
  144. }
  145. this.disabled = false
  146. return data
  147. })
  148. },
  149. detailData: null // 详情数据
  150. }
  151. },
  152. computed: {
  153. shippingAddress () {
  154. const shippingAddrProvinceName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrProvinceName ? this.detailData.salesBillExtEntity.shippingAddrProvinceName : ''
  155. const shippingAddrCityName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCityName ? this.detailData.salesBillExtEntity.shippingAddrCityName : ''
  156. const shippingAddrCountyName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCountyName ? this.detailData.salesBillExtEntity.shippingAddrCountyName : ''
  157. const shippingAddr = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddr ? this.detailData.salesBillExtEntity.shippingAddr : ''
  158. if (!shippingAddrProvinceName && !shippingAddrCityName && !shippingAddrCountyName && !shippingAddr) {
  159. return '--'
  160. } else {
  161. return shippingAddrProvinceName + shippingAddrCityName + shippingAddrCountyName + shippingAddr
  162. }
  163. }
  164. },
  165. methods: {
  166. // 返回
  167. handleBack () {
  168. this.$router.push({ name: 'salesQueryList' })
  169. },
  170. // 编辑
  171. handleEdit () {
  172. const row = this.detailData
  173. this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn } })
  174. },
  175. // 详情
  176. getDetail () {
  177. salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
  178. if (res.status == 200) {
  179. this.detailData = res.data
  180. } else {
  181. this.detailData = null
  182. }
  183. })
  184. }
  185. },
  186. mounted () {
  187. this.getDetail()
  188. }
  189. }
  190. </script>
  191. <style lang="less">
  192. .salesDetail-wrap{
  193. .salesDetail-cont{
  194. margin-bottom: 10px;
  195. }
  196. .footer-cont{
  197. margin-top: 5px;
  198. text-align: center;
  199. }
  200. }
  201. </style>