index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="支付时间" prop="payTime">
  5. <el-date-picker v-model="dateRange" size="small" style="width: 205.4px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  6. </el-form-item>
  7. <el-form-item label="支付类型" prop="payType">
  8. <el-select v-model="queryParams.payType" placeholder="请选择支付类型" clearable size="small">
  9. <el-option
  10. v-for="dict in payTypeOptions"
  11. :key="dict.dictValue"
  12. :label="dict.dictLabel"
  13. :value="dict.dictValue"
  14. />
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item label="状态" prop="status">
  18. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  19. <el-option
  20. v-for="dict in statusOptions"
  21. :key="dict.dictValue"
  22. :label="dict.dictLabel"
  23. :value="dict.dictValue"
  24. />
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="业务类型" prop="businessType">
  28. <el-select v-model="queryParams.businessType" placeholder="请选择支付类型" clearable size="small">
  29. <el-option
  30. v-for="dict in businessTypeOptions"
  31. :key="dict.dictValue"
  32. :label="dict.dictLabel"
  33. :value="dict.dictValue"
  34. />
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item>
  38. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  39. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  40. </el-form-item>
  41. </el-form>
  42. <el-row :gutter="10" class="mb8">
  43. <el-col :span="1.5">
  44. <el-button
  45. type="warning"
  46. icon="el-icon-download"
  47. size="mini"
  48. @click="handleExport"
  49. v-hasPermi="['company:companyRecharge:export']"
  50. >导出</el-button>
  51. <el-button
  52. size="mini"
  53. type="primary"
  54. icon="el-icon-edit"
  55. @click="handleRecharge"
  56. v-hasPermi="['company:companyRecharge:Recharge']"
  57. >充值</el-button>
  58. <el-button
  59. size="mini"
  60. type="primary"
  61. icon="el-icon-edit"
  62. @click="handleRedRecharge"
  63. v-if="showRedPacket"
  64. v-hasPermi="['company:companyRecharge:Recharge']"
  65. >红包充值</el-button>
  66. </el-col>
  67. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  68. </el-row>
  69. <el-table height="500" border v-loading="loading" :data="companyRechargeList" @selection-change="handleSelectionChange">
  70. <el-table-column type="selection" width="55" align="center" />
  71. <el-table-column label="充值订单号" align="center" prop="rechargeNo" />
  72. <el-table-column label="企业" align="center" prop="companyName" />
  73. <el-table-column label="充值金额" align="center" prop="money" />
  74. <el-table-column label="支付类型" align="center" prop="payType" >
  75. <template slot-scope="scope">
  76. <el-tag prop="status" v-for="(item, index) in payTypeOptions" v-if="scope.row.payType==item.dictValue">{{item.dictLabel}}</el-tag>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="业务类型" align="center" prop="businessType">
  80. <template slot-scope="scope">
  81. <dict-tag :options="businessTypeOptions" :value="scope.row.businessType"/>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="凭证照片" align="center" prop="imgs" >
  85. <template slot-scope="scope">
  86. <div v-if="scope.row.imgs != null && scope.row.imgs != undefined && scope.row.imgs != ''">
  87. <el-image
  88. style="width: 80px; height: 80px"
  89. :src="scope.row.imgs.split(',')[0]"
  90. :preview-src-list="scope.row.imgs.split(',')">
  91. </el-image>
  92. <p style="margin: 0">({{scope.row.imgs.split(',').length}} 张)</p>
  93. </div>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="支付状态" align="center" prop="status" >
  97. <template slot-scope="scope">
  98. <el-tag prop="status" v-for="(item, index) in statusOptions" :type="scope.row.status==1?'success':'danger'" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="支付时间" align="center" prop="payTime" width="180">
  102. <template slot-scope="scope">
  103. <span>{{ parseTime(scope.row.payTime) }}</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="审核状态" align="center" prop="isAudit" >
  107. <template slot-scope="scope">
  108. <el-tag prop="isAudit" type="danger" v-if="scope.row.isAudit === -1">已驳回</el-tag>
  109. <el-tag prop="isAudit" type="warning" v-if="scope.row.isAudit === 0">待审核</el-tag>
  110. <el-tag prop="isAudit" type="success" v-if="scope.row.isAudit === 1">已审核</el-tag>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="审核时间" align="center" prop="auditTime" width="180">
  114. <template slot-scope="scope">
  115. <span>{{ parseTime(scope.row.auditTime) }}</span>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <pagination
  120. v-show="total>0"
  121. :total="total"
  122. :page.sync="queryParams.pageNum"
  123. :limit.sync="queryParams.pageSize"
  124. @pagination="getList"
  125. />
  126. <!-- 添加或修改充值对话框 -->
  127. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  128. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  129. <el-form-item label="企业ID" prop="companyId">
  130. <el-input v-model="form.companyId" placeholder="请输入企业ID" />
  131. </el-form-item>
  132. <el-form-item label="金额" prop="money">
  133. <el-input v-model="form.money" placeholder="请输入金额" />
  134. </el-form-item>
  135. <el-form-item label="充值订单号" prop="rechargeNo">
  136. <el-input v-model="form.rechargeNo" placeholder="请输入充值订单号" />
  137. </el-form-item>
  138. <el-form-item label="支付时间" prop="payTime">
  139. <el-date-picker clearable size="small" style="width: 200px"
  140. v-model="form.payTime"
  141. type="date"
  142. value-format="yyyy-MM-dd"
  143. placeholder="选择支付时间">
  144. </el-date-picker>
  145. </el-form-item>
  146. <el-form-item label="状态 0未支付 1已支付">
  147. <el-radio-group v-model="form.status">
  148. <el-radio label="1">请选择字典生成</el-radio>
  149. </el-radio-group>
  150. </el-form-item>
  151. </el-form>
  152. <div slot="footer" class="dialog-footer">
  153. <el-button type="primary" @click="submitForm">确 定</el-button>
  154. <el-button @click="cancel">取 消</el-button>
  155. </div>
  156. </el-dialog>
  157. <!-- 充值对话框 -->
  158. <el-dialog :title="recharge.title" :visible.sync="recharge.open" width="500px" append-to-body>
  159. <el-form ref="rechargeForm" :rules="rechargeRules" :model="rechargeForm" label-width="80px">
  160. <!-- <el-form-item label="公司" >-->
  161. <!-- <el-input v-model="rechargeForm.companyName" disabled />-->
  162. <!-- </el-form-item>-->
  163. <!-- <el-form-item label="余额" >-->
  164. <!-- <el-input v-model="rechargeForm.balance" disabled />-->
  165. <!-- </el-form-item>-->
  166. <el-form-item label="充值金额" prop="money">
  167. <el-input-number v-model="rechargeForm.money" :min="0" placeholder="请输入充值金额" />
  168. </el-form-item>
  169. <el-form-item label="凭证" prop="imgs">
  170. <image-upload v-model="rechargeForm.imgs" :limit="9" />
  171. </el-form-item>
  172. <el-form-item label="备注" prop="remark">
  173. <el-input v-model="rechargeForm.remark" placeholder="请输入备注" />
  174. </el-form-item>
  175. </el-form>
  176. <div slot="footer" class="dialog-footer">
  177. <el-button type="primary" @click="submitRechargeForm">确 定</el-button>
  178. <el-button @click="recharge.open=false">取 消</el-button>
  179. </div>
  180. </el-dialog>
  181. <!-- 红包充值对话框 -->
  182. <el-dialog :title="redRecharge.title" :visible.sync="redRecharge.open" width="500px" append-to-body>
  183. <el-form ref="redRechargeForm" :rules="redRechargeRules" :model="redRechargeForm" label-width="80px">
  184. <el-form-item label="公司">
  185. <el-input v-model="redRechargeForm.companyName" disabled/>
  186. </el-form-item>
  187. <el-form-item label="余额">
  188. <el-input v-model="redRechargeForm.balance" disabled/>
  189. </el-form-item>
  190. <el-form-item label="充值金额" prop="money">
  191. <el-input-number v-model="redRechargeForm.money" :min="0.01" placeholder="请输入充值金额"/>
  192. </el-form-item>
  193. <el-form-item label="凭证" prop="imgs">
  194. <image-upload v-model="redRechargeForm.imgs" :limit="9" />
  195. </el-form-item>
  196. <el-form-item label="备注" prop="remark">
  197. <el-input v-model="redRechargeForm.remark" placeholder="请输入备注"/>
  198. </el-form-item>
  199. </el-form>
  200. <div slot="footer" class="dialog-footer">
  201. <el-button type="primary" @click="submitRedRechargeForm" :disabled="redSubmit">确 定</el-button>
  202. <el-button @click="redRecharge.open=false">取 消</el-button>
  203. </div>
  204. </el-dialog>
  205. </div>
  206. </template>
  207. <script>
  208. import { listCompanyRecharge, getCompanyRecharge, delCompanyRecharge, addCompanyRecharge, updateCompanyRecharge, exportCompanyRecharge, recharge, redRecharge, getCompanyRedPacketBalance } from "@/api/company/companyRecharge";
  209. import { getInfo } from '@/api/login';
  210. import { getConfigByKey } from '@/api/company/companyConfig'
  211. export default {
  212. name: "CompanyRecharge",
  213. data() {
  214. return {
  215. // 业务类型 0-普通 1-红包充值
  216. businessTypeOptions:[],
  217. showRedPacket: false,
  218. payTypeOptions:[],
  219. statusOptions:[],
  220. // 遮罩层
  221. loading: true,
  222. // 选中数组
  223. ids: [],
  224. // 非单个禁用
  225. single: true,
  226. // 非多个禁用
  227. multiple: true,
  228. // 显示搜索条件
  229. showSearch: true,
  230. // 总条数
  231. total: 0,
  232. dateRange: [],
  233. // 充值表格数据
  234. companyRechargeList: [],
  235. // 弹出层标题
  236. title: "",
  237. // 是否显示弹出层
  238. open: false,
  239. // 查询参数
  240. queryParams: {
  241. pageNum: 1,
  242. pageSize: 10,
  243. companyId: null,
  244. money: null,
  245. rechargeNo: null,
  246. payTime: null,
  247. status: null,
  248. businessType:null, // 业务类型
  249. },
  250. // 表单参数
  251. form: {},
  252. // 表单校验
  253. rules: {
  254. },
  255. recharge:{
  256. open:false,
  257. title:"后台充值"
  258. },
  259. // 表单校验
  260. rechargeRules: {
  261. money: [
  262. { required: true, message: "充值金额不能为空", trigger: "blur" }
  263. ],
  264. imgs: [
  265. { required: true, message: "凭证不能为空", trigger: "change" }
  266. ],
  267. },
  268. // 表单参数
  269. rechargeForm: {
  270. money: 0,
  271. },
  272. redSubmit: false,
  273. // 红包充值表单参数
  274. redRechargeForm: {
  275. money: 0
  276. },
  277. redRecharge: {
  278. open: false,
  279. title: '红包充值'
  280. },
  281. redRechargeRules: {
  282. money: [
  283. { required: true, message: '扣款金额不能为空', trigger: 'blur' }
  284. ]
  285. },
  286. };
  287. },
  288. created() {
  289. this.getDicts("company_pay_status").then((response) => {
  290. this.statusOptions = response.data;
  291. });
  292. this.getDicts("comapny_recharge_pay_type").then((response) => {
  293. this.payTypeOptions = response.data;
  294. });
  295. this.getDicts("sys_company_pay_business_type").then(response => {
  296. this.businessTypeOptions = response.data;
  297. });
  298. getConfigByKey("course.config").then(response => {
  299. if(response.data && response.data.configValue) {
  300. const config = JSON.parse(response.data.configValue);
  301. if( config.isRedPackageBalanceDeduction && config.isRedPackageBalanceDeduction==1){
  302. this.showRedPacket=true
  303. }
  304. } else {
  305. this.showRedPacket = false;
  306. }
  307. });
  308. this.getList();
  309. },
  310. methods: {
  311. /** 查询充值列表 */
  312. getList() {
  313. this.loading = true;
  314. listCompanyRecharge(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  315. this.companyRechargeList = response.rows;
  316. this.total = response.total;
  317. this.loading = false;
  318. });
  319. },
  320. // 取消按钮
  321. cancel() {
  322. this.open = false;
  323. this.reset();
  324. },
  325. // 表单重置
  326. reset() {
  327. this.form = {
  328. rechargeId: null,
  329. companyId: null,
  330. money: null,
  331. rechargeNo: null,
  332. createTime: null,
  333. payTime: null,
  334. status: 0
  335. };
  336. this.resetForm("form");
  337. },
  338. /** 搜索按钮操作 */
  339. handleQuery() {
  340. this.queryParams.pageNum = 1;
  341. this.getList();
  342. },
  343. /** 重置按钮操作 */
  344. resetQuery() {
  345. this.resetForm("queryForm");
  346. this.queryParams.businessType=null;
  347. this.handleQuery();
  348. },
  349. // 多选框选中数据
  350. handleSelectionChange(selection) {
  351. this.ids = selection.map(item => item.rechargeId)
  352. this.single = selection.length!==1
  353. this.multiple = !selection.length
  354. },
  355. /** 新增按钮操作 */
  356. handleAdd() {
  357. this.reset();
  358. this.open = true;
  359. this.title = "添加充值";
  360. },
  361. /** 修改按钮操作 */
  362. handleUpdate(row) {
  363. this.reset();
  364. const rechargeId = row.rechargeId || this.ids
  365. getCompanyRecharge(rechargeId).then(response => {
  366. this.form = response.data;
  367. this.open = true;
  368. this.title = "修改充值";
  369. });
  370. },
  371. /** 提交按钮 */
  372. submitForm() {
  373. this.$refs["form"].validate(valid => {
  374. if (valid) {
  375. if (this.form.rechargeId != null) {
  376. updateCompanyRecharge(this.form).then(response => {
  377. if (response.code === 200) {
  378. this.msgSuccess("修改成功");
  379. this.open = false;
  380. this.getList();
  381. }
  382. });
  383. } else {
  384. addCompanyRecharge(this.form).then(response => {
  385. if (response.code === 200) {
  386. this.msgSuccess("新增成功");
  387. this.open = false;
  388. this.getList();
  389. }
  390. });
  391. }
  392. }
  393. });
  394. },
  395. /** 红包充值提交按钮 */
  396. submitRedRechargeForm() {
  397. this.$refs['redRechargeForm'].validate(valid => {
  398. if (valid) {
  399. this.redSubmit=true
  400. redRecharge(this.redRechargeForm).then(response => {
  401. if (response.code === 200) {
  402. this.msgSuccess(response.msg)
  403. this.redRecharge.open = false
  404. this.getList()
  405. }
  406. })
  407. }
  408. })
  409. },
  410. /** 删除按钮操作 */
  411. handleDelete(row) {
  412. const rechargeIds = row.rechargeId || this.ids;
  413. this.$confirm('是否确认删除充值编号为"' + rechargeIds + '"的数据项?', "警告", {
  414. confirmButtonText: "确定",
  415. cancelButtonText: "取消",
  416. type: "warning"
  417. }).then(function() {
  418. return delCompanyRecharge(rechargeIds);
  419. }).then(() => {
  420. this.getList();
  421. this.msgSuccess("删除成功");
  422. }).catch(function() {});
  423. },
  424. /** 导出按钮操作 */
  425. handleExport() {
  426. const queryParams = this.queryParams;
  427. this.$confirm('是否确认导出所有充值数据项?', "警告", {
  428. confirmButtonText: "确定",
  429. cancelButtonText: "取消",
  430. type: "warning"
  431. }).then(function() {
  432. return exportCompanyRecharge(queryParams);
  433. }).then(response => {
  434. this.download(response.msg);
  435. }).catch(function() {});
  436. },
  437. /** 充值按钮操作 */
  438. handleRecharge() {
  439. this.rechargeForm = {
  440. money: 0,
  441. balance: 0, //默认余额为0
  442. remark: '',
  443. imgs: []
  444. };
  445. this.recharge.open = true;
  446. },
  447. /** 红包充值按钮*/
  448. handleRedRecharge(){
  449. getCompanyRedPacketBalance().then(response => {
  450. console.log(response.data);
  451. const data = response.data;
  452. this.redSubmit=false
  453. this.redRechargeForm.companyId = data.companyId
  454. this.redRechargeForm.companyName = data.companyName
  455. this.redRechargeForm.balance = data.redPackageMoney
  456. this.redRechargeForm.money = null
  457. this.redRecharge.open = true
  458. })
  459. },
  460. /** 提交按钮 */
  461. submitRechargeForm() {
  462. this.$refs["rechargeForm"].validate(valid => {
  463. if (valid) {
  464. recharge(this.rechargeForm).then(response => {
  465. if (response.code === 200) {
  466. this.msgSuccess(response.msg);
  467. this.recharge.open = false;
  468. this.getList();
  469. }
  470. });
  471. }
  472. });
  473. },
  474. }
  475. };
  476. </script>