index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. <template>
  2. <div class="shopManage app-container">
  3. <div class="search">
  4. <div>
  5. <el-input
  6. v-model="query.shopName"
  7. size="small"
  8. placeholder="请输入门店名称"
  9. class="item-width-200 "
  10. ></el-input>
  11. <el-select
  12. v-model="platformType"
  13. multiple
  14. size="small"
  15. clearable
  16. class="item-width-200 ml10"
  17. placeholder="请选择所属平台"
  18. >
  19. <el-option
  20. v-for="item in masterShopOptions"
  21. :key="item.value"
  22. :label="item.label"
  23. :value="item.value"
  24. >
  25. </el-option>
  26. </el-select>
  27. <el-button
  28. class="ml10"
  29. type="primary"
  30. size="small"
  31. icon="el-icon-search"
  32. @click="handleSearch"
  33. >
  34. 搜索
  35. </el-button>
  36. </div>
  37. <el-button class="add-btn" type="primary" size="small" @click="handleAdd"
  38. >添加</el-button
  39. >
  40. </div>
  41. <el-table
  42. :data="tableData"
  43. tooltip-effect="dark"
  44. border
  45. v-loading="loading"
  46. style="width: 100%"
  47. >
  48. <el-table-column
  49. align="center"
  50. label="主体名称"
  51. prop="accountName"
  52. show-overflow-tooltip
  53. >
  54. </el-table-column>
  55. <el-table-column
  56. prop="accountChildType"
  57. align="center"
  58. label="所属平台"
  59. fit
  60. >
  61. <template slot-scope="scope">
  62. {{filterMasterName(scope.row.platformType )}}
  63. </template>
  64. </el-table-column>
  65. <el-table-column
  66. prop="accountChildType"
  67. align="center"
  68. label="类型"
  69. show-overflow-tooltip
  70. >
  71. <template slot-scope="scope">
  72. {{scope.row.accountChildType | filterType(that)}}
  73. </template>
  74. </el-table-column>
  75. <el-table-column
  76. prop="phoneNum"
  77. align="center"
  78. label="手机号"
  79. show-overflow-tooltip
  80. >
  81. </el-table-column>
  82. <el-table-column
  83. prop="contactName"
  84. align="center"
  85. label="联系人"
  86. show-overflow-tooltip
  87. >
  88. </el-table-column>
  89. <el-table-column
  90. align="center"
  91. prop="shopNum"
  92. label="门店数量"
  93. show-overflow-tooltip
  94. >
  95. </el-table-column>
  96. <el-table-column prop="address" align="center" label="操作">
  97. <template slot-scope="scope">
  98. <el-button type="text" size="small" @click="handleEdit(scope.row)"
  99. >编辑</el-button
  100. >
  101. <el-button type="text" size="small" @click="handle(scope.row.accountId,scope.row.accountChildType)"
  102. >账户</el-button
  103. >
  104. <el-button type="text" size="small" @click="handleDel(scope.row.accountId)"
  105. >删除</el-button
  106. >
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. <div class="page-box">
  111. <el-pagination
  112. @size-change="handleSizeChange"
  113. @current-change="handleCurrentChange"
  114. background
  115. :current-page="query.currentPage"
  116. :page-sizes="[10, 20, 30, 40]"
  117. :page-size="query.pageSize"
  118. layout="total, sizes, prev, pager, next, jumper"
  119. :total="total"
  120. >
  121. </el-pagination>
  122. </div>
  123. <el-dialog title="银联商户管理" width="70%" :visible.sync="dialogTableVisible">
  124. <el-table v-loading="loading1" :data="accountData">
  125. <el-table-column align="center" property="shop_name" label="营业名称" ></el-table-column>
  126. <el-table-column align="center" property="shop_lic" label="营业执照号码"></el-table-column>
  127. <el-table-column align="center" property="mer_no" label="银联子商户账号"></el-table-column>
  128. <el-table-column align="center" property="remark" label="绑定主商户">
  129. <template slot-scope="scope">
  130. {{scope.row.remark | filterShopName}}
  131. </template>
  132. </el-table-column>
  133. <el-table-column align="center" property="apply_status_msg" label="状态"></el-table-column>
  134. <el-table-column align="center" property="address" label="操作">
  135. <template slot-scope="scope">
  136. <el-button type="text" size="small" @click="handleAccountDetail(scope.row,scope.row.accesser_user_id)"
  137. >查看</el-button
  138. >
  139. <el-button type="text" size="small" @click="handleAccountEdit(scope.row,scope.row.accesser_user_id)"
  140. >编辑</el-button
  141. >
  142. <el-button type="text" size="small" @click="handleAccountDel(scope.row.accesser_user_id)"
  143. >删除</el-button
  144. >
  145. </template>
  146. </el-table-column>
  147. </el-table>
  148. <div slot="footer" class="dialog-footer">
  149. <el-button @click="handleBind">从已有银联账号选择</el-button>
  150. <el-button @click="dialogTableVisible = false">关闭</el-button>
  151. <el-button type="primary" @click="handleAccountAdd">添加</el-button>
  152. </div>
  153. </el-dialog>
  154. <el-dialog title="从已有银联账号选择" width="500px" append-to-body :visible.sync="bindDialog">
  155. <el-form
  156. :model="setQuery"
  157. ref="setQuery"
  158. :rules="rules"
  159. label-width="130px"
  160. >
  161. <el-form-item label="营业名称:" prop="accesseId">
  162. <el-select
  163. v-model="setQuery.accesseId"
  164. class="item-width-300"
  165. filterable
  166. placeholder="请选择营业名称"
  167. >
  168. <el-option
  169. @click.native="choose(item.mer_no)"
  170. v-for="item in accountList"
  171. :key="item.value"
  172. :label="item.label"
  173. :value="item.value"
  174. >
  175. </el-option>
  176. </el-select>
  177. </el-form-item>
  178. <el-form-item label="银联商户号:">
  179. <el-input
  180. v-model="mer_no"
  181. size="small"
  182. class="item-width-300"
  183. disabled
  184. ></el-input>
  185. </el-form-item>
  186. </el-form>
  187. <div slot="footer" class="dialog-footer">
  188. <el-button @click="bindDialog = false">取消</el-button>
  189. <el-button type="primary" :loading='btnLoading' @click="submit">确定</el-button>
  190. </div>
  191. </el-dialog>
  192. </div>
  193. </template>
  194. <script>
  195. import {debounce} from '@/utils/index';
  196. import { getList,getShopType,delAccount,allFinish,bindComplex } from '@/api/user'
  197. import { complexList,deleteComplex} from '@/api/payment';
  198. export default {
  199. name: "shopManage",
  200. data() {
  201. return {
  202. that:this,
  203. tableData: [],
  204. accountData:[],
  205. options: [],
  206. loading: false,
  207. loading1: false,
  208. btnLoading: false,
  209. dialogTableVisible:false,
  210. bindDialog:false,
  211. accountId:'',//当前弹框的主体id
  212. platformType:'',//平台类型
  213. query: {
  214. platformType:null,
  215. shopName: "",
  216. currentPage: 1,
  217. pageSize: 10,
  218. },
  219. total: 0,
  220. mer_no:'',//银联账号
  221. accountList:[],
  222. setQuery:{
  223. epId:'',
  224. accesseId:''
  225. },
  226. rules: {
  227. accesseId: [{ required: true, message: "请选择营业名称", trigger: "chenge" }],
  228. }
  229. };
  230. },
  231. watch: {
  232. platformType(val) {
  233. if(val.length){
  234. this.query.platformType = val.join(',')
  235. }else{
  236. this.query.platformType = null
  237. }
  238. }
  239. },
  240. filters: {
  241. filterType: function(val,that) {
  242. let msg
  243. that.options.map(item=>{
  244. if(item.value == val){
  245. msg = item.label
  246. }
  247. })
  248. return msg
  249. },
  250. filterShopName(val){
  251. if(val){
  252. let list = val.split(",")
  253. let arr = []
  254. list.map(item=>{
  255. if(item == '89852017372911Y中数'){
  256. arr.push('慧研学惠生活')
  257. }else if(item == '89852017372912Y贵大'){
  258. arr.push('印象贵大')
  259. }else if(!arr.length){
  260. arr.push('无')
  261. }
  262. })
  263. arr = arr.join()
  264. return arr
  265. }else{
  266. return '无'
  267. }
  268. },
  269. },
  270. methods: {
  271. choose(val){
  272. this.mer_no = val
  273. },
  274. handleBind(){
  275. this.bindDialog = true
  276. this.allFinish()
  277. this.setQuery.accesseId = ''
  278. },
  279. handleSearch(){
  280. this.query.currentPage = 1
  281. this.getList();
  282. },
  283. handleAccountAdd(){
  284. this.$router.push({path:"/operationManage/shopManage/shopType",query:{id:this.accountId,mode:'add'}});
  285. },
  286. handleAccountDetail(row,accesseId){
  287. let type
  288. if(row.reg_mer_type == '02'){
  289. type = 1
  290. }else if(row.reg_mer_type == '01'){
  291. type = 2
  292. }else if(row.reg_mer_type == '00'){
  293. type = 3
  294. }else if(row.reg_mer_type == '03'){
  295. type = 4
  296. }
  297. this.$router.push({path:"/operationManage/shopManage/shopAdd"+type,query:{id:this.accountId,accesseId,mode:'detail'}});
  298. },
  299. handleAccountEdit(row,accesseId){
  300. let type
  301. if(row.reg_mer_type == '02'){
  302. type = 1
  303. }else if(row.reg_mer_type == '01'){
  304. type = 2
  305. }else if(row.reg_mer_type == '00'){
  306. type = 3
  307. }else if(row.reg_mer_type == '03'){
  308. type = 4
  309. }
  310. this.$router.push({path:"/operationManage/shopManage/shopAdd"+type,query:{id:this.accountId,accesseId,mode:'edit'}});
  311. },
  312. handleAccountDel(accesseId){
  313. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  314. confirmButtonText: '确定',
  315. cancelButtonText: '取消',
  316. type: 'warning'
  317. }).then(() => {
  318. this.deleteComplex(this.accountId,accesseId)
  319. })
  320. },
  321. handleAdd() {
  322. this.$router.push("/merchantManage/addUser");
  323. },
  324. handleDel(accountId){
  325. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  326. confirmButtonText: '确定',
  327. cancelButtonText: '取消',
  328. type: 'warning'
  329. }).then(() => {
  330. delAccount({accountId}).then(res=>{
  331. if(res.state == 'Success'){
  332. this.$notify({
  333. title: '成功',
  334. message: '操作成功',
  335. type: 'success'
  336. });
  337. this.query.currentPage = 1
  338. this.getList()
  339. }
  340. })
  341. })
  342. },
  343. handle(id,type) {
  344. this.accountId = id
  345. this.setQuery.epId = id
  346. this.dialogTableVisible = true
  347. this.complexList(id)
  348. // if(type == 302){//入驻商户
  349. // this.dialogTableVisible = true
  350. // this.complexList(id)
  351. // }else{
  352. // }
  353. },
  354. handleEdit(row) {
  355. sessionStorage.setItem('shopUser',JSON.stringify(row))
  356. this.$router.push({
  357. path:"/merchantManage/addUser",
  358. query:{
  359. id:row.accountId,
  360. title:'编辑商户'
  361. }
  362. });
  363. },
  364. handleSizeChange(val) {
  365. this.query.currentPage = 1;
  366. this.query.pageSize = val;
  367. this.getList()
  368. },
  369. handleCurrentChange(val) {
  370. this.query.currentPage = val;
  371. this.getList()
  372. },
  373. getList(){
  374. this.loading = true;
  375. getList(this.query).then(res=>{
  376. this.loading = false;
  377. if(res.state == 'Success'){
  378. this.tableData = res.content.records
  379. this.total = res.content.total
  380. }
  381. })
  382. },
  383. getShopType() {
  384. getShopType().then((res) => {
  385. if (res.state == "Success") {
  386. for (const key in res.content) {
  387. if (Object.hasOwnProperty.call(res.content, key)) {
  388. this.options.push({
  389. value: key,
  390. label: res.content[key],
  391. });
  392. }
  393. }
  394. }
  395. });
  396. },
  397. complexList(epId){
  398. this.loading1 = true
  399. complexList({
  400. "accesseId": "",
  401. "epId": epId
  402. }).then(res=>{
  403. this.loading1 = false
  404. if (res.state == "Success") {
  405. this.accountData = res.content
  406. }
  407. })
  408. },
  409. deleteComplex(epId,accesseId){
  410. deleteComplex({
  411. accesseId,
  412. epId
  413. }).then(res=>{
  414. if (res.state == "Success") {
  415. this.$notify({
  416. title: '成功',
  417. message: '操作成功',
  418. type: 'success'
  419. });
  420. this.complexList(epId)
  421. }
  422. })
  423. },
  424. // 获取所有的已认证银联号
  425. allFinish() {
  426. allFinish().then((res) => {
  427. if (res.state == "Success") {
  428. res.content.map(item=>{
  429. this.accountList.push({
  430. label:item.shop_name||item.accesser_user_id,
  431. value:item.accesser_user_id,
  432. mer_no:item.mer_no,
  433. })
  434. })
  435. }
  436. });
  437. },
  438. submit(){
  439. this.$refs.setQuery.validate((v) => {
  440. if (v) {
  441. this.btnLoading = true
  442. bindComplex(this.setQuery).then(res=>{
  443. this.btnLoading = false
  444. if (res.state == "Success") {
  445. this.bindDialog = false
  446. this.complexList(this.accountId)
  447. this.$notify({
  448. title: '成功',
  449. message: '操作成功',
  450. type: 'success'
  451. });
  452. }
  453. })
  454. }
  455. })
  456. }
  457. },
  458. created() {
  459. this.getList()
  460. this.getShopType()
  461. },
  462. };
  463. </script>
  464. <style lang="scss" scoped>
  465. .shopManage {
  466. .search {
  467. justify-content: space-between;
  468. .add-btn {
  469. // margin-right: 20px;
  470. }
  471. }
  472. }
  473. </style>