index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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 v-model="queryParams.status" clearable>
  6. <el-option label="待审核" :value="0" />
  7. <el-option label="已通过" :value="1" />
  8. <el-option label="已拒绝" :value="2" />
  9. </el-select>
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  13. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  14. </el-form-item>
  15. </el-form>
  16. <el-row :gutter="10" class="mb8">
  17. <!-- <el-col :span="1.5">-->
  18. <!-- <el-button-->
  19. <!-- type="primary"-->
  20. <!-- plain-->
  21. <!-- icon="el-icon-plus"-->
  22. <!-- size="mini"-->
  23. <!-- @click="handleAdd"-->
  24. <!-- v-hasPermi="['company:CompanyRedPackageLogs:add']"-->
  25. <!-- >充值</el-button>-->
  26. <!-- </el-col>-->
  27. <el-col :span="1.5">
  28. <el-button
  29. type="warning"
  30. plain
  31. icon="el-icon-download"
  32. size="mini"
  33. :loading="exportLoading"
  34. @click="handleExport"
  35. v-hasPermi="['company:CompanyRedPackageLogs:export']"
  36. >导出</el-button>
  37. </el-col>
  38. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  39. </el-row>
  40. <el-table border v-loading="loading" :data="CompanyRedPackageLogsList">
  41. <el-table-column label="公司" align="center" prop="companyName" />
  42. <el-table-column label="操作类型" align="center" prop="operateType">
  43. <template slot-scope="scope">
  44. <el-tag v-if="scope.row.operateType == 0">充值</el-tag>
  45. <el-tag v-if="scope.row.operateType == 1">发红包</el-tag>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="充值金额" align="center" prop="upMoney" />
  49. <el-table-column label="手续费" align="center" prop="handlMoney" />
  50. <el-table-column label="手续费比例" align="center" prop="handlPri">
  51. <template slot-scope="scope">{{scope.row.handlPri}}%</template>
  52. </el-table-column>
  53. <el-table-column label="实际金额" align="center" prop="money" />
  54. <el-table-column label="审核状态" align="center" prop="status" >
  55. <template slot-scope="scope">
  56. <el-tag v-if="scope.row.status == 0" type="warning">待审核</el-tag>
  57. <el-tag v-if="scope.row.status == 1" type="success">审核通过</el-tag>
  58. <el-tooltip class="item" effect="dark" :content="scope.row.rejectMemo" placement="top" v-if="scope.row.status == 2">
  59. <el-tag type="danger">审核拒绝</el-tag>
  60. </el-tooltip>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="凭证照片" align="center" prop="images" >
  64. <template slot-scope="scope">
  65. <el-image
  66. style="width: 100px; height: 100px"
  67. :src="scope.row.images.split(',')[0]"
  68. :preview-src-list="scope.row.images.split(',')">
  69. </el-image>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="备注" align="center" prop="remark" />
  73. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  74. <template slot-scope="scope">
  75. <el-button
  76. size="mini"
  77. type="text"
  78. icon="el-icon-edit"
  79. v-if="scope.row.status == 0"
  80. @click="rewOpen(scope.row)"
  81. v-hasPermi="['company:CompanyRedPackageLogs:edit']"
  82. >审核</el-button>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. <pagination
  87. v-show="total>0"
  88. :total="total"
  89. :page.sync="queryParams.pageNum"
  90. :limit.sync="queryParams.pageSize"
  91. @pagination="getList"
  92. />
  93. <!-- 添加或修改公司红包余额日志对话框 -->
  94. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  95. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  96. <el-form-item label="充值金额" prop="upMoney">
  97. <el-input v-model="form.upMoney" @change="handlMoneyChange" type="number" placeholder="请输入充值金额" style="width: 200px">
  98. <template slot="append">元</template>
  99. </el-input>
  100. </el-form-item>
  101. <el-form-item label="手续费" prop="handlMoney">
  102. <el-input v-model="form.handlMoney" disabled placeholder="请输入充值金额" style="width: 200px">
  103. <template slot="append">元</template>
  104. </el-input>
  105. </el-form-item>
  106. <el-form-item label="手续费比例" prop="handlPri">
  107. <el-input v-model="pri" disabled placeholder="请输入充值金额" style="width: 200px">
  108. <template slot="append">%</template>
  109. </el-input>
  110. </el-form-item>
  111. <el-form-item label="到账金额" prop="money">
  112. <el-input v-model="form.money" disabled placeholder="请输入充值金额" style="width: 200px">
  113. <template slot="append">元</template>
  114. </el-input>
  115. </el-form-item>
  116. <el-form-item label="凭证照片" prop="images">
  117. <image-upload v-model="form.images" :limit="7" />
  118. </el-form-item>
  119. </el-form>
  120. <div slot="footer" class="dialog-footer">
  121. <el-button type="primary" @click="submitForm">确 定</el-button>
  122. <el-button @click="cancel">取 消</el-button>
  123. </div>
  124. </el-dialog>
  125. <!-- 添加或修改公司红包余额日志对话框 -->
  126. <el-dialog title="充值审核" :visible.sync="rewData.open" width="500px" append-to-body>
  127. <el-form ref="form" :model="rewData.form" :rules="rules" label-width="100px">
  128. <el-form-item label="审核" prop="status">
  129. <el-radio-group v-model="rewData.form.status">
  130. <el-radio :label="1">审核通过</el-radio>
  131. <el-radio :label="2">审核拒绝</el-radio>
  132. </el-radio-group>
  133. </el-form-item>
  134. <el-form-item label="备注" prop="remark" v-if="rewData.form.status == 1">
  135. <el-input type="textarea" :rows="3" class="el-input" v-model="rewData.form.remark" />
  136. </el-form-item>
  137. <el-form-item label="拒绝原因" prop="rejectMemo" v-if="rewData.form.status == 2">
  138. <el-input type="textarea" :rows="3" class="el-input" v-model="rewData.form.rejectMemo" />
  139. </el-form-item>
  140. <!-- <el-form-item label="拒绝凭证" prop="rejectImages" v-if="rewData.form.status == 2">-->
  141. <!-- <image-upload v-model="rewData.form.rejectImages" :limit="7" />-->
  142. <!-- </el-form-item>-->
  143. </el-form>
  144. <div slot="footer" class="dialog-footer">
  145. <el-button type="primary" @click="rewFun">确 定</el-button>
  146. <el-button @click="cancelRew">取 消</el-button>
  147. </div>
  148. </el-dialog>
  149. </div>
  150. </template>
  151. <script>
  152. import { listCompanyRedPackageLogs, getCompanyRedPackageLogs, delCompanyRedPackageLogs, getMoneyPri, recharge, exportCompanyRedPackageLogs, rew } from "@/api/company/CompanyRedPackageLogs";
  153. export default {
  154. name: "CompanyRedPackageLogs",
  155. data() {
  156. return {
  157. // 遮罩层
  158. loading: true,
  159. // 导出遮罩层
  160. exportLoading: false,
  161. // 选中数组
  162. ids: [],
  163. // 非单个禁用
  164. single: true,
  165. // 非多个禁用
  166. multiple: true,
  167. // 显示搜索条件
  168. showSearch: true,
  169. // 总条数
  170. total: 0,
  171. pri: 0,
  172. // 公司红包余额日志表格数据
  173. CompanyRedPackageLogsList: [],
  174. // 弹出层标题
  175. title: "",
  176. // 是否显示弹出层
  177. open: false,
  178. // 查询参数
  179. queryParams: {
  180. pageNum: 1,
  181. pageSize: 10,
  182. companyId: null,
  183. operateType: null,
  184. type: null,
  185. upMoney: null,
  186. handlMoney: null,
  187. handlPri: null,
  188. money: null,
  189. status: null,
  190. images: null,
  191. rejectMemo: null,
  192. rejectImages: null,
  193. },
  194. // 表单参数
  195. form: {},
  196. rewData: {
  197. open: false,
  198. form:{},
  199. row:{},
  200. },
  201. // 表单校验
  202. rules: {
  203. upMoney:[
  204. { required: true, message: "充值金额不能为空", trigger: "blur" }
  205. ],
  206. }
  207. };
  208. },
  209. created() {
  210. getMoneyPri().then(e => {
  211. this.pri =e.data;
  212. });
  213. this.getList();
  214. },
  215. methods: {
  216. /** 查询公司红包余额日志列表 */
  217. getList() {
  218. this.loading = true;
  219. listCompanyRedPackageLogs(this.queryParams).then(response => {
  220. this.CompanyRedPackageLogsList = response.rows;
  221. this.total = response.total;
  222. this.loading = false;
  223. });
  224. },
  225. handlMoneyChange(){
  226. let money = this.form.upMoney
  227. if(money != null && Number(money) > 0){
  228. this.form.handlMoney = (money * (this.pri / 100).toFixed(2)).toFixed(2);
  229. this.form.money = money - this.form.handlMoney;
  230. }
  231. },
  232. // 取消按钮
  233. cancel() {
  234. this.open = false;
  235. this.reset();
  236. },
  237. // 取消按钮
  238. cancelRew() {
  239. this.rewData.open = false;
  240. },
  241. // 表单重置
  242. reset() {
  243. this.form = {
  244. id: null,
  245. companyId: null,
  246. operateType: null,
  247. type: null,
  248. upMoney: null,
  249. handlMoney: null,
  250. handlPri: null,
  251. money: null,
  252. status: 0,
  253. images: null,
  254. rejectMemo: null,
  255. rejectImages: null,
  256. createTime: null,
  257. createBy: null,
  258. updateBy: null,
  259. updateTime: null,
  260. remark: null
  261. };
  262. this.resetForm("form");
  263. },
  264. /** 搜索按钮操作 */
  265. handleQuery() {
  266. this.queryParams.pageNum = 1;
  267. this.getList();
  268. },
  269. /** 重置按钮操作 */
  270. resetQuery() {
  271. this.resetForm("queryForm");
  272. this.handleQuery();
  273. },
  274. // 多选框选中数据
  275. handleSelectionChange(selection) {
  276. this.ids = selection.map(item => item.id)
  277. this.single = selection.length!==1
  278. this.multiple = !selection.length
  279. },
  280. /** 新增按钮操作 */
  281. handleAdd() {
  282. this.reset();
  283. this.open = true;
  284. this.title = "添加公司红包余额日志";
  285. },
  286. /** 修改按钮操作 */
  287. handleUpdate(row) {
  288. this.reset();
  289. const id = row.id || this.ids
  290. getCompanyRedPackageLogs(id).then(response => {
  291. this.form = response.data;
  292. this.open = true;
  293. this.title = "修改公司红包余额日志";
  294. });
  295. },
  296. /** 提交按钮 */
  297. submitForm() {
  298. this.$refs["form"].validate(valid => {
  299. if (valid) {
  300. recharge(this.form).then(response => {
  301. this.msgSuccess("充值成功");
  302. this.open = false;
  303. this.getList();
  304. });
  305. }
  306. });
  307. },
  308. /** 删除按钮操作 */
  309. handleDelete(row) {
  310. const ids = row.id || this.ids;
  311. this.$confirm('是否确认删除公司红包余额日志编号为"' + ids + '"的数据项?', "警告", {
  312. confirmButtonText: "确定",
  313. cancelButtonText: "取消",
  314. type: "warning"
  315. }).then(function() {
  316. return delCompanyRedPackageLogs(ids);
  317. }).then(() => {
  318. this.getList();
  319. this.msgSuccess("删除成功");
  320. }).catch(() => {});
  321. },
  322. /** 导出按钮操作 */
  323. handleExport() {
  324. const queryParams = this.queryParams;
  325. this.$confirm('是否确认导出所有公司红包余额日志数据项?', "警告", {
  326. confirmButtonText: "确定",
  327. cancelButtonText: "取消",
  328. type: "warning"
  329. }).then(() => {
  330. this.exportLoading = true;
  331. return exportCompanyRedPackageLogs(queryParams);
  332. }).then(response => {
  333. this.download(response.msg);
  334. this.exportLoading = false;
  335. }).catch(() => {});
  336. },
  337. rewOpen(row){
  338. this.rewData.open = true;
  339. getCompanyRedPackageLogs(row.id).then(e => {
  340. this.rewData.row = e.data;
  341. this.rewData.form = {
  342. id: row.id,
  343. status: 1,
  344. remark: "",
  345. rejectMemo: "",
  346. rejectImages: "",
  347. };
  348. })
  349. },
  350. rewFun(){
  351. rew(this.rewData.form).then(response => {
  352. this.msgSuccess("审核成功");
  353. this.rewData.open = false;
  354. this.getList();
  355. });
  356. },
  357. }
  358. };
  359. </script>