Rap 原分销系统代码Web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6e070056e47792a10a7ddbfca30dab3d60b551f2.svn-base 23KB

преди 5 месеца
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. <template>
  2. <div class="app-container">
  3. <div style="margin-bottom:10px">
  4. <el-button type="success" @click="addBtn">新增</el-button>
  5. <el-button type="success" @click="importBtn">导入</el-button>
  6. <el-button type="success" @click="exportTempBtn">模版下载</el-button>
  7. </div>
  8. <!--搜索-->
  9. <el-form class="mt_15" ref="form" inline size="small">
  10. <el-form-item label="卡号">
  11. <el-input v-model.trim="searchParm.number" clearable placeholder='账号'></el-input>
  12. </el-form-item>
  13. <!--<el-form-item label="PIN">
  14. <el-input v-model.trim="searchParm.pinNumber" clearable></el-input>
  15. </el-form-item>-->
  16. <el-form-item label="持卡人名称">
  17. <el-input v-model.trim="searchParm.holderName" clearable></el-input>
  18. </el-form-item>
  19. <el-form-item label="类型">
  20. <el-select v-model.trim="searchParm.type" placeholder="请选择">
  21. <el-option
  22. v-for="item in typeList"
  23. :key="item.name"
  24. :label="item.name"
  25. :value="item.id">
  26. </el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="卡商">
  30. <el-select v-model.trim="searchParm.cardDealer" placeholder="请选择">
  31. <el-option
  32. v-for="item in dealerList"
  33. :key="item.name"
  34. :label="item.name"
  35. :value="item.id">
  36. </el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item label="状态">
  40. <el-select v-model.trim="searchParm.status" placeholder="请选择">
  41. <el-option
  42. v-for="item in statusList"
  43. :key="item.name"
  44. :label="item.name"
  45. :value="item.id">
  46. </el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="primary" @click="goSearch">搜索</el-button>
  51. <el-button type="warning" @click="resetForm">重置</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <!--表格渲染-->
  55. <el-table ref="table" border size="small" :data="list" :header-cell-style="{textAlign:'center'}">
  56. <el-table-column label="序号" type="index" width="50" align="center"/>
  57. <el-table-column label="卡号" prop="number" align="center"/>
  58. <!--<el-table-column label="PIN码" prop="pinNumber" align="center"/>-->
  59. <el-table-column label="持卡人姓氏" prop="holderSurname" align="center"/>
  60. <el-table-column label="持卡人名称" prop="holderName" align="center"/>
  61. <el-table-column label="所属厂商" prop="cardDealer" align="center">
  62. <template slot-scope="scope">
  63. {{ scope.row.cardDealer | getCardDealer}}
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="类型" prop="type" align="center">
  67. <template slot-scope="scope">
  68. {{ scope.row.type | getType}}
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="状态" prop="status" align="center">
  72. <template slot-scope="scope">
  73. {{ scope.row.status | getStatus}}
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="创建时间" prop="createdAt" align="center"/>
  77. <el-table-column label="修改时间" prop="updatedAt" align="center"/>
  78. <el-table-column label="操作" width="270" align="left" >
  79. <template slot-scope="scope">
  80. <el-button type="info" @click="getBtnById(scope.row.id)">查看</el-button>
  81. <el-button type="warning" @click="editById(scope.row)" style="margin-left: 0px">修改</el-button>
  82. <span v-if="scope.row.status != 2" slot="footer">
  83. <el-button type="danger" @click="abNormalById(scope.row.id)">异常</el-button>
  84. </span>
  85. <span v-if="scope.row.status != 3" slot="footer">
  86. <el-button type="danger" @click="delById(scope.row.id)">删除</el-button>
  87. </span>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. <!--分页-->
  92. <div class="mt_15">
  93. <el-pagination
  94. @size-change="handleSizeChange"
  95. @current-change="handleCurrentChange"
  96. :current-page="searchParm.page"
  97. :page-sizes="[10, 20, 30, 40, 50]"
  98. :page-size="searchParm.pageSize"
  99. layout="total, sizes, prev, pager, next, jumper"
  100. :total="total">
  101. </el-pagination>
  102. </div>
  103. <!--新增弹窗-->
  104. <el-dialog :visible.sync="dialogAddVisible" :title="dialogAddTitle" center width="45%">
  105. <div class="dialog-content">
  106. <el-form ref="addParm" size="small" :model="addParm" :rules="rules" label-width="100px">
  107. <el-form-item label="卡号" prop="number">
  108. <el-input v-model.trim="addParm.number" clearable></el-input>
  109. </el-form-item>
  110. <!--<el-form-item label="PIN码" prop="pinNumber">
  111. <el-input v-model.trim="addParm.pinNumber" clearable></el-input>
  112. </el-form-item>-->
  113. <el-form-item label="持卡人姓氏" prop="holderSurname">
  114. <el-input v-model.trim="addParm.holderSurname" clearable></el-input>
  115. </el-form-item>
  116. <el-form-item label="持卡人名称" prop="holderName">
  117. <el-input v-model.trim="addParm.holderName" clearable></el-input>
  118. </el-form-item>
  119. <el-form-item label="所属国家" prop="contntryShort">
  120. <el-input v-model.trim="addParm.contntryShort" clearable></el-input>
  121. </el-form-item>
  122. <el-form-item label="有效期" prop="termOfValidity">
  123. <div class="block">
  124. <el-date-picker
  125. v-model="addParm.termOfValidity"
  126. align="right"
  127. type="date"
  128. format='yyyy-MM-dd'
  129. value-format='yyyy-MM-dd'
  130. placeholder="选择日期"
  131. :picker-options="pickerOptions">
  132. </el-date-picker>
  133. </div>
  134. </el-form-item>
  135. <el-form-item label="卡商" prop="cardDealer">
  136. <el-select v-model.trim="addParm.cardDealer" placeholder="请选择">
  137. <el-option
  138. v-for="item in addDealerList"
  139. :key="item.name"
  140. :label="item.name"
  141. :value="item.id">
  142. </el-option>
  143. </el-select>
  144. </el-form-item>
  145. <el-form-item label="类型" prop="type">
  146. <el-select v-model="addParm.type" placeholder="请选择">
  147. <el-option
  148. v-for="item in addTypeList"
  149. :key="item.name"
  150. :label="item.name"
  151. :value="item.id">
  152. </el-option>
  153. </el-select>
  154. </el-form-item>
  155. <el-form-item label="密码" prop="pwd">
  156. <el-input v-model.trim="addParm.pwd" clearable></el-input>
  157. </el-form-item>
  158. <el-form-item label="备注" prop="remarks">
  159. <el-input v-model.trim="addParm.remarks" clearable></el-input>
  160. </el-form-item>
  161. </el-form>
  162. </div>
  163. <span slot="footer">
  164. <el-button type="info" @click="sureAddCancle('addParm')">取消</el-button>
  165. <el-button type="primary" @click="sureAdd('addParm')">确认</el-button>
  166. </span>
  167. </el-dialog>
  168. <!--导入 importBtn-->
  169. <el-dialog :visible.sync="dialogImportVisible" :title="dialogImportTitle" center width="22%">
  170. <div class="dialog-content">
  171. <el-upload
  172. class="upload-demo"
  173. drag
  174. ref="upload"
  175. :action="uploadFileUrl"
  176. :headers="uploadHeaders"
  177. :show-file-list = "false"
  178. :on-success="uploadSuccess"
  179. :before-upload="beforeAvatarUpload"
  180. multiple>
  181. <i class="el-icon-upload"></i>
  182. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  183. <div class="el-upload__tip" slot="tip">只能上传xlsl文件,且不超过10M</div>
  184. </el-upload>
  185. </div>
  186. </el-dialog>
  187. <!--修改弹窗-->
  188. <el-dialog :visible.sync="dialogEditVisible" :title="dialogEditTitle" center width="45%">
  189. <div class="dialog-content">
  190. <el-form ref="editParm" size="small" :model="editParm" :rules="rules" label-width="100px">
  191. <el-form-item label="卡号" prop="number">
  192. <el-input v-model.trim="editParm.number" clearable></el-input>
  193. </el-form-item>
  194. <!--<el-form-item label="PIN码" prop="pinNumber">
  195. <el-input v-model.trim="editParm.pinNumber" clearable></el-input>
  196. </el-form-item>-->
  197. <el-form-item label="持卡人姓氏" prop="holderSurname">
  198. <el-input v-model.trim="editParm.holderSurname" clearable></el-input>
  199. </el-form-item>
  200. <el-form-item label="持卡人名称" prop="holderName">
  201. <el-input v-model.trim="editParm.holderName" clearable></el-input>
  202. </el-form-item>
  203. <el-form-item label="有效期" prop="termOfValidity">
  204. <div class="block">
  205. <el-date-picker
  206. v-model="editParm.termOfValidity"
  207. align="right"
  208. type="date"
  209. format='yyyy-MM-dd'
  210. value-format='yyyy-MM-dd'
  211. placeholder="选择日期"
  212. :picker-options="pickerOptions">
  213. </el-date-picker>
  214. </div>
  215. </el-form-item>
  216. <el-form-item label="所属国家" prop="contntryShort">
  217. <el-input v-model.trim="editParm.contntryShort" clearable></el-input>
  218. </el-form-item>
  219. <el-form-item label="类型" prop="type">
  220. <el-select v-model.trim="editParm.type" placeholder="请选择">
  221. <el-option
  222. v-for="item in addTypeList"
  223. :key="item.name"
  224. :label="item.name"
  225. :value="item.id">
  226. </el-option>
  227. </el-select>
  228. </el-form-item>
  229. <el-form-item label="厂商" prop="cardDealer">
  230. <el-select v-model.trim="editParm.cardDealer" placeholder="请选择">
  231. <el-option
  232. v-for="item in addDealerList"
  233. :key="item.name"
  234. :label="item.name"
  235. :value="item.id">
  236. </el-option>
  237. </el-select>
  238. </el-form-item>
  239. <el-form-item label="密码" prop="pwd">
  240. <el-input v-model.trim="editParm.pwd" clearable></el-input>
  241. </el-form-item>
  242. <el-form-item label="备注" prop="remarks">
  243. <el-input v-model.trim="editParm.remarks" clearable></el-input>
  244. </el-form-item>
  245. </el-form>
  246. </div>
  247. <span slot="footer">
  248. <el-button type="info" @click="sureEditCancle('editParm')">取消</el-button>
  249. <el-button type="primary" @click="sureEdit('editParm')">确认</el-button>
  250. </span>
  251. </el-dialog>
  252. <!--详情弹窗-->
  253. <el-dialog :visible.sync="dialogDetailVisible" :title="dialogDetailTitle" center width="45%">
  254. <div class="dialog-content">
  255. <el-form ref="form" size="small" label-width="100px">
  256. <el-form-item label="卡号" prop="number" >
  257. <el-input v-model.trim="detailParm.number" :disabled="true"></el-input>
  258. </el-form-item>
  259. <!--<el-form-item label="PIN号码" prop="pinNumber">
  260. <el-input v-model.trim="detailParm.pinNumber" :disabled="true"></el-input>
  261. </el-form-item>-->
  262. <el-form-item label="持卡人姓氏" prop="holderSurname">
  263. <el-input v-model.trim="detailParm.holderSurname" :disabled="true"></el-input>
  264. </el-form-item>
  265. <el-form-item label="持卡人名称" prop="holderName">
  266. <el-input v-model.trim="detailParm.holderName" :disabled="true"></el-input>
  267. </el-form-item>
  268. <el-form-item label="有效期" prop="termOfValidity">
  269. <div class="block">
  270. <el-date-picker
  271. v-model="detailParm.termOfValidity"
  272. align="right"
  273. type="date"
  274. placeholder="选择日期"
  275. :disabled="true"
  276. :picker-options="pickerOptions">
  277. </el-date-picker>
  278. </div>
  279. </el-form-item>
  280. <el-form-item label="所属国家" prop="contntryShort">
  281. <el-input v-model.trim="detailParm.contntryShort" :disabled="true"></el-input>
  282. </el-form-item>
  283. <el-form-item label="所属厂商" disabled prop="cardDealer">
  284. <el-select v-model.trim="detailParm.cardDealer" disabled placeholder="请选择">
  285. <el-option
  286. v-for="item in addDealerList"
  287. :key="item.name"
  288. :label="item.name"
  289. :value="item.id">
  290. </el-option>
  291. </el-select>
  292. </el-form-item>
  293. <el-form-item label="类型" disabled prop="type">
  294. <el-select v-model.trim="detailParm.type" disabled placeholder="请选择">
  295. <el-option
  296. v-for="item in addTypeList"
  297. :key="item.name"
  298. :label="item.name"
  299. :value="item.id">
  300. </el-option>
  301. </el-select>
  302. </el-form-item>
  303. <el-form-item label="状态" disabled prop="status">
  304. <el-select v-model.trim="detailParm.status" disabled placeholder="请选择">
  305. <el-option
  306. v-for="item in addStatusList"
  307. :key="item.name"
  308. :label="item.name"
  309. :value="item.id">
  310. </el-option>
  311. </el-select>
  312. </el-form-item>
  313. <el-form-item label="备注" prop="remarks">
  314. <el-input v-model.trim="detailParm.remarks" :disabled="true"></el-input>
  315. </el-form-item>
  316. </el-form>
  317. </div>
  318. </el-dialog>
  319. </div>
  320. </template>
  321. <script>
  322. import { add, editById, delById, abMormal, getList, getById, downLoadFile } from '@/api/group/card'
  323. export default {
  324. filters: {
  325. getStatus: function (value) {
  326. if(value == 1) {
  327. return '正常';
  328. } else if (value == 2) {
  329. return '异常';
  330. } else {
  331. return '删除';
  332. }
  333. },
  334. getType: function (value) {
  335. if(value == 1) {
  336. return 'Payoneer';
  337. } else if (value == 2) {
  338. return '万事达虚拟卡';
  339. } else {
  340. return 'Visa信用卡';
  341. }
  342. },
  343. getCardDealer: function (value) {
  344. if(value == 1) {
  345. return 'AmzKeys';
  346. } else{
  347. return 'Airwallex';
  348. }
  349. }
  350. },
  351. // 数据
  352. data() {
  353. return {
  354. searchParm: {
  355. page: 1,
  356. pageSize: 10,
  357. sort:'created_at',
  358. order:'desc',
  359. cardDealer:'',
  360. type:'',
  361. status:'',
  362. holderName:null,
  363. number:null
  364. // pinNumber:null,
  365. },
  366. total:0,
  367. list: [],
  368. uploadHeaders:{ Authorization: this.$store.getters.token },
  369. dialogAddVisible: false,
  370. dialogAddTitle: '新增',
  371. dialogDetailVisible: false,
  372. dialogDetailTitle: '详情',
  373. dialogEditVisible: false,
  374. dialogEditTitle: '修改',
  375. dialogImportVisible: false,
  376. dialogImportTitle:'导入',
  377. uploadFileUrl: process.env.VUE_APP_BASE_API + '/api/ctCard/import',
  378. updateBoolean: false,
  379. tempUrl: process.env.VUE_APP_BASE_API + '/api/ctCard/exportTemp',
  380. typeList:[
  381. {
  382. id: null,
  383. name: '全部'
  384. },
  385. {
  386. id: 1,
  387. name: 'Payoneer'
  388. },
  389. {
  390. id: 2,
  391. name: '万事达虚拟卡'
  392. },
  393. {
  394. id: 3,
  395. name: 'Visa信用卡'
  396. }],
  397. dealerList:[
  398. {
  399. id: null,
  400. name: '全部'
  401. },
  402. {
  403. id: 1,
  404. name: 'AmzKeys'
  405. },
  406. {
  407. id: 2,
  408. name: 'Airwallex'
  409. }],
  410. addTypeList:[
  411. {
  412. id: 1,
  413. name: 'Payoneer'
  414. },
  415. {
  416. id: 2,
  417. name: '万事达虚拟卡'
  418. },
  419. {
  420. id: 3,
  421. name: 'Visa信用卡'
  422. }],
  423. addDealerList:[
  424. {
  425. id: 1,
  426. name: 'AmzKeys'
  427. },
  428. {
  429. id: 2,
  430. name: 'Airwallex'
  431. }],
  432. addStatusList:[
  433. {
  434. id: 1,
  435. name: '正常'
  436. },
  437. {
  438. id: 2,
  439. name: '异常',
  440. },
  441. {
  442. id: 3,
  443. name: '删除'
  444. }],
  445. statusList:[
  446. {
  447. id: null,
  448. name: '全部'
  449. },
  450. {
  451. id: 1,
  452. name: '正常'
  453. },
  454. {
  455. id: 2,
  456. name: '异常',
  457. },
  458. {
  459. id: 3,
  460. name: '删除'
  461. }],
  462. addParm: {
  463. id: null,
  464. termOfValidity:null,
  465. number:'',
  466. // pinNumber:'',
  467. holderSurname: '',
  468. holderName: '',
  469. contntryShort:'',
  470. remarks:'',
  471. type:null,
  472. cardDealer:null,
  473. pwd:''
  474. },
  475. editParm: {
  476. id: null,
  477. number:null,
  478. // pinNumber:null,
  479. holderSurname: null,
  480. holderName: null,
  481. termOfValidity: null,
  482. contntryShort: null,
  483. type:null,
  484. cardDealer:null,
  485. remarks:null,
  486. pwd:null
  487. },
  488. detailParm: {
  489. id: null,
  490. number:null,
  491. // pinNumber:null,
  492. holderName: null,
  493. holderSurname: null,
  494. remarks:null,
  495. status:null,
  496. type:null,
  497. cardDealer:null,
  498. termOfValidity: null
  499. },
  500. rules: {
  501. number: [
  502. { required: true, message: '请输入信用卡号', trigger: 'blur' },
  503. {pattern: /^\d{13,19}$/, message: "请输入13-19位信用卡号", trigger: "blur"}
  504. ],
  505. // pinNumber: [
  506. // { required: true, message: '请输入PIN码', trigger: 'blur' },
  507. // {pattern: /^\d{3}$/, message: "请输入3位PIN码", trigger: "blur"}
  508. // ],
  509. holderSurname: [
  510. {required: true, message: '请输入持卡人姓氏', trigger: 'blur' }
  511. ],
  512. holderName: [
  513. { required: true,message: '请输入持卡人名称', trigger: 'blur' }
  514. ],
  515. termOfValidity: [
  516. { required: true,message: '请选择有效期', trigger: 'blur' }
  517. ],
  518. contntryShort: [
  519. { required: true,message: '请输入所属国家', trigger: 'blur' }
  520. ],
  521. type: [
  522. {required: true, message: '请选择卡商', trigger: 'blur' }
  523. ],
  524. cardDealer: [
  525. { required: true,message: '请选择类型', trigger: 'blur' }
  526. ],
  527. pwd: [
  528. { required: true,message: '请输入密码', trigger: 'blur' }
  529. ]
  530. }
  531. }
  532. },
  533. // 调用
  534. created() {
  535. this.goSearch();
  536. },
  537. //方法
  538. methods: {
  539. //重置
  540. resetForm() {
  541. this.searchParm.cardDealer = null;
  542. this.searchParm.cardDealer='';
  543. this.searchParm.type='';
  544. this.searchParm.status='';
  545. this.searchParm.holderName=null;
  546. this.searchParm.number=null;
  547. // this.searchParm.pinNumber=null;
  548. this.goSearch()
  549. },
  550. // 查询
  551. goSearch() {
  552. this.searchParm.page=1
  553. this.getDataList()
  554. },
  555. beforeAvatarUpload(file) {
  556. console.log(file);
  557. // const isXlsl = file.type === 'xlsl';
  558. const isLt10M = file.size / 1024 / 1024 <10;
  559. // if (!isXlsl) {
  560. // this.$message.error('上传头像图片只能是 xlsl 格式!');
  561. // }
  562. if (!isLt10M) {
  563. this.$message.error('上传头像图片大小不能超过 10MB!');
  564. }
  565. // return isXlsl && isLt10M;
  566. return isLt10M;
  567. },
  568. uploadSuccess(res, file) {
  569. this.dialogImportVisible = false;
  570. if(res.code==200) {
  571. console.log(res.data);
  572. this.$message.success('导入成功!');
  573. if(res.data != null) {
  574. window.location.href = res.data;
  575. }
  576. }
  577. this.getDataList();
  578. },
  579. // 新增
  580. addBtn(){
  581. this.addParm = {
  582. id: null,
  583. termOfValidity: null,
  584. number: null,
  585. // pinNumber: null,
  586. holderSurname: null,
  587. holderName: null,
  588. contntryShort: null,
  589. remarks: null,
  590. type:null,
  591. cardDealer:null,
  592. pwd: null
  593. }
  594. this.dialogAddVisible = true;
  595. this.$refs.addParm.clearValidate();
  596. },
  597. // 导入
  598. importBtn() {
  599. this.dialogImportVisible = true
  600. },
  601. exportTempBtn() {
  602. console.log(this.tempUrl)
  603. window.location.href = this.tempUrl;
  604. },
  605. // 根据id删除
  606. delById(id){
  607. this.$confirm('确认删除?','提示',{
  608. confirmButtonText: '确定',
  609. cancelButtonText: '取消',
  610. type: 'warning'
  611. }).then(() => {
  612. delById({id}).then(res => {
  613. if(res.code==200) {
  614. this.$message.success('删除成功!')
  615. this.getDataList()
  616. }
  617. }).catch(err => {
  618. console.log(err)
  619. })
  620. }).catch(() => {
  621. this.$message.info('取消删除')
  622. })
  623. },
  624. // 根据id 设置状态异常
  625. abNormalById(id){
  626. this.$confirm('确认状态修改为异常?','提示',{
  627. confirmButtonText: '确定',
  628. cancelButtonText: '取消',
  629. type: 'warning'
  630. }).then(() => {
  631. abMormal({id}).then(res => {
  632. if(res.code==200) {
  633. this.$message.success('修改异常状态成功!')
  634. this.getDataList()
  635. }
  636. }).catch(err => {
  637. console.log(err)
  638. })
  639. }).catch(() => {
  640. this.$message.info('取消修改')
  641. })
  642. },
  643. // 修改
  644. editById(data){
  645. getById({id: data.id}).then(res => {
  646. if(res.code==200) {
  647. this.editParm.id = res.data.id;
  648. this.editParm.number = res.data.number;
  649. // this.editParm.pinNumber = res.data.pinNumber;
  650. this.editParm.holderSurname = res.data.holderSurname;
  651. this.editParm.holderName = res.data.holderName;
  652. this.editParm.termOfValidity = res.data.termOfValidity;
  653. this.editParm.contntryShort = res.data.contntryShort;
  654. this.editParm.type = res.data.type;
  655. this.editParm.cardDealer = res.data.cardDealer;
  656. this.editParm.remarks = res.data.remarks;
  657. this.editParm.pwd = res.data.pwd;
  658. this.dialogEditVisible = true;
  659. this.$refs.editParm.clearValidate();
  660. }
  661. }).catch(err => {
  662. console.log(err)
  663. })
  664. },
  665. // 确认修改
  666. sureEdit(editParm){
  667. this.$refs.editParm.validate((valid) => {
  668. if (valid) {
  669. this.$refs.editParm.clearValidate();
  670. editById(this.editParm).then(res => {
  671. if(res.code==200) {
  672. this.dialogEditVisible = false
  673. this.$message.success('修改成功!')
  674. this.getDataList()
  675. }
  676. }).catch(err => {
  677. console.log(err)
  678. })
  679. } else {
  680. console.log('error submit!!');
  681. return false;
  682. }
  683. });
  684. },
  685. sureEditCancle(editParm){
  686. this.dialogEditVisible=flase
  687. this.$refs.editParm.clearValidate();
  688. },
  689. // 确认新增
  690. sureAdd(addParm){
  691. this.$refs[addParm].validate((valid) => {
  692. if (valid) {
  693. this.$refs.addParm.clearValidate();
  694. add(this.addParm).then(res => {
  695. if(res.code==200) {
  696. this.dialogAddVisible = false
  697. this.$message.success('新增成功!')
  698. this.getDataList()
  699. }
  700. }).catch(err => {
  701. console.log(err)
  702. })
  703. } else {
  704. console.log('error submit!!');
  705. return false;
  706. }
  707. });
  708. },
  709. sureAddCancle(addParm){
  710. this.dialogAddVisible=flase
  711. this.$refs.addParm.clearValidate();
  712. },
  713. // 查看根据id
  714. getBtnById(id){
  715. getById({id}).then(res => {
  716. if(res.code==200) {
  717. this.detailParm.id = res.data.id;
  718. this.detailParm.holderName = res.data.holderName;
  719. this.detailParm.holderSurname = res.data.holderSurname;
  720. this.detailParm.number = res.data.number;
  721. // this.detailParm.pinNumber = res.data.pinNumber;
  722. this.detailParm.type = res.data.type;
  723. this.detailParm.contntryShort = res.data.contntryShort;
  724. this.detailParm.status = res.data.status;
  725. this.detailParm.cardDealer = res.data.cardDealer;
  726. this.detailParm.termOfValidity = res.data.termOfValidity;
  727. this.dialogDetailVisible = true
  728. }
  729. }).catch(err => {
  730. console.log(err)
  731. })
  732. },
  733. // 分页获取表格数据
  734. getDataList(){
  735. getList(this.searchParm).then(res => {
  736. if(res.code==200) {
  737. this.list = res.data.list;
  738. this.total = res.data.total;
  739. }
  740. }).catch(err => {
  741. console.log(err)
  742. })
  743. },
  744. // 分页
  745. handleSizeChange(val) {
  746. console.log(`每页 ${val} 条`);
  747. this.searchParm.pageSize = val;
  748. this.getDataList();
  749. },
  750. handleCurrentChange(val) {
  751. console.log(`当前页: ${val}`);
  752. this.searchParm.page = val;
  753. this.getDataList();
  754. }
  755. }
  756. }
  757. </script>
  758. <style rel="stylesheet/scss" lang="scss" scoped>
  759. </style>