index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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="companyId">
  5. <el-select style="width: 220px" filterable v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  6. <el-option
  7. v-for="item in companys"
  8. :key="item.companyId"
  9. :label="item.companyName"
  10. :value="item.companyId"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="订单号" prop="rechargeNo">
  15. <el-input
  16. style="width: 220px"
  17. v-model="queryParams.rechargeNo"
  18. placeholder="请输入充值订单号"
  19. clearable
  20. size="small"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item label="支付时间" prop="payTime">
  25. <el-date-picker v-model="dateRange" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  26. </el-form-item>
  27. <el-form-item label="状态" prop="status">
  28. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  29. <el-option
  30. v-for="dict in statusOptions"
  31. :key="dict.dictValue"
  32. :label="dict.dictLabel"
  33. :value="dict.dictValue"
  34. />
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="支付类型" prop="payType">
  38. <el-select style="width: 220px" v-model="queryParams.payType" placeholder="请选择支付类型" clearable size="small">
  39. <el-option
  40. v-for="dict in payTypeOptions"
  41. :key="dict.dictValue"
  42. :label="dict.dictLabel"
  43. :value="dict.dictValue"
  44. />
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item>
  48. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  49. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  50. </el-form-item>
  51. </el-form>
  52. <el-row :gutter="10" class="mb8">
  53. <el-col :span="1.5">
  54. <el-button
  55. type="warning"
  56. icon="el-icon-download"
  57. size="mini"
  58. @click="handleExport"
  59. v-hasPermi="['company:companyRecharge:export']"
  60. >导出</el-button>
  61. </el-col>
  62. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  63. </el-row>
  64. <el-tabs type="card" v-model="queryParams.isAudit" @tab-click="handleClick">
  65. <el-tab-pane label="待审核" name="0"></el-tab-pane>
  66. <el-tab-pane label="已审核" name="1"></el-tab-pane>
  67. <el-tab-pane label="已驳回" name="-1"></el-tab-pane>
  68. </el-tabs>
  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="ID" align="center" prop="rechargeId" />
  72. <el-table-column label="充值订单号" align="center" prop="rechargeNo" />
  73. <el-table-column label="公司" align="center" prop="companyName" />
  74. <el-table-column label="充值金额" align="center" prop="money" />
  75. <el-table-column label="充值类型" align="center" prop="payType" >
  76. <template slot-scope="scope">
  77. <el-tag prop="status" v-for="(item, index) in payTypeOptions" v-if="scope.row.payType==item.dictValue">{{item.dictLabel}}</el-tag>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="提交人" align="center" prop="createUserNickName">
  81. </el-table-column>
  82. <el-table-column label="提交时间" align="center" prop="createTime" width="160">
  83. </el-table-column>
  84. <el-table-column label="审核人" align="center" prop="auditUserNickName">
  85. </el-table-column>
  86. <el-table-column label="审核时间" align="center" prop="auditTime" width="160">
  87. </el-table-column>
  88. <el-table-column label="支付时间" align="center" prop="payTime" width="160">
  89. </el-table-column>
  90. <el-table-column label="凭证照片" align="center" prop="images" >
  91. <template slot-scope="scope">
  92. <div v-if="scope.row.imgs != null && scope.row.imgs != undefined && scope.row.imgs != ''">
  93. <el-image
  94. style="width: 50px; height: 50px"
  95. :src="scope.row.imgs.split(',')[0]"
  96. :preview-src-list="scope.row.imgs.split(',')">
  97. </el-image>
  98. <p style="margin: 0">({{scope.row.imgs.split(',').length}} 张)</p>
  99. </div>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="状态" align="center" prop="status" >
  103. <template slot-scope="scope">
  104. <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>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="备注" align="center" prop="remark" />
  108. <el-table-column label="操作" fixed="right" align="center" width="120px" class-name="small-padding fixed-width">
  109. <template slot-scope="scope">
  110. <el-button
  111. v-if="scope.row.isAudit==0"
  112. size="mini"
  113. type="text"
  114. icon="el-icon-edit"
  115. @click="handleAudit(scope.row)"
  116. v-hasPermi="['company:companyRecharge:audit']"
  117. >审核</el-button>
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. <pagination
  122. v-show="total>0"
  123. :total="total"
  124. :page.sync="queryParams.pageNum"
  125. :limit.sync="queryParams.pageSize"
  126. @pagination="getList"
  127. />
  128. <!-- 添加或修改充值对话框 -->
  129. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
  130. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  131. <el-form-item label="公司" prop="companyName">
  132. <el-input v-model="form.companyName" disabled />
  133. </el-form-item>
  134. <el-form-item label="充值金额" prop="money">
  135. <el-input v-model="form.money" disabled />
  136. </el-form-item>
  137. <el-form-item label="状态">
  138. <el-radio-group v-model="form.isAudit">
  139. <el-radio label="1">通过</el-radio>
  140. <el-radio label="-1">驳回</el-radio>
  141. </el-radio-group>
  142. </el-form-item>
  143. <el-form-item label="备注" prop="remark">
  144. <el-input v-model="form.remark" type="textarea" :row="5" />
  145. </el-form-item>
  146. </el-form>
  147. <div slot="footer" class="dialog-footer">
  148. <el-button type="primary" @click="submitForm">确 定</el-button>
  149. <el-button @click="cancel">取 消</el-button>
  150. </div>
  151. </el-dialog>
  152. </div>
  153. </template>
  154. <script>
  155. import { listCompanyRecharge, getCompanyRecharge, audit, exportCompanyRecharge } from "@/api/company/companyRecharge";
  156. import { getCompanyList } from "@/api/company/company";
  157. export default {
  158. name: "CompanyRecharge",
  159. data() {
  160. return {
  161. payTypeOptions:[],
  162. companys:[],
  163. statusOptions:[],
  164. // 遮罩层
  165. loading: true,
  166. // 选中数组
  167. ids: [],
  168. // 非单个禁用
  169. single: true,
  170. // 非多个禁用
  171. multiple: true,
  172. // 显示搜索条件
  173. showSearch: true,
  174. // 总条数
  175. total: 0,
  176. dateRange: [],
  177. // 充值表格数据
  178. companyRechargeList: [],
  179. // 弹出层标题
  180. title: "",
  181. // 是否显示弹出层
  182. open: false,
  183. // 查询参数
  184. queryParams: {
  185. pageNum: 1,
  186. pageSize: 10,
  187. companyId: null,
  188. money: null,
  189. rechargeNo: null,
  190. payTime: null,
  191. status: null,
  192. isAudit:0,
  193. },
  194. // 表单参数
  195. form: {},
  196. // 表单校验
  197. rules: {
  198. isAudit: [
  199. { required: true, message: "状态不能为空", trigger: "blur" }
  200. ],
  201. }
  202. };
  203. },
  204. created() {
  205. getCompanyList().then(response => {
  206. this.companys = response.data;
  207. });
  208. this.getDicts("comapny_recharge_pay_type").then((response) => {
  209. this.payTypeOptions = response.data;
  210. });
  211. this.getDicts("company_pay_status").then((response) => {
  212. this.statusOptions = response.data;
  213. });
  214. this.getList();
  215. },
  216. methods: {
  217. handleClick(tab, event) {
  218. this.queryParams.isAudit=tab.name
  219. this.getList();
  220. },
  221. /** 查询充值列表 */
  222. getList() {
  223. this.loading = true;
  224. listCompanyRecharge(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  225. this.companyRechargeList = response.rows;
  226. this.total = response.total;
  227. this.loading = false;
  228. });
  229. },
  230. // 取消按钮
  231. cancel() {
  232. this.open = false;
  233. this.reset();
  234. },
  235. // 表单重置
  236. reset() {
  237. this.form = {
  238. rechargeId: null,
  239. companyId: null,
  240. money: null,
  241. rechargeNo: null,
  242. createTime: null,
  243. payTime: null,
  244. isAudit: "1"
  245. };
  246. this.resetForm("form");
  247. },
  248. /** 搜索按钮操作 */
  249. handleQuery() {
  250. this.queryParams.pageNum = 1;
  251. this.getList();
  252. },
  253. /** 重置按钮操作 */
  254. resetQuery() {
  255. this.resetForm("queryForm");
  256. this.dateRange=[];
  257. this.handleQuery();
  258. },
  259. // 多选框选中数据
  260. handleSelectionChange(selection) {
  261. this.ids = selection.map(item => item.rechargeId)
  262. this.single = selection.length!==1
  263. this.multiple = !selection.length
  264. },
  265. /** 修改按钮操作 */
  266. handleAudit(row) {
  267. this.reset();
  268. const rechargeId = row.rechargeId || this.ids
  269. getCompanyRecharge(rechargeId).then(response => {
  270. this.form = response.data;
  271. this.form.companyName = row.companyName;
  272. this.form.isAudit="1"
  273. this.open = true;
  274. this.title = "充值";
  275. });
  276. },
  277. /** 提交按钮 */
  278. submitForm() {
  279. this.$refs["form"].validate(valid => {
  280. if (valid) {
  281. audit(this.form).then(response => {
  282. if (response.code === 200) {
  283. this.msgSuccess("审核成功");
  284. this.open = false;
  285. this.getList();
  286. }
  287. });
  288. }
  289. });
  290. },
  291. /** 导出按钮操作 */
  292. handleExport() {
  293. const queryParams = this.queryParams;
  294. this.$confirm('是否确认导出所有充值数据项?', "警告", {
  295. confirmButtonText: "确定",
  296. cancelButtonText: "取消",
  297. type: "warning"
  298. }).then(function() {
  299. return exportCompanyRecharge(queryParams);
  300. }).then(response => {
  301. this.download(response.msg);
  302. }).catch(function() {});
  303. }
  304. }
  305. };
  306. </script>