businessList.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. <template>
  2. <div class="business-ETA-list">
  3. <div class="top-filter-box">
  4. <div>
  5. <el-button type="primary" @click="$router.push('/addETABusiness')">新增</el-button>
  6. <el-input
  7. placeholder="商家名称/社会信用码/商家ID"
  8. v-model="search_txt"
  9. @input="changeSelectOptions('search')"
  10. clearable
  11. style="maxWidth:500px;float:right">
  12. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  13. </el-input>
  14. </div>
  15. </div>
  16. <div class="table-wrap">
  17. <div class="select-wrap">
  18. <el-select
  19. v-model="trade"
  20. placeholder="请选择行业"
  21. clearable
  22. @change="changeSelectOptions('trade')"
  23. >
  24. <el-option
  25. v-for="item in tradeArr"
  26. :key="item.IndustryId"
  27. :label="item.IndustryName"
  28. :value="item.IndustryId">
  29. </el-option>
  30. </el-select>
  31. <el-cascader
  32. ref="cascader"
  33. v-model="sales"
  34. :options="salesArr"
  35. :show-all-levels="false"
  36. :props="{
  37. expandTrigger: 'hover',
  38. children: 'Child',
  39. emitPath: false,
  40. label:'AdminName',
  41. value:'AdminId',
  42. multiple:true
  43. }"
  44. collapse-tags
  45. filterable
  46. clearable
  47. placeholder="请选择销售"
  48. @change="changeSelectOptions('sales')"
  49. />
  50. <el-cascader
  51. v-model="valueLocation"
  52. collapse-tags
  53. :props="locationProps"
  54. clearable
  55. :options="locationOptions"
  56. @change="changeSelectOptions('location')"
  57. placeholder="请选择客户地址"
  58. />
  59. <el-select v-model="nation" placeholder="请选择所属国家" filterable clearable @change="changeSelectOptions('nation')">
  60. <el-option :label="item.cnName" :value="item.cnName" v-for="item in countryData" :key="item.code" >
  61. <div style="display: flex;justify-content: space-between;">
  62. <span>{{ item.cnName }}</span>
  63. <span style="color: #8492a6; font-size: 13px">{{ item.code }}</span>
  64. </div>
  65. </el-option>
  66. </el-select>
  67. <el-select
  68. v-model="signStatus"
  69. placeholder="请选择签约状态"
  70. clearable
  71. @change="changeSelectOptions('signStatus')"
  72. >
  73. <el-option
  74. v-for="item in signStatusOpts"
  75. :key="item.val"
  76. :label="item.label"
  77. :value="item.val">
  78. </el-option>
  79. </el-select>
  80. </div>
  81. <el-table
  82. ref="userTable"
  83. :data="tableData"
  84. v-loading="isTableLoadding"
  85. element-loading-text="数据加载中..."
  86. @sort-change="sortChangeHandle"
  87. border
  88. >
  89. <el-table-column
  90. v-for="item in tableColOpts"
  91. :key="item.key"
  92. :prop="item.key"
  93. :label="item.label"
  94. align="center"
  95. :sortable="item.sort"
  96. >
  97. <template slot-scope="scope">
  98. <span v-if="item.key==='SigningStatus'">
  99. {{signStatusOpts[scope.row.SigningStatus - 1].label}}{{!scope.row.Enable?'(禁用)':''}}
  100. </span>
  101. <span v-else-if="item.key==='BusinessName'" class="link" @click="handleShowDetail(scope.row)">
  102. {{ scope.row.BusinessName }}
  103. </span>
  104. <span v-else-if="item.key==='Address'">
  105. {{ scope.row.RegionType=='海外'?scope.row.Nation || scope.row.Address:scope.row.Address }}
  106. </span>
  107. <span v-else>{{scope.row[item.key]}}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column
  111. label="操作"
  112. min-width="100"
  113. align="center"
  114. >
  115. <template slot-scope="scope">
  116. <div class="table-opt-btns">
  117. <span @click="handleEdit(scope.row)">编辑</span>
  118. <span @click="handleShowRenewal(scope.row)">添加续约</span>
  119. <el-dropdown
  120. size="medium"
  121. placement="bottom-start"
  122. @command="itemclickHandle($event,scope.row)"
  123. >
  124. <span class="el-dropdown-link">
  125. <i class="el-icon-more el-icon--right"></i>
  126. <el-dropdown-menu slot="dropdown">
  127. <el-dropdown-item command="setAuth">权限设置</el-dropdown-item>
  128. <el-dropdown-item command="modifySale">修改销售</el-dropdown-item>
  129. <el-dropdown-item command="disable">{{scope.row.Enable?'禁用':'启用'}}</el-dropdown-item>
  130. </el-dropdown-menu>
  131. </span>
  132. </el-dropdown>
  133. </div>
  134. </template>
  135. </el-table-column>
  136. </el-table>
  137. <div style="text-align:right;margin-top:20px">
  138. <el-pagination
  139. layout="total,prev,pager,next,jumper"
  140. background
  141. :current-page="page"
  142. @current-change="handleCurrentChange"
  143. :page-size="pageSize"
  144. :total="total"
  145. style="display: inline-block"
  146. />
  147. </div>
  148. </div>
  149. <!-- 添加续约 -->
  150. <el-dialog
  151. title="添加续约"
  152. :visible.sync="showRenewal"
  153. :modal-append-to-body="false"
  154. :close-on-click-modal="false"
  155. @closed="showRenewal=false"
  156. width="580px"
  157. >
  158. <AddRenewal
  159. @addRenewal="handleAddRenewal"
  160. @close="showRenewal=false"/>
  161. </el-dialog>
  162. <!-- 修改销售 -->
  163. <el-dialog
  164. title="修改销售"
  165. :visible.sync="showModifySaller"
  166. :modal-append-to-body="false"
  167. :close-on-click-modal="false"
  168. @closed="showRenewal=false"
  169. width="580px"
  170. >
  171. <ModifySaller
  172. :salesArr="salesArr"
  173. :data="modifyData"
  174. @modifySaller="handleModifySaller"
  175. @close="showModifySaller=false"/>
  176. </el-dialog>
  177. </div>
  178. </template>
  179. <script>
  180. import { customInterence ,businessCustomInterence , roadshowInterence} from '@/api/api.js'
  181. import {locationOptions} from "@/views/custom_manage/customList/location"
  182. import AddRenewal from './components/AddRenewal.vue'
  183. import ModifySaller from './components/ModifySaller.vue'
  184. import country from "@/utils/countryData"
  185. export default {
  186. components:{AddRenewal,ModifySaller},
  187. data() {
  188. this.countryData = country
  189. return {
  190. /* dialog */
  191. showRenewal:false,//显示添加续约
  192. showModifySaller:false,//显示修改销售
  193. modifyData:{},//当前操作的商家数据
  194. /* select options */
  195. search_txt:'',
  196. trade:'',
  197. tradeArr:[],
  198. sales:[],
  199. salesArr:[],//销售
  200. locationOptions,
  201. valueLocation:[],
  202. provinceValue:'',
  203. cityValue:'',
  204. nation:'',
  205. locationProps:{
  206. multiple: true,
  207. value:'name',
  208. children:'city',
  209. label:'name'
  210. },
  211. signStatus:'',
  212. signStatusOpts:[
  213. {
  214. label:'首次签约',
  215. val:1
  216. },
  217. {
  218. label:'续约中',
  219. val:2
  220. },
  221. {
  222. label:'已终止',
  223. val:3
  224. },
  225. {
  226. label:'待签约',
  227. val:4
  228. }
  229. ],
  230. /* sort options */
  231. sortParam:0,
  232. sortType:0,
  233. /* table */
  234. tableColOpts:[
  235. {
  236. label:'商家名称',
  237. key:'BusinessName'
  238. },
  239. {
  240. label:'商家ID',
  241. key:'BusinessCode'
  242. },
  243. {
  244. label:'商家地址/所属国家',
  245. key:'Address'
  246. },
  247. {
  248. label:'销售',
  249. key:'SellerName'
  250. },
  251. {
  252. label:'签约状态',
  253. key:'SigningStatus'
  254. },
  255. {
  256. label:'运维开始时间',
  257. key:'SigningTime',
  258. sort:true
  259. },
  260. {
  261. label:'到期时间',
  262. key:'ExpiredTime',
  263. sort:true
  264. },
  265. {
  266. label:'创建时间',
  267. key:'CreateTime',
  268. sort:true
  269. },
  270. {
  271. label:'用户上限',
  272. key:'UserMax',
  273. sort:true
  274. },
  275. ],
  276. tableData:[],
  277. isTableLoadding:false,
  278. page:1,
  279. pageSize:20,
  280. total:0,
  281. }
  282. },
  283. created() {
  284. this.getIndustry()
  285. this.getSale()
  286. this.getBusinessList()
  287. },
  288. methods: {
  289. // 筛选项改变
  290. changeSelectOptions(option){
  291. if(option === 'location'){
  292. const provinceArr = []
  293. const cityArr = []
  294. this.valueLocation.forEach(item=>{
  295. // 省
  296. provinceArr.push(item[0])
  297. // 市
  298. cityArr.push(item[1])
  299. })
  300. //provinceArr需要去重
  301. this.provinceValue = [...new Set(provinceArr)].join(',')
  302. this.cityValue = cityArr.join(',')
  303. this.page = 1;
  304. }
  305. this.getBusinessList()
  306. },
  307. // 表格排序方式改变
  308. sortChangeHandle(params){
  309. const sortParamMap = {
  310. 'SigningTime':1,//签约时间
  311. 'ExpiredTime':2,//到期时间
  312. 'CreateTime':3,//创建时间
  313. 'UserMax':4,//用户上限
  314. }
  315. this.sortParam = sortParamMap[params.prop]
  316. this.sortType = params.order === 'ascending' ? 1 :params.order === 'descending' ? 2 : 0
  317. this.page = 1
  318. this.getBusinessList()
  319. },
  320. // 获取表格数据
  321. getBusinessList(){
  322. this.isTableLoadding = true
  323. businessCustomInterence.getBusinessList({
  324. Keyword:this.search_txt,
  325. SellerIds:this.sales.join(','),
  326. SigningStatus:Number(this.signStatus),
  327. Province:this.provinceValue,
  328. City:this.cityValue,
  329. IndustryId:Number(this.trade),
  330. Nation:this.nation,
  331. PageSize:this.pageSize,
  332. CurrentIndex:this.page,
  333. SortParam:this.sortParam,
  334. SortType:this.sortType
  335. }).then(res=>{
  336. if(res.Ret!==200) return
  337. this.tableData = res.Data.List
  338. this.total = res.Data.Paging.Totals
  339. this.isTableLoadding = false
  340. })
  341. },
  342. // 去详情
  343. handleShowDetail(data){
  344. this.$router.push({
  345. path:'/businessETADetail',
  346. query:{
  347. id:data.EtaBusinessId
  348. }
  349. })
  350. },
  351. // 前去编辑
  352. handleEdit(data){
  353. this.$router.push({
  354. path:'/editETABusiness',
  355. query:{
  356. id:data.EtaBusinessId
  357. }
  358. })
  359. },
  360. // 显示添加续约
  361. handleShowRenewal(e){
  362. this.modifyData = e
  363. this.showRenewal=true
  364. },
  365. // 商家添加续约
  366. handleAddRenewal({signDate,expirationDate}){
  367. businessCustomInterence.addNewContract({
  368. EtaBusinessId:this.modifyData.EtaBusinessId,
  369. SigningTime:signDate,
  370. ExpiredTime:expirationDate
  371. }).then(res=>{
  372. if(res.Ret!==200) return
  373. this.$message.success('添加续约成功')
  374. this.showRenewal=false
  375. this.getBusinessList()
  376. })
  377. },
  378. // 商家修改销售
  379. handleModifySaller({saller,sallerName}){
  380. businessCustomInterence.changeBusinessSeller({
  381. EtaBusinessId:this.modifyData.EtaBusinessId,
  382. SellerId:saller,
  383. SellerName:sallerName
  384. }).then(res=>{
  385. if(res.Ret!==200) return
  386. this.$message.success('修改销售成功')
  387. this.showModifySaller = false
  388. this.getBusinessList()
  389. })
  390. },
  391. // 启用禁用商家
  392. changeBusinessStatus(data){
  393. businessCustomInterence.changeBusinessStatus({
  394. EtaBusinessId:data.EtaBusinessId
  395. }).then(res=>{
  396. if(res.Ret!==200) return
  397. this.$message.success(`${data.Enable?'禁用':'启用'}成功`)
  398. this.getBusinessList()
  399. })
  400. },
  401. // 操作栏 折叠起来的按钮
  402. itemclickHandle(type,data){
  403. if(type==='modifySale'){
  404. this.modifyData = data
  405. this.showModifySaller=true
  406. }else if (type==='disable'){
  407. this.changeBusinessStatus(data)
  408. }else if(type==='setAuth'){
  409. /* let {href} = this.$router.resolve({path:`/businessETAAuth`,query:{id:EtaBusinessId}});
  410. window.open(href,'_blank'); */
  411. this.$router.push({
  412. path:'/businessETAAuth',
  413. query:{
  414. id:data.EtaBusinessId,
  415. name:data.BusinessName
  416. }
  417. })
  418. }
  419. },
  420. /* 根据类型获取行业 */
  421. getIndustry() {
  422. customInterence.getindustry({
  423. Classify:'ficc'
  424. }).then(res => {
  425. if(res.Ret === 200) {
  426. this.tradeArr = res.Data.List || [];
  427. }
  428. })
  429. },
  430. /* 获取销售 */
  431. async getSale() {
  432. const res = await roadshowInterence.getSellerList();
  433. if(res.Ret!==200) return
  434. this.salesArr = res.Data.List||[]
  435. this.salesArr = this.salesArr.map(i=>{
  436. if(!i.AdminName){
  437. i.AdminName = i.GroupName
  438. }
  439. if(!i.AdminId){
  440. i.AdminId = i.GroupId
  441. }
  442. return i
  443. })
  444. },
  445. handleCurrentChange(page){
  446. this.page = page
  447. this.getBusinessList()
  448. }
  449. },
  450. }
  451. </script>
  452. <style lang="scss">
  453. .business-ETA-list{
  454. .top-filter-box{
  455. .el-cascader__search-input {
  456. min-width: 30px;
  457. }
  458. }
  459. }
  460. </style>
  461. <style lang="scss" scoped>
  462. .top-filter-box{
  463. border: 1px solid #ECECEC;
  464. padding: 20px 30px;
  465. background: #fff;
  466. border-radius: 4px;
  467. box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  468. }
  469. .table-wrap{
  470. margin-top: 30px;
  471. border: 1px solid #ECECEC;
  472. padding: 20px 30px;
  473. background: #fff;
  474. border-radius: 4px;
  475. box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  476. .select-wrap{
  477. display: flex;
  478. gap:20px;
  479. align-items: center;
  480. margin-bottom: 20px;
  481. .el-select,.el-cascader{
  482. width:240px;
  483. }
  484. }
  485. .link{
  486. color:#4099ef;
  487. cursor: pointer;
  488. &:hover{
  489. text-decoration: underline;
  490. }
  491. }
  492. }
  493. .table-opt-btns{
  494. color:#4099ef;
  495. display:flex;
  496. align-content: center;
  497. justify-content: center;
  498. align-items: center;
  499. span{
  500. margin: 0 3px;
  501. cursor: pointer;
  502. }
  503. }
  504. </style>