detailModal.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <a-modal
  3. centered
  4. class="customerManagementDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="客户详情"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. :width="960">
  11. <!-- 客户详情 -->
  12. <div>
  13. <a-spin :spinning="!detailData" tip="Loading...">
  14. <a-descriptions :column="3" bordered size="small">
  15. <a-descriptions-item label="客户名称:">{{ detailData&&detailData.customerName || '--' }}</a-descriptions-item>
  16. <a-descriptions-item label="联系人:">{{ detailData&&detailData.contactName || '--' }}</a-descriptions-item>
  17. <a-descriptions-item label="联系电话:">{{ detailData&&detailData.contactTel || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="联系手机:">{{ detailData&&detailData.contactMobile || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="客户地址:" :span="3">{{ addressStr }}</a-descriptions-item>
  20. <a-descriptions-item label="客户传真:">{{ detailData&&detailData.fax || '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="配送方式:">{{ detailData&&detailData.dispatchTypeDictValue || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="客户关系:">{{ detailData&&detailData.relationTypeDictValue || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="价格类型:">{{ detailData&&detailData.priceTypeDictValue || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="收款方式:">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="客户类型:">{{ detailData&&detailData.customerTypeName || '--' }}</a-descriptions-item>
  26. </a-descriptions>
  27. <div>
  28. <div style="padding:10px 0;border-bottom: 1px solid #eee;margin: 10px 0;">被合并的客户记录</div>
  29. <div>
  30. <s-table
  31. class="sTable"
  32. ref="table"
  33. size="small"
  34. :rowKey="(record) => record.id"
  35. :columns="columns"
  36. :data="loadData"
  37. :defaultLoadData="false"
  38. bordered>
  39. </s-table>
  40. </div>
  41. </div>
  42. </a-spin>
  43. <div class="btn-cont"><a-button id="customer-management-detail-modal-back" @click="isShow = false">返回列表</a-button></div>
  44. </div>
  45. </a-modal>
  46. </template>
  47. <script>
  48. import { STable } from '@/components'
  49. import { custFindById, custMergeLogList } from '@/api/customer'
  50. export default {
  51. name: 'CustomerManagementDetailModal',
  52. components: { STable },
  53. props: {
  54. openModal: { // 弹框显示状态
  55. type: Boolean,
  56. default: false
  57. },
  58. itemId: {
  59. type: [Number, String],
  60. default: ''
  61. }
  62. },
  63. computed: {
  64. // 地址处理
  65. addressStr () {
  66. const provinceName = this.detailData && this.detailData.provinceName ? this.detailData.provinceName : ''
  67. const cityName = this.detailData && this.detailData.cityName ? this.detailData.cityName : ''
  68. const countyName = this.detailData && this.detailData.countyName ? this.detailData.countyName : ''
  69. const customerAddr = this.detailData && this.detailData.customerAddr ? this.detailData.customerAddr : ''
  70. const str = (provinceName || cityName || countyName || customerAddr) ? (provinceName + cityName + countyName + customerAddr) : '--'
  71. return str
  72. }
  73. },
  74. data () {
  75. return {
  76. isShow: this.openModal, // 是否打开弹框
  77. detailData: null, // 网点数据
  78. columns: [
  79. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  80. { title: '合并时间', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  81. { title: '被合并客户名称', dataIndex: 'customerNameSource', width: '40%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  82. { title: '合并后客户名称', dataIndex: 'customerNameTarget', width: '40%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  83. ],
  84. // 加载数据方法 必须为 Promise 对象
  85. loadData: parameter => {
  86. this.disabled = true
  87. this.spinning = true
  88. return custMergeLogList(Object.assign(parameter, { customerSnMain: this.detailData.customerSn })).then(res => {
  89. let data
  90. if (res.status == 200) {
  91. data = res.data
  92. const no = (data.pageNo - 1) * data.pageSize
  93. for (var i = 0; i < data.list.length; i++) {
  94. data.list[i].no = no + i + 1
  95. }
  96. this.disabled = false
  97. }
  98. this.spinning = false
  99. return data
  100. })
  101. }
  102. }
  103. },
  104. methods: {
  105. // 获取详情
  106. getDetail () {
  107. custFindById({ id: this.itemId }).then(res => {
  108. if (res.status == 200) {
  109. this.detailData = res.data
  110. this.$refs.table.refresh()
  111. } else {
  112. this.detailData = null
  113. }
  114. })
  115. }
  116. },
  117. watch: {
  118. // 父页面传过来的弹框状态
  119. openModal (newValue, oldValue) {
  120. this.isShow = newValue
  121. },
  122. // 重定义的弹框状态
  123. isShow (newValue, oldValue) {
  124. if (!newValue) {
  125. this.detailData = null
  126. this.$emit('close')
  127. }
  128. },
  129. itemId (newValue, oldValue) {
  130. if (this.isShow && newValue) {
  131. this.getDetail()
  132. }
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="less">
  138. .customerManagementDetail-modal{
  139. .ant-modal-body {
  140. padding: 40px 40px 24px;
  141. }
  142. .ant-descriptions-item-label.ant-descriptions-item-colon{
  143. width: 145px;
  144. }
  145. .item-cont {
  146. margin-bottom: 10px;
  147. display: flex;
  148. .item-label {
  149. width: 115px;
  150. font-size: 14px;
  151. color: rgba(0, 0, 0);
  152. flex-shrink: 0;
  153. }
  154. .item-main {
  155. flex-grow: 1;
  156. word-break: break-all;
  157. }
  158. }
  159. .btn-cont {
  160. text-align: center;
  161. margin: 35px 0 10px;
  162. }
  163. }
  164. </style>