index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <!--
  2. * @Descripttion: 使用情况
  3. * @version: 1.0
  4. * @Author: zzx
  5. * @Date: 2024-11-09 16:08:16
  6. * @LastEditors: zzx
  7. * @LastEditTime: 2024-11-21 18:00:00
  8. -->
  9. <template>
  10. <div class="app-container">
  11. <el-card class="filter-container" shadow="hover">
  12. <div>
  13. <i class="el-icon-search"></i>
  14. <span>筛选搜索</span>
  15. <el-button style="float: right" type="primary" @click="handleSearchList()" size="small">
  16. 查询搜索
  17. </el-button>
  18. <el-button style="float: right; margin-right: 15px" @click="handleResetSearch()" size="small">
  19. 重置
  20. </el-button>
  21. </div>
  22. <div style="margin-top: 15px">
  23. <el-form :inline="true" :model="listQuery" size="small" label-width="140px">
  24. <el-form-item label="渠道名称:">
  25. <el-input v-model="listQuery.ecName" class="input-width" placeholder="请输入渠道名称"
  26. clearable></el-input>
  27. </el-form-item>
  28. </el-form>
  29. </div>
  30. </el-card>
  31. <el-card class="operate-container" shadow="hover">
  32. <i class="el-icon-tickets"></i>
  33. <span>数据列表</span>
  34. </el-card>
  35. <div class="table-container">
  36. <el-table ref="adminTable" :data="list" style="width: 100%" v-loading="listLoading" border>
  37. <el-table-column label="渠道编号" width="100" align="center" prop="appId"></el-table-column>
  38. <el-table-column label="渠道名称" align="center" prop="thirdPartyName"></el-table-column>
  39. <el-table-column label="使用状态" align="center">
  40. <template slot-scope="scope">
  41. <el-tag type="success" v-if="scope.row.status === 1">正常</el-tag>
  42. <el-tag type="danger" v-else>禁用</el-tag>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="渠道上账总金额/元" align="center" prop="topAllMoney"></el-table-column>
  46. <el-table-column label="渠道应付总金额/元" width="160" align="center">
  47. <template slot-scope="scope">
  48. {{ scope.row.totalPayable || "0" }}
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="用户充值总金额/元" width="160" align="center" prop="userTopAllMoney"></el-table-column>
  52. <el-table-column label="用户消费总金额/元" width="140" align="center"
  53. prop="userConsumeAllMoney"></el-table-column>
  54. <el-table-column label="用户退款总金额/元" width="140" align="center">
  55. <template slot-scope="scope">
  56. {{ scope.row.userRefundAllMoney || "0" }}
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="用户剩余总金额/元" width="140" align="center" prop="userBalance"></el-table-column>
  60. <el-table-column label="操作" width="180" align="center">
  61. <template slot-scope="scope">
  62. <el-button size="mini" type="primary" plain @click="handleUpdate(scope.$index, scope.row)"
  63. v-if="scope.row.status === 1">
  64. 上账
  65. </el-button>
  66. <el-button size="mini" type="success" plain @click="SettleAccount(scope.$index, scope.row)"
  67. v-else>
  68. 结算
  69. </el-button>
  70. <el-button size="mini" type="danger" plain @click="forbiddenStatus(scope.$index, scope.row)"
  71. v-if="scope.row.status === 1">
  72. 禁用
  73. </el-button>
  74. <el-button size="mini" type="warning" plain @click="enable(scope.$index, scope.row)" v-else>
  75. 启用
  76. </el-button>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. </div>
  81. <div class="pagination-container">
  82. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
  83. layout="total, sizes,prev, pager, next,jumper" :current-page.sync="listQuery.pageNum"
  84. :page-size="listQuery.pageSize" :page-sizes="[10, 15, 20]" :total="total">
  85. </el-pagination>
  86. </div>
  87. <el-dialog title="提示" :visible.sync="forbiddenDialogVisible" width="30%">
  88. <span v-if="isforbidden === false">此操作将会禁用该渠道的所有用户(正在充电的用户,会在本次充电完成后被禁用),使其无法充电,是否继续。</span>
  89. <span v-else>该操作会将该渠道禁用的用户,重新启用,是否继续。</span>
  90. <span slot="footer" class="dialog-footer">
  91. <el-button @click="forbiddenDialogVisible = false">取 消</el-button>
  92. <el-button type="primary" @click="confirmForbidden">确 定</el-button>
  93. </span>
  94. </el-dialog>
  95. <el-dialog :title="isEdit ? '渠道上账' : '渠道结算'" :visible.sync="dialogVisible" width="40%">
  96. <el-form :model="admin" ref="adminForm" label-width="150px" :rules="rules" size="small">
  97. <div style="font-size: 18px; font-weight: bold">渠道信息</div>
  98. <el-form-item label="渠道编号:">
  99. <template><span style="color: #969595">{{ admin.appId }}</span></template>
  100. </el-form-item>
  101. <el-form-item label="渠道名称:">
  102. <template><span style="color: #969595">{{
  103. admin.thirdPartyName
  104. }}</span></template>
  105. </el-form-item>
  106. <div style="font-size: 18px; font-weight: bold">使用情况</div>
  107. <el-form-item label="渠道上账总金额/元:">
  108. <template><span style="color: #969595">{{
  109. admin.topAllMoney
  110. }}</span></template>
  111. </el-form-item>
  112. <el-form-item label="渠道应付总金额/元:">
  113. <template><span style="color: #969595">{{
  114. admin.totalPayable || "0"
  115. }}</span></template>
  116. </el-form-item>
  117. <el-form-item label="本次上账金额/元:" prop="money">
  118. <el-input v-model="admin.money" placeholder="请输入上账金额" type="number" :rows="5"
  119. style="width: 250px"></el-input>
  120. <el-checkbox v-if="!isEdit" v-model="admin.checked">负数</el-checkbox>
  121. </el-form-item>
  122. <!-- <el-form-item label="上传凭证:">
  123. <uploadImg :limit="1" :file-list="fileList" @getUrl="getUrl($event)" @delUrl="delUrl($event)"
  124. :disabled="true"></uploadImg>
  125. </el-form-item> -->
  126. </el-form>
  127. <span slot="footer" class="dialog-footer">
  128. <el-button @click="dialogVisible = false" size="small">取 消</el-button>
  129. <el-button type="primary" @click="handleDialogConfirm()" size="small">确 定</el-button>
  130. </span>
  131. </el-dialog>
  132. </div>
  133. </template>
  134. <script>
  135. import { useConditionList, updateStatus, upTheAccount } from "@/api/channel";
  136. import { formatDate } from "@/utils/date";
  137. import uploadImg from '@/components/Upload/uploadImg'
  138. const defaultListQuery = {
  139. pageNum: 1,
  140. pageSize: 10,
  141. ecName: null,
  142. };
  143. const defaultAdmin = {
  144. id: null,
  145. username: null,
  146. password: null,
  147. nickName: null,
  148. email: null,
  149. note: null,
  150. status: 1,
  151. };
  152. export default {
  153. name: "useCondition",
  154. components: { uploadImg },
  155. data() {
  156. return {
  157. fileList: [],
  158. upImg: '',
  159. setQuery: {},
  160. isforbidden: false,
  161. forbiddenDialogVisible: false,
  162. listQuery: Object.assign({}, defaultListQuery),
  163. list: null,
  164. total: null,
  165. listLoading: false,
  166. dialogVisible: false,
  167. admin: Object.assign({}, defaultAdmin),
  168. isEdit: false,
  169. allocRoleIds: [],
  170. allRoleList: [],
  171. allocAdminId: null,
  172. rules: {
  173. money: [{ required: true, message: "请输入金额", trigger: "blur" }],
  174. },
  175. };
  176. },
  177. watch: {},
  178. created() {
  179. this.getList();
  180. },
  181. filters: {
  182. formatDateTime(time) {
  183. if (time == null || time === "") {
  184. return "N/A";
  185. }
  186. let date = new Date(time);
  187. return formatDate(date, "yyyy-MM-dd hh:mm:ss");
  188. },
  189. },
  190. methods: {
  191. //函数
  192. getUrl(getUrl) {
  193. this.upImg = getUrl;
  194. },
  195. delUrl(getUrl) {
  196. },
  197. // 启用
  198. enable(index, row) {
  199. this.isforbidden = true;
  200. this.forbiddenDialogVisible = true;
  201. this.setQuery = row;
  202. },
  203. // 禁用
  204. forbiddenStatus(index, row) {
  205. this.isforbidden = false;
  206. this.forbiddenDialogVisible = true;
  207. this.setQuery = row;
  208. },
  209. // 确认禁用/启用
  210. confirmForbidden() {
  211. let isEnable = "";
  212. if (this.isforbidden === true) {
  213. isEnable = 1;
  214. } else {
  215. isEnable = 2;
  216. }
  217. updateStatus(this.setQuery.thirdPartyId, isEnable).then((res) => {
  218. this.forbiddenDialogVisible = false;
  219. if (res.code == 200) {
  220. this.$message({
  221. message: "修改成功!",
  222. type: "success",
  223. });
  224. this.getList();
  225. }
  226. });
  227. },
  228. // 结算
  229. SettleAccount(index, row) {
  230. this.dialogVisible = true;
  231. this.isEdit = false;
  232. this.admin = Object.assign({}, row);
  233. },
  234. // 上账
  235. handleUpdate(index, row) {
  236. this.dialogVisible = true;
  237. this.isEdit = true;
  238. this.admin = Object.assign({}, row);
  239. },
  240. handleResetSearch() {
  241. this.listQuery = Object.assign({}, defaultListQuery);
  242. },
  243. handleSearchList() {
  244. this.listQuery.pageNum = 1;
  245. this.getList();
  246. },
  247. handleSizeChange(val) {
  248. this.listQuery.pageNum = 1;
  249. this.listQuery.pageSize = val;
  250. this.getList();
  251. },
  252. handleCurrentChange(val) {
  253. this.listQuery.pageNum = val;
  254. this.getList();
  255. },
  256. handleDialogConfirm() {
  257. this.$confirm("是否要确认?", "提示", {
  258. confirmButtonText: "确定",
  259. cancelButtonText: "取消",
  260. type: "warning",
  261. }).then(() => {
  262. let updateData = {
  263. money: this.admin.money,
  264. thirdPartyInfoId: this.admin.thirdPartyId,
  265. type: this.isEdit == true ? 1 : 2,
  266. voucherPic: this.upImg,
  267. };
  268. upTheAccount({ ...updateData }).then((response) => {
  269. if (response.code == 200) {
  270. this.$message({
  271. message: this.isEdit == true ? "上账成功!" : "结算成功!",
  272. type: "success",
  273. });
  274. this.fileList = [];
  275. this.$refs["adminForm"].resetFields();
  276. this.dialogVisible = false;
  277. this.getList();
  278. } else {
  279. this.$message({
  280. message: response.msg,
  281. type: "error",
  282. });
  283. }
  284. });
  285. });
  286. },
  287. getList() {
  288. this.listLoading = true;
  289. useConditionList(this.listQuery).then((response) => {
  290. this.listLoading = false;
  291. this.list = response.data.list;
  292. this.total = response.data.total;
  293. });
  294. },
  295. },
  296. };
  297. </script>
  298. <style></style>