index.vue 13 KB

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