index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <div class="app-container" v-loading="loading">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >
  4. <el-form-item label="人员名称" prop="name">
  5. <el-input
  6. v-model.trim="queryParams.name"
  7. placeholder="请输入人员名称"
  8. clearable
  9. size="medium"
  10. style="width: 150px"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="手机号" prop="phone">
  15. <el-input
  16. v-model.trim="queryParams.phone"
  17. placeholder="请输入手机号"
  18. clearable
  19. size="medium"
  20. style="width: 140px"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item label="卡号" prop="card">
  25. <el-input
  26. v-model.trim="queryParams.card"
  27. placeholder="请输入卡号"
  28. clearable
  29. size="medium"
  30. style="width: 140px"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  36. <!-- <el-upload
  37. ref="upload"
  38. class="upload-demo"
  39. action="#"
  40. :limit = 1
  41. :on-change="handleChange"
  42. :auto-upload="false"
  43. accept=".xlsx,.xls"
  44. style="display:inline-block;margin-left:10px;vertical-align: top;"
  45. >
  46. <el-button size="mini" type="primary">上传充值文件</el-button>
  47. </el-upload> -->
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  51. <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  52. <el-button type="primary" icon="el-icon-refresh" size="mini" @click="synchroPersonnel">人员信息同步</el-button>
  53. <el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="batchChange(1)">批量绑定</el-button>
  54. <el-button type="warning" icon="el-icon-remove-outline" size="mini" @click="batchChange(0)">批量解除</el-button>
  55. </el-form-item>
  56. </el-form>
  57. <el-table :data="adminList" @selection-change="handleSelectionChange" height="calc(100vh - 10vh - 120px)">
  58. <el-table-column type="selection" width="50" align="center" />
  59. <el-table-column label="id" align="center" prop="id" show-overflow-tooltip />
  60. <el-table-column label="人员名称" align="center" prop="name" show-overflow-tooltip />
  61. <el-table-column label="部门" align="center" prop="dept" show-overflow-tooltip />
  62. <!-- <el-table-column label="人员信息" align="center" prop="identity" show-overflow-tooltip /> -->
  63. <el-table-column label="手机号" align="center" prop="contacts" show-overflow-tooltip />
  64. <el-table-column label="卡号" align="center" prop="cardId" show-overflow-tooltip />
  65. <el-table-column label="余额(元)" align="center" prop="balance" show-overflow-tooltip />
  66. <el-table-column label="充值到账比例" align="center" prop="proportion" show-overflow-tooltip />
  67. <el-table-column label="创建时间" align="center" prop="createTime" show-overflow-tooltip />
  68. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  69. <template slot-scope="scope">
  70. <el-button
  71. size="mini"
  72. type="text"
  73. icon="el-icon-link"
  74. @click="radio(scope.row)"
  75. v-hasPermi="['recharge:role:wz']"
  76. >微信、支付宝充值</el-button>
  77. <el-button
  78. size="mini"
  79. type="text"
  80. icon="el-icon-link"
  81. @click="cash(scope.row)"
  82. v-hasPermi="['recharge:role:x']"
  83. >现金</el-button>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. <!-- 添加或修改参数配置对话框 -->
  88. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body :before-close="cancel" :close-on-click-modal="false" >
  89. <el-form ref="queryParams" :model="queryParams" :rules="rules" label-width="120px" >
  90. <el-form-item label="到账比例:" prop="id">
  91. <el-select v-model="queryParams.id" style="width: 240px" placeholder="请选择到账比例" clearable size="small" >
  92. <el-option :label="`${item.identity}:${item.proportion}`" :value="item.id" v-for="(item, index) in radioList" :key="index" />
  93. </el-select>
  94. </el-form-item>
  95. </el-form>
  96. <div slot="footer" class="dialog-footer">
  97. <el-button type="primary" @click="submitForm" v-if="!loading">确 定</el-button>
  98. <el-button :loading="loading" type="primary" @click="submitForm" v-else>提交中...</el-button>
  99. <el-button @click="cancel">取 消</el-button>
  100. </div>
  101. </el-dialog>
  102. <pagination
  103. v-show="total>0"
  104. :total="total"
  105. :page.sync="queryParams.current"
  106. :limit.sync="queryParams.size"
  107. @pagination="getList"
  108. />
  109. </div>
  110. </template>
  111. <script>
  112. import { listChannel, personJob, staff } from "@/api/recharge/personnel";
  113. import { uploadFile } from "@/api/system/product";
  114. import { allRadio } from "@/api/recharge/radio";
  115. export default {
  116. name: "admin",
  117. data() {
  118. return {
  119. // 遮罩层
  120. loading: true,
  121. // 导出遮罩层
  122. exportLoading: false,
  123. dialogFormVisible:false,
  124. // 选中数组id
  125. ids: [],
  126. // 非单个禁用
  127. single: true,
  128. // 非多个禁用
  129. multiple: true,
  130. // 显示搜索条件
  131. showSearch: true,
  132. // 总条数
  133. total: 0,
  134. // 参数表格数据
  135. adminList: [],
  136. // 弹出层标题
  137. title: "",
  138. // 是否显示弹出层
  139. open: false,
  140. // 类型数据字典
  141. typeOptions: [],
  142. // 日期范围
  143. dateRange: [],
  144. // 查询参数
  145. queryParams: {
  146. current: 1,
  147. size: 10,
  148. name: undefined,
  149. aliasName: undefined,
  150. startTime: undefined,
  151. endTime: undefined,
  152. identity: undefined,
  153. proportion: undefined,
  154. id:undefined,
  155. phone:undefined,
  156. card:undefined
  157. },
  158. // 表单参数
  159. form: {
  160. name:'',
  161. aliasName:''
  162. },
  163. // 到账比例
  164. radioList:[
  165. ],
  166. //批量到账比例处理
  167. staffList:[],
  168. // 表单校验
  169. rules: {
  170. id:[
  171. { required: true, message: "充值比例不能为空", trigger: "change"},
  172. ],
  173. },
  174. limit:100,
  175. num:0,
  176. // 文件显示
  177. fileList:[{"url":''}],
  178. };
  179. },
  180. created() {
  181. this.getList();
  182. this.getListczgl();
  183. },
  184. methods: {
  185. //上传文件
  186. handleChange(param){
  187. console.log(param)
  188. this.limit = 1
  189. this.num++
  190. if(this.num>1){
  191. this.num = 0
  192. return false
  193. }else{
  194. let data = new FormData()// FormData 对象
  195. data.append('file', param.raw)
  196. uploadFile(data).then(res=>{
  197. if(res.status == "SUCCESS"){
  198. this.msgSuccess('充值文件上传成功')
  199. this.$refs.upload.submit();
  200. }else{
  201. this.$message.error(res.msg)
  202. }
  203. })
  204. }
  205. },
  206. forceUpdate(){ //重置form
  207. this.form = JSON.parse(JSON.stringify(this.form));
  208. },
  209. /** 查询参数列表 */
  210. getList() {
  211. this.loading = true;
  212. listChannel(this.addDateRange(this.queryParams)).then(response => {
  213. this.adminList = response.data.records;
  214. for(let i =0;i<this.adminList.length;i++){
  215. this.adminList[i].dept = JSON.parse(this.adminList[i].dept).name
  216. }
  217. this.total = response.data.total;
  218. this.loading = false;
  219. }
  220. );
  221. },
  222. /** 获取充值管理的数据用于修改赋值 */
  223. getListczgl() {
  224. allRadio().then(response => {
  225. this.radioList = response.data.map(item=>{
  226. return {
  227. identity:item.identity,
  228. proportion:item.proportion,
  229. id:item.id
  230. }
  231. })
  232. });
  233. },
  234. // 取消按钮
  235. cancel() {
  236. this.open = false;
  237. this.reset();
  238. },
  239. // 表单重置
  240. reset() {
  241. this.form = {
  242. ids: undefined,
  243. name: undefined,
  244. aliasName: undefined,
  245. adminType: "Y",
  246. proportion:undefined,
  247. id:undefined
  248. };
  249. this.staffList = []
  250. this.resetForm("form");
  251. },
  252. // 同步人员信息
  253. synchroPersonnel(){
  254. if(this.queryParams.name){
  255. personJob({"blurry":this.queryParams.name}).then(response =>{
  256. this.getList();
  257. })
  258. localStorage.setItem("timeout","大于10s")
  259. this.msgSuccess('请在定时任务中人员信息中,选择点击更多--调度日志查询同步进度 ', 5000)
  260. this.$router.push({path:'/system/job/jobTaskIndex'})
  261. localStorage.setItem('personnel', 1)
  262. }else{
  263. this.$message.error('同步人员信息不能为空')
  264. }
  265. },
  266. /** 搜索按钮操作 */
  267. handleQuery() {
  268. this.queryParams.current = 1;
  269. this.getList();
  270. },
  271. /** 重置按钮操作 */
  272. resetQuery() {
  273. this.dateRange = [];
  274. this.resetForm("queryForm");
  275. this.handleQuery();
  276. },
  277. /** 微信支付宝充值跳转 */
  278. radio(row){
  279. this.$router.push({path:'userRecharge'})
  280. localStorage.setItem('chongzhi', JSON.stringify({"name":row.name,"proportion":row.proportion,"sid":row.sid,"contacts":row.contacts}))
  281. },
  282. /** 现金充值跳转 */
  283. cash(row){
  284. this.$router.push({path:'cash'})
  285. localStorage.setItem('chongzhi', JSON.stringify({"name":row.name,"proportion":row.proportion,"sid":row.sid,"contacts":row.contacts}))
  286. },
  287. // 多选框选中数据
  288. handleSelectionChange(selection) {
  289. this.ids = selection.map(item => item);
  290. this.single = selection.length != 1;
  291. this.multiple = !selection.length;
  292. },
  293. //批量处理
  294. batchChange(change){
  295. if(this.ids.length>0){
  296. if(change == "1"){
  297. this.open = true;
  298. this.title = "修改参数";
  299. }else{
  300. this.loading = true;
  301. this.staffList = this.ids.map(item=>{
  302. return {
  303. staffId:item.sid,
  304. radioId:item.radioId,
  305. delFlag:0
  306. }
  307. })
  308. staff(this.staffList).then(response =>{
  309. this.loading = false;
  310. this.msgSuccess('批量解绑完成')
  311. this.getList();
  312. }).catch(err=>{
  313. this.loading = false;
  314. })
  315. }
  316. }else{
  317. this.$message.error('请勾选需要批量处理充值到账比例人员信息')
  318. }
  319. },
  320. /** 提交按钮 */
  321. submitForm() {
  322. this.$refs["queryParams"].validate(valid => {
  323. if (valid) {
  324. if(this.queryParams.id){
  325. this.loading = true;
  326. this.staffList = this.ids.map(item=>{
  327. return {
  328. staffId:item.sid,
  329. radioId:this.queryParams.id,
  330. delFlag:1
  331. }
  332. })
  333. staff(this.staffList).then(response =>{
  334. this.loading = false;
  335. this.open = false;
  336. this.msgSuccess('批量绑定完成')
  337. this.getList();
  338. this.reset()
  339. }).catch(err=>{
  340. this.loading = false;
  341. })
  342. }
  343. }
  344. })
  345. },
  346. }
  347. };
  348. </script>
  349. <style lang="scss" >
  350. .el-select-dropdown__item.selected{
  351. font-weight: none !important;
  352. }
  353. </style>