lookUpCustomersModal.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <a-modal
  3. centered
  4. class="lookUpCustomers-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="参与客户"
  8. v-model="isShow"
  9. @cancel="isShow = false"
  10. width="60%">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <a-card size="small" :bordered="false">
  13. <!-- 筛选条件 -->
  14. <div class="table-page-search-wrapper">
  15. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  16. <a-row :gutter="15">
  17. <a-col :md="6" :sm="24">
  18. <a-form-model-item label="地区">
  19. <AreaList id="actualSalesReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
  20. </a-form-model-item>
  21. </a-col>
  22. <a-col :md="6" :sm="24">
  23. <a-form-model-item label="区域/分区">
  24. <subarea ref="subarea" id="salesManagementList-subarea" @change="subareaChange"></subarea>
  25. </a-form-model-item>
  26. </a-col>
  27. <a-col :md="6" :sm="24">
  28. <a-form-item label="经销商名称">
  29. <a-input id="salesManagementList-purchaseBillNo" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入经销商名称"/>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  33. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryCheckMakeInventoryList-refresh">查询</a-button>
  34. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryCheckMakeInventoryList-reset">重置</a-button>
  35. <a-button
  36. style="margin-left: 10px"
  37. type="primary"
  38. class="button-warning"
  39. @click="handleExport"
  40. :disabled="disabled"
  41. :loading="exportLoading"
  42. >导出</a-button>
  43. </a-col>
  44. </a-row>
  45. </a-form>
  46. </div>
  47. <!-- 列表 -->
  48. <s-table
  49. class="sTable"
  50. ref="table"
  51. size="small"
  52. :rowKey="(record) => record.id"
  53. :columns="columns"
  54. :data="loadData"
  55. :defaultLoadData="false"
  56. :scroll="{ y: 450 }"
  57. :rowClassName="(record, index) => record.checkProfitLossQty < 0 ? 'redBg-row':''"
  58. bordered>
  59. <!-- 地区 -->
  60. <template slot="address" slot-scope="text, record">
  61. {{ record.provinceName }}/{{ record.cityName }}/{{ record.districtName }}
  62. </template>
  63. </s-table>
  64. </a-card>
  65. <div class="btn-cont">
  66. <a-button id="lookUpCustomers-modal-back" @click="isShow = false">关闭</a-button>
  67. </div>
  68. </a-spin>
  69. </a-modal>
  70. </template>
  71. <script>
  72. import { commonMixin } from '@/utils/mixin'
  73. import { STable } from '@/components'
  74. import ProductType from '@/views/common/productType.js'
  75. import subarea from '@/views/common/subarea.js'
  76. import AreaList from '@/views/common/areaList.js'
  77. import { hdExportExcel } from '@/libs/exportExcel'
  78. import { dealerExport } from '@/api/promoTerminal'
  79. import { dealerQueryList } from '@/api/dealer'
  80. export default {
  81. name: 'LookUpCustomersModal',
  82. components: { STable, ProductType, subarea, AreaList },
  83. mixins: [commonMixin],
  84. props: {
  85. openModal: { // 弹框显示状态
  86. type: Boolean,
  87. default: false
  88. }
  89. },
  90. data () {
  91. return {
  92. spinning: false,
  93. isShow: this.openModal, // 是否打开弹框
  94. disabled: false,
  95. advanced: false,
  96. exportShow: false,
  97. exportLoading: false,
  98. queryParam: {
  99. subareaArea: {
  100. subareaSn: undefined,
  101. subareaAreaSn: undefined
  102. },
  103. provinceSn: undefined,
  104. citySn: undefined,
  105. districtSn: undefined,
  106. dealerName: undefined
  107. },
  108. // 加载数据方法 必须为 Promise 对象
  109. loadData: parameter => {
  110. this.disabled = true
  111. this.spinning = true
  112. const params = Object.assign(parameter, this.queryParam)
  113. return dealerQueryList(params).then(res => {
  114. let data
  115. if (res.status == 200) {
  116. data = res.data
  117. const no = (data.pageNo - 1) * data.pageSize
  118. for (var i = 0; i < data.list.length; i++) {
  119. data.list[i].no = no + i + 1
  120. }
  121. this.disabled = false
  122. }
  123. this.spinning = false
  124. return data
  125. })
  126. },
  127. basicInfoData: null, // 基本信息
  128. productTotal: null,
  129. productType: [],
  130. snObj: undefined, // 经销商列表
  131. warehouseList: [], // 仓库 下拉数据
  132. localDataSource: [],
  133. isPrice: false, // 仅显示盈亏
  134. openPrintModal: false,
  135. nowType: null,
  136. printerType: 'NEEDLE', // 打印机类型
  137. columns: [
  138. { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
  139. { title: '地区', scopedSlots: { customRender: 'address' }, width: '20%', align: 'center', ellipsis: true },
  140. { title: '区域', dataIndex: 'subareaArea.subareaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  141. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  142. { title: '经销商名称', dataIndex: 'dealerName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  143. { title: '商户类型', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  144. { title: '商户级别', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
  145. ]
  146. }
  147. },
  148. methods: {
  149. areaChange (val) {
  150. this.queryParam.provinceSn = val[0] ? val[0] : ''
  151. this.queryParam.citySn = val[1] ? val[1] : ''
  152. this.queryParam.districtSn = val[2] ? val[2] : ''
  153. },
  154. subareaChange (val) {
  155. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  156. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  157. },
  158. pageInit (data) {
  159. this.snObj = data
  160. this.queryParam = Object.assign(this.queryParam, data)
  161. this.$refs.table.refresh(true)
  162. },
  163. // 重置
  164. resetSearchForm () {
  165. this.queryParam = Object.assign({
  166. provinceSn: undefined,
  167. citySn: undefined,
  168. districtSn: undefined,
  169. subareaArea: {
  170. subareaSn: undefined,
  171. subareaAreaSn: undefined
  172. }
  173. }, this.snObj)
  174. this.queryParam.dealerName = undefined
  175. this.$refs.areaList.clearData()
  176. this.$refs.subarea.clearData()
  177. this.$refs.table.refresh(true)
  178. },
  179. // 导出
  180. handleExport () {
  181. const _this = this
  182. _this.exportLoading = true
  183. _this.spinning = true
  184. hdExportExcel(dealerExport, _this.queryParam, '促销经销商列表导出', function () {
  185. _this.exportLoading = false
  186. _this.spinning = false
  187. _this.showExport = true
  188. })
  189. }
  190. },
  191. watch: {
  192. // 父页面传过来的弹框状态
  193. openModal (newValue, oldValue) {
  194. this.isShow = newValue
  195. },
  196. // 重定义的弹框状态
  197. isShow (newValue, oldValue) {
  198. if (!newValue) {
  199. this.$emit('close')
  200. this.resetSearchForm()
  201. }
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="less" scoped>
  207. .lookUpCustomers-modal{
  208. .ant-modal-body{
  209. padding: 0 24px 24px;
  210. }
  211. .redBg-row{
  212. background-color: #f5cdc8;
  213. }
  214. .btn-cont {
  215. text-align: center;
  216. margin: 5px 0 10px;
  217. }
  218. .table-page-search-wrapper{
  219. margin-bottom:6px;
  220. /deep/.ant-select-selection{
  221. border:0 !important;
  222. box-shadow: none !important;
  223. }
  224. .ant-form.ant-form-inline .ant-form-item{
  225. border:1px solid #dadada;
  226. border-radius: 3px;
  227. overflow: hidden;
  228. margin-bottom: 10px!important;
  229. /deep/.ant-form-item-label{
  230. padding-left: 11px !important;
  231. padding-right: 0!important;
  232. }
  233. }
  234. }
  235. }
  236. </style>