lookUpCustomersModal.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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 type="primary" class="button-warning" @click="editDealerModal">修改</a-button>
  67. <a-button type="primary" style="margin-left: 15px;" :loading="spinning" id="promotion-modal-save" @click="handleSaveAudit">提交审核</a-button>
  68. </div>
  69. </a-spin>
  70. <!-- 选择参与客户 -->
  71. <a-modal
  72. title="选择经销商"
  73. :visible="openDealerModal"
  74. :footer="null"
  75. centered
  76. class="lookUpCustomers-modal"
  77. @cancel="openDealerModal = false"
  78. width="60%"
  79. >
  80. <div class="dealerModalCon">
  81. <chooseDealer ref="dealerChoose" pageType="dealerPromotion" @plAdd="handleAddDealer"></chooseDealer>
  82. </div>
  83. </a-modal>
  84. </a-modal>
  85. </template>
  86. <script>
  87. import { commonMixin } from '@/utils/mixin'
  88. import { STable } from '@/components'
  89. import subarea from '@/views/common/subarea.js'
  90. import AreaList from '@/views/common/areaList.js'
  91. import { hdExportExcel } from '@/libs/exportExcel'
  92. import { dealerExport } from '@/api/promoTerminal'
  93. import { queryAuditPageList, dealerMidwayUpdate } from '@/api/promotion'
  94. import chooseDealer from '../promotionManagement/chooseDealer'
  95. export default {
  96. name: 'LookUpCustomersModal',
  97. components: { STable, subarea, AreaList, chooseDealer },
  98. mixins: [commonMixin],
  99. props: {
  100. openModal: { // 弹框显示状态
  101. type: Boolean,
  102. default: false
  103. },
  104. itemSn: {
  105. type: String,
  106. default: ''
  107. }
  108. },
  109. data () {
  110. return {
  111. spinning: false,
  112. isShow: this.openModal, // 是否打开弹框
  113. disabled: false,
  114. exportLoading: false,
  115. queryParam: {
  116. subareaArea: {
  117. subareaSn: undefined,
  118. subareaAreaSn: undefined
  119. },
  120. provinceSn: undefined,
  121. citySn: undefined,
  122. districtSn: undefined,
  123. dealerName: undefined
  124. },
  125. // 加载数据方法 必须为 Promise 对象
  126. loadData: parameter => {
  127. this.disabled = true
  128. this.spinning = true
  129. const params = Object.assign(parameter, this.queryParam)
  130. const ajaxName = !this.updateFlag ? queryAuditPageList : dealerMidwayUpdate
  131. return ajaxName(params).then(res => {
  132. let data
  133. if (res.status == 200) {
  134. data = res.data
  135. const no = (data.pageNo - 1) * data.pageSize
  136. for (var i = 0; i < data.list.length; i++) {
  137. data.list[i].no = no + i + 1
  138. }
  139. this.disabled = false
  140. }
  141. this.spinning = false
  142. return data
  143. })
  144. },
  145. columns: [
  146. { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
  147. { title: '地区', scopedSlots: { customRender: 'address' }, width: '20%', align: 'center', ellipsis: true },
  148. { title: '区域', dataIndex: 'subareaArea.subareaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  150. { title: '经销商名称', dataIndex: 'dealerName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  151. { title: '商户类型', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  152. { title: '商户级别', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
  153. ],
  154. openDealerModal: false, // 修改弹窗
  155. updateFlag: false
  156. }
  157. },
  158. methods: {
  159. // 修改参与客户
  160. editDealerModal () {
  161. const _this = this
  162. _this.openDealerModal = true
  163. // const arr = _this.chooseDealerList.map(item => {
  164. // return item.dealerSn
  165. // })
  166. // // 选择参与客户回显
  167. // _this.$nextTick(() => {
  168. // _this.$refs.dealerChoose.pageInit(arr)
  169. // })
  170. },
  171. // 添加经销商
  172. handleAddDealer (list) {
  173. // this.chooseDealerList = list
  174. // this.openDealerModal = false
  175. debugger
  176. this.updateFlag = true
  177. this.$nextTick(() => {
  178. this.$refs.table.refresh()
  179. })
  180. },
  181. areaChange (val) {
  182. this.queryParam.provinceSn = val[0] ? val[0] : ''
  183. this.queryParam.citySn = val[1] ? val[1] : ''
  184. this.queryParam.districtSn = val[2] ? val[2] : ''
  185. },
  186. subareaChange (val) {
  187. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  188. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  189. },
  190. // 重置
  191. resetSearchForm () {
  192. this.queryParam = Object.assign({
  193. provinceSn: undefined,
  194. citySn: undefined,
  195. districtSn: undefined,
  196. subareaArea: {
  197. subareaSn: undefined,
  198. subareaAreaSn: undefined
  199. }
  200. }, this.snObj)
  201. this.queryParam.dealerName = undefined
  202. this.updateFlag = false
  203. this.$refs.areaList.clearData()
  204. this.$refs.subarea.clearData()
  205. this.$refs.table.refresh(true)
  206. },
  207. // 导出
  208. handleExport () {
  209. const _this = this
  210. _this.exportLoading = true
  211. _this.spinning = true
  212. hdExportExcel(dealerExport, _this.queryParam, '促销经销商列表导出', function () {
  213. _this.exportLoading = false
  214. _this.spinning = false
  215. _this.showExport = true
  216. })
  217. },
  218. // 提交审核
  219. handleSaveAudit () {
  220. }
  221. },
  222. watch: {
  223. // 父页面传过来的弹框状态
  224. openModal (newValue, oldValue) {
  225. this.isShow = newValue
  226. },
  227. // 重定义的弹框状态
  228. isShow (newValue, oldValue) {
  229. if (!newValue) {
  230. this.$emit('close')
  231. this.resetSearchForm()
  232. } else {
  233. this.$refs.table.refresh(true)
  234. }
  235. }
  236. }
  237. }
  238. </script>
  239. <style lang="less" scoped>
  240. .lookUpCustomers-modal{
  241. .ant-modal-body{
  242. padding: 0 24px 24px;
  243. }
  244. .redBg-row{
  245. background-color: #f5cdc8;
  246. }
  247. .btn-cont {
  248. text-align: center;
  249. margin: 5px 0 10px;
  250. }
  251. .table-page-search-wrapper{
  252. margin-bottom:6px;
  253. /deep/.ant-select-selection{
  254. border:0 !important;
  255. box-shadow: none !important;
  256. }
  257. .ant-form.ant-form-inline .ant-form-item{
  258. border:1px solid #dadada;
  259. border-radius: 3px;
  260. overflow: hidden;
  261. margin-bottom: 10px!important;
  262. /deep/.ant-form-item-label{
  263. padding-left: 11px !important;
  264. padding-right: 0!important;
  265. }
  266. }
  267. }
  268. }
  269. </style>