Browse Source

对接渠道管理菜单接口 -zzx

zouzexu 6 months ago
parent
commit
c6905a305d

+ 1 - 1
config/dev.env.js

@@ -4,5 +4,5 @@ const prodEnv = require('./prod.env')
 
 module.exports = merge(prodEnv, {
   NODE_ENV: '"development"',
-  BASE_API: '"http://192.168.2.21:8080"'
+  BASE_API: '"http://192.168.2.21:8080/zs/channel/admin"'
 })

+ 48 - 2
src/api/channel.js

@@ -1,6 +1,7 @@
 import request from '@/utils/request'
+import { status } from 'nprogress'
 
-//获取渠道列表
+//渠道列表
 export function channelList(params) {
     return request({
       url:'/pms/cThirdPartyInfo/list',
@@ -9,6 +10,15 @@ export function channelList(params) {
     })
   }
 
+  //渠道列表编辑
+export function editList(data) {
+  return request({
+    url:'/pms/cThirdPartyInfo/update',
+    method:'post',
+    data:data
+  })
+}
+
 //   渠道上账列表
   export function upCheckList(params) {
     return request({
@@ -16,4 +26,40 @@ export function channelList(params) {
       method:'get',
       params:params
     })
-  }
+  }
+
+// 渠道使用情况列表
+export function useConditionList(params) {
+  return request({
+    url:'/pms/cThirdPartyInfo/getServiceCondition',
+    method:'get',
+    params:params
+  })
+}
+
+// 使用列表回显
+export function getAccountInfo(id,params) {
+  return request({
+    url:'/pms/cThirdPartyInfo/settleAccount/'+id,
+    method:'get',
+    params:params
+  })
+}
+
+// 状态变更
+export function updateStatus(id,status,data) {
+  return request({
+    url:'pms/cThirdPartyInfo/updateStatus/'+id+'/'+status,
+    method:'post',
+    data:data
+  })
+}
+
+// 上账/结算
+export function upTheAccount(data) {
+  return request({
+    url:'ums/umsThirdPartyDetail/save',
+    method:'post',
+    data:data
+  })
+}

+ 1 - 0
src/icons/svg/BasicsInfo.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1731404291578" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4283" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M704 256l192 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L704 192c-17.7 0-32 14.3-32 32S686.3 256 704 256z" p-id="4284"></path><path d="M576 64l0 256L75 320c-41.4 0-75 33.6-75 75l0 426c0 41.4 33.6 75 75 75l277 0 0 64L224 960c-17.7 0-32 14.3-32 32s14.3 32 32 32l320 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L416 960l0-64 160 0 0 96 0 32 448 0L1024 64 576 64zM64 821 64 395c0-6.1 4.9-11 11-11l501 0 117 0c0.8 0 1.5 0.1 2.2 0.2 1.4 0.3 2.8 0.9 3.9 1.7 0.3 0.2 0.6 0.4 0.8 0.6 0.5 0.4 1 0.9 1.5 1.5 0.2 0.3 0.4 0.6 0.6 0.8 0.8 1.2 1.4 2.5 1.7 3.9 0.1 0.7 0.2 1.5 0.2 2.2l0 426c0 0.8-0.1 1.5-0.2 2.2-0.3 1.4-0.9 2.8-1.7 3.9-0.2 0.3-0.4 0.6-0.6 0.8-0.4 0.5-0.9 1-1.5 1.5-0.3 0.2-0.6 0.4-0.8 0.6-1.2 0.8-2.5 1.4-3.9 1.7-0.7 0.1-1.5 0.2-2.2 0.2L576 831.8 75 831.8C68.9 832 64 827.1 64 821zM960 960 640 960l0-64 53 0c41.4 0 75-33.6 75-75L768 395c0-41.4-33.6-75-75-75l-53 0L640 128l320 0L960 960z" p-id="4285"></path></svg>

+ 1 - 0
src/icons/svg/settleAccounts.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1731404565506" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6371" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M773.3248 170.5984l-34.816 84.1728A81.92 81.92 0 0 1 663.552 307.2H360.448a81.92 81.92 0 0 1-74.9568-52.4288l-34.816-84.1728c-16.7936-47.7184 11.0592-102.4 58.7776-108.544a64.512 64.512 0 0 1 9.0112 0 74.5472 74.5472 0 0 1 44.2368 14.7456 40.96 40.96 0 0 0 58.1632-9.0112 112.2304 112.2304 0 0 1 182.272 0 40.96 40.96 0 0 0 58.1632 9.0112A74.5472 74.5472 0 0 1 705.536 61.44a64.512 64.512 0 0 1 9.0112 0c47.7184 6.3488 75.5712 61.44 58.7776 109.1584zM542.72 829.6448c37.2736-7.9872 61.44-29.4912 61.44-49.5616s-24.1664-40.96-61.44-49.5616z m-122.88-217.088c0 20.48 24.1664 40.96 61.44 49.5616v-99.1232c-37.2736 7.9872-61.44 29.4912-61.44 49.5616zM810.5984 1003.52H213.4016C86.6304 992.4608 20.48 842.9568 88.8832 734.0032l194.1504-307.2A81.92 81.92 0 0 1 352.256 389.12h319.488a81.92 81.92 0 0 1 69.2224 38.0928l194.1504 307.2c68.4032 108.544 2.2528 258.048-124.5184 269.1072zM542.72 667.8528v-104.8576c37.2736 7.9872 61.44 29.4912 61.44 49.5616a30.72 30.72 0 0 0 61.44 0c0-56.32-52.0192-102.4-122.88-112.2304V491.52a30.72 30.72 0 0 0-61.44 0v8.8064c-70.8608 10.24-122.88 55.9104-122.88 112.2304s52.0192 102.4 122.88 112.2304v104.8576c-37.2736-7.9872-61.44-29.4912-61.44-49.5616a30.72 30.72 0 0 0-61.44 0c0 56.32 52.0192 102.4 122.88 112.2304V901.12a30.72 30.72 0 0 0 61.44 0v-8.8064c70.8608-10.24 122.88-55.9104 122.88-112.2304s-51.2-101.9904-122.88-112.2304z" fill="#333333" p-id="6372"></path></svg>

+ 1 - 0
src/icons/svg/useCondition.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1731404432506" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5281" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M166.4 102.4h681.6v428.8l-38.4 35.2V140.8H185.6v745.6h624v-208l38.4-35.2v278.4H147.2V102.4z" fill="#5B8FD9" p-id="5282"></path><path d="M668.8 764.8l35.2-9.6 32-9.6-22.4-25.6-22.4-22.4-12.8 35.2zM873.6 515.2l-179.2 179.2 44.8 44.8 182.4-179.2zM556.8 796.8v32H768v-32z" fill="#68D279" p-id="5283"></path><path d="M268.8 537.6v35.2h256v-35.2zM268.8 457.6v32h384v-32zM268.8 377.6v32h457.6v-32zM268.8 294.4v32h457.6v-32zM268.8 214.4h457.6v32H268.8z" fill="#F9D65D" p-id="5284"></path></svg>

+ 3 - 3
src/router/index.js

@@ -30,19 +30,19 @@ export const constantRouterMap = [
       path: 'info',
       name: 'info',
       component: () => import('@/views/channel/info/index'),
-      meta: {title: '渠道基础信息', icon: 'dashboard'}
+      meta: {title: '渠道基础信息', icon: 'BasicsInfo'}
     },
     {
       path: 'useCondition',
       name: 'useCondition',
       component: () => import('@/views/channel/useCondition/index'),
-      meta: {title: '渠道使用情况', icon: 'dashboard'}
+      meta: {title: '渠道使用情况', icon: 'useCondition'}
     },
     {
       path: 'upCheck',
       name: 'upCheck',
       component: () => import('@/views/channel/upCheck/index'),
-      meta: {title: '渠道上账情况', icon: 'dashboard'}
+      meta: {title: '渠道上账情况', icon: 'settleAccounts'}
     },
     ]
   }

+ 32 - 15
src/views/channel/info/index.vue

@@ -15,7 +15,7 @@
       <div style="margin-top: 15px">
         <el-form :inline="true" :model="listQuery" size="small" label-width="140px">
           <el-form-item label="渠道名称:">
-            <el-input v-model="listQuery.keyword" class="input-width" placeholder="请输入渠道名称" clearable></el-input>
+            <el-input v-model="listQuery.ecName" class="input-width" placeholder="请输入渠道名称" clearable></el-input>
           </el-form-item>
           <el-form-item label="创建时间:">
             <el-date-picker v-model="date" size="small" value-format="yyyy-MM-dd" class="item-width-350 ml10"
@@ -36,11 +36,7 @@
         <el-table-column label="渠道名称" align="center" prop="ecName"></el-table-column>
         <el-table-column label="联系人" align="center" prop="contactName"></el-table-column>
         <el-table-column label="手机号" align="center" prop="contactPhone"></el-table-column>
-        <el-table-column label="渠道服务费/元" width="160" align="center">
-          <template slot-scope="scope">
-            {{ '--' }}
-          </template>
-        </el-table-column>
+        <el-table-column label="渠道服务费/元" width="160" align="center" prop="serviceMoney"></el-table-column>
         <el-table-column label="使用状态" width="160" align="center">
           <template slot-scope="scope">
             <el-tag type='success' v-if="scope.row.status === 1">正常</el-tag>
@@ -69,7 +65,7 @@
     <el-dialog :title="isEdit ? '编辑' : '添加'" :visible.sync="dialogVisible" width="40%">
       <el-form :model="admin" ref="adminForm" label-width="150px" size="small">
         <el-form-item label="渠道编号:">
-          <el-input v-model="admin.appId" style="width: 250px"></el-input>
+          <el-input disabled v-model="admin.appId" style="width: 250px"></el-input>
         </el-form-item>
         <el-form-item label="渠道名称:">
           <el-input v-model="admin.ecName" style="width: 250px"></el-input>
@@ -81,7 +77,7 @@
           <el-input v-model="admin.contactPhone" type="number" style="width: 250px"></el-input>
         </el-form-item>
         <el-form-item label="渠道服务费:">
-          <el-input v-model="admin.note" type="text" :rows="5" style="width: 250px"></el-input>
+          <el-input v-model="admin.serviceMoney" type="text" :rows="5" style="width: 250px"></el-input>
           <div>当前平台服务费为0.1</div>
         </el-form-item>
       </el-form>
@@ -95,15 +91,16 @@
 <script>
 import {
   createAdmin,
-  updateAdmin,
 } from "@/api/login";
-import {channelList} from "@/api/channel";
+import { channelList, editList } from "@/api/channel";
 import { formatDate } from "@/utils/date";
 
 const defaultListQuery = {
   pageNum: 1,
   pageSize: 10,
-  keyword: null,
+  ecName: null,
+  startTime: '',
+  endTime: ''
 };
 const defaultAdmin = {
   id: null,
@@ -115,7 +112,7 @@ const defaultAdmin = {
   status: 1,
 };
 export default {
-  name: "adminList",
+  name: "info",
   data() {
     return {
       date: '',
@@ -132,9 +129,19 @@ export default {
       allocAdminId: null,
     };
   },
+  watch: {
+    date(val) {
+      if (val) {
+        this.listQuery.startTime = Date.parse(val[0]);
+        this.listQuery.endTime = Date.parse(val[1]);
+      } else {
+        this.listQuery.startTime = "";
+        this.listQuery.endTime = "";
+      }
+    },
+  },
   created() {
     this.getList();
-    this.getAllRoleList();
   },
   filters: {
     formatDateTime(time) {
@@ -191,14 +198,24 @@ export default {
         cancelButtonText: "取消",
         type: "warning",
       }).then(() => {
+        let editData = {
+          appId:this.admin.appId,
+          contactName:this.admin.contactName,
+          contactPhone:this.admin.contactPhone,
+          ecName:this.admin.ecName,
+          id: this.admin.id,
+          serviceMoney: this.admin.serviceMoney
+        }
         if (this.isEdit) {
-          updateAdmin(this.admin.id, this.admin).then((response) => {
-            this.$message({
+          editList({...editData}).then((response) => {
+            if( response.code == 200){
+              this.$message({
               message: "修改成功!",
               type: "success",
             });
             this.dialogVisible = false;
             this.getList();
+            }
           });
         } else {
           createAdmin(this.admin).then((response) => {

+ 28 - 16
src/views/channel/upCheck/index.vue

@@ -15,7 +15,7 @@
             <div style="margin-top: 15px">
                 <el-form :inline="true" :model="listQuery" size="small" label-width="140px">
                     <el-form-item label="渠道名称:">
-                        <el-input v-model="listQuery.keyword" class="input-width" placeholder="请输入渠道名称"
+                        <el-input v-model="listQuery.ecName" class="input-width" placeholder="请输入渠道名称"
                             clearable></el-input>
                     </el-form-item>
                     <el-form-item label="操作时间:">
@@ -37,7 +37,12 @@
                 <el-table-column label="渠道名称" align="center" prop="ecName"></el-table-column>
                 <el-table-column label="渠道上账金额/元" align="center">
                     <template slot-scope="scope">
-                        {{ "--" }}
+                        {{ scope.row.money||"--" }}
+                    </template>
+                </el-table-column>
+                <el-table-column label="凭证" align="center" prop="updateBy">
+                    <template slot-scope="scope">
+                        <img class="icon" :src="scope.row.voucherPic" alt="">
                     </template>
                 </el-table-column>
                 <el-table-column label="操作人" align="center" prop="updateBy"></el-table-column>
@@ -59,19 +64,12 @@ import { formatDate } from "@/utils/date";
 const defaultListQuery = {
     pageNum: 1,
     pageSize: 10,
-    keyword: null,
-};
-const defaultAdmin = {
-    id: null,
-    username: null,
-    password: null,
-    nickName: null,
-    email: null,
-    note: null,
-    status: 1,
+    ecName: null,
+    startTime: '',
+    endTime: ''
 };
 export default {
-    name: "adminList",
+    name: "upCheck",
     data() {
         return {
             date: "",
@@ -79,16 +77,25 @@ export default {
             list: null,
             total: null,
             listLoading: false,
-            admin: Object.assign({}, defaultAdmin),
             isEdit: false,
             allocRoleIds: [],
             allRoleList: [],
             allocAdminId: null,
         };
     },
+    watch: {
+        date(val) {
+            if (val) {
+                this.listQuery.startTime = Date.parse(val[0]);
+                this.listQuery.endTime = Date.parse(val[1]);
+            } else {
+                this.listQuery.startTime = "";
+                this.listQuery.endTime = "";
+            }
+        },
+    },
     created() {
         this.getList();
-        this.getAllRoleList();
     },
     filters: {
         formatDateTime(time) {
@@ -127,4 +134,9 @@ export default {
     },
 };
 </script>
-<style></style>
+<style scoped>
+.icon {
+    width: 60px;
+    height: 60px;
+}
+</style>

+ 95 - 165
src/views/channel/useCondition/index.vue

@@ -15,7 +15,7 @@
             <div style="margin-top: 15px">
                 <el-form :inline="true" :model="listQuery" size="small" label-width="140px">
                     <el-form-item label="渠道名称:">
-                        <el-input v-model="listQuery.keyword" class="input-width" placeholder="请输入渠道名称"
+                        <el-input v-model="listQuery.ecName" class="input-width" placeholder="请输入渠道名称"
                             clearable></el-input>
                     </el-form-item>
                     <el-form-item label="更新时间:">
@@ -33,63 +33,44 @@
         </el-card>
         <div class="table-container">
             <el-table ref="adminTable" :data="list" style="width: 100%" v-loading="listLoading" border>
-                <el-table-column label="渠道编号" width="100" align="center">
-                    <template slot-scope="scope">
-                        {{ '--' }}
-                    </template>
-                </el-table-column>
-                <el-table-column label="渠道名称" align="center">
-                    <template slot-scope="scope">
-                        {{ '--' }}
-                    </template>
-                </el-table-column>
+                <el-table-column label="渠道编号" width="100" align="center" prop="appId"></el-table-column>
+                <el-table-column label="渠道名称" align="center" prop="thirdPartyName"></el-table-column>
                 <el-table-column label="使用状态" align="center">
                     <template slot-scope="scope">
-                        {{ '--' }}
-                    </template>
-                </el-table-column>
-                <el-table-column label="渠道上账总金额/元" align="center">
-                    <template slot-scope="scope">
-                        {{ '--' }}
+                        <el-tag type='success' v-if="scope.row.status === 1">正常</el-tag>
+                        <el-tag type="danger" v-else>禁用</el-tag>
                     </template>
                 </el-table-column>
+                <el-table-column label="渠道上账总金额/元" align="center" prop="topAllMoney"></el-table-column>
                 <el-table-column label="渠道应付总金额/元" width="160" align="center">
                     <template slot-scope="scope">
-                        {{ '--' }}
-                    </template>
-                </el-table-column>
-                <el-table-column label="用户充值总金额/元" width="160" align="center">
-                    <template slot-scope="scope">
-                        {{ '--' }}
-                    </template>
-                </el-table-column>
-                <el-table-column label="用户消费总金额/元" width="140" align="center">
-                    <template slot-scope="scope">
-                        {{ '--' }}
+                        {{ scope.row.totalPayable || '0' }}
                     </template>
                 </el-table-column>
+                <el-table-column label="用户充值总金额/元" width="160" align="center" prop="userTopAllMoney"></el-table-column>
+                <el-table-column label="用户消费总金额/元" width="140" align="center"
+                    prop="userConsumeAllMoney"></el-table-column>
                 <el-table-column label="用户退款总金额/元" width="140" align="center">
                     <template slot-scope="scope">
-                        {{ '--' }}
-                    </template>
-                </el-table-column>
-                <el-table-column label="更新时间" width="140" align="center">
-                    <template slot-scope="scope">
-                        {{ '--' }}
+                        {{ scope.row.userRefundAllMoney || '0' }}
                     </template>
                 </el-table-column>
+                <el-table-column label="用户剩余总金额/元" width="140" align="center" prop="userBalance"></el-table-column>
                 <el-table-column label="操作" width="180" align="center">
                     <template slot-scope="scope">
-                        <el-button size="mini" type="primary" plain @click="handleUpdate(scope.$index, scope.row)">
+                        <el-button size="mini" type="primary" plain @click="handleUpdate(scope.$index, scope.row)"
+                            v-if="scope.row.status === 1">
                             上账
                         </el-button>
-                        <el-button size="mini" type="primary" plain @click="SettleAccount(scope.$index, scope.row)">
+                        <el-button size="mini" type="success" plain @click="SettleAccount(scope.$index, scope.row)"
+                            v-else>
                             结算
                         </el-button>
-                        <el-button size="mini" type="primary" plain @click="forbidden">
+                        <el-button size="mini" type="danger" plain @click="forbiddenStatus(scope.$index, scope.row)"
+                            v-if="scope.row.status === 1">
                             禁用
                         </el-button>
-                        <el-button size="mini" type="primary" plain @click="enable">
+                        <el-button size="mini" type="warning" plain @click="enable(scope.$index, scope.row)" v-else>
                             启用
                         </el-button>
                     </template>
@@ -102,38 +83,37 @@
                 :page-size="listQuery.pageSize" :page-sizes="[10, 15, 20]" :total="total">
             </el-pagination>
         </div>
-        <el-dialog title="提示" :visible.sync="forbiddenDialogVisible" width="30%" :before-close="handleClose">
+        <el-dialog title="提示" :visible.sync="forbiddenDialogVisible" width="30%">
             <span v-if="isforbidden === false">此操作将会禁用该渠道的所有用户(正在充电的用户,会在本次充电完成后被禁用),使其无法充电,是否继续。</span>
             <span v-else>该操作会将该渠道禁用的用户,重新启用,是否继续。</span>
             <span slot="footer" class="dialog-footer">
                 <el-button @click="forbiddenDialogVisible = false">取 消</el-button>
-                <el-button type="primary" @click="forbiddenDialogVisible = false">确 定</el-button>
+                <el-button type="primary" @click="confirmForbidden">确 定</el-button>
             </span>
         </el-dialog>
         <el-dialog :title="isEdit ? '渠道上账' : '渠道结算'" :visible.sync="dialogVisible" width="40%">
-            <el-form :model="admin" ref="adminForm" label-width="150px" size="small">
+            <el-form :model="admin" ref="adminForm" label-width="150px" :rules="rules" size="small">
                 <div style="font-size: 18px;font-weight: bold;">渠道信息</div>
                 <el-form-item label="渠道编号:">
-                    <template>{{ 'WQHIAHS124342DSAD' }}</template>
+                    <template><span style="color: #969595;">{{ admin.appId }}</span></template>
                 </el-form-item>
                 <el-form-item label="渠道名称:">
-                    <template>{{ 'WQHIAHS124342DSAD' }}</template>
+                    <template><span style="color: #969595;">{{ admin.thirdPartyName }}</span></template>
                 </el-form-item>
                 <div style="font-size: 18px;font-weight: bold;">使用情况</div>
                 <el-form-item label="渠道上账总金额/元:">
-                    <template> {{ '10.00' }} </template>
+                    <template><span style="color: #969595;">{{ admin.topAllMoney }}</span></template>
                 </el-form-item>
                 <el-form-item label="渠道应付总金额/元:">
-                    <template> {{ '50.00' }} </template>
+                    <template><span style="color: #969595;">{{ admin.totalPayable || '0' }}</span></template>
                 </el-form-item>
-                <el-form-item label="本次上账金额/元:">
-                    <el-input v-model="admin.note" placeholder="请输入上账金额" type="text" :rows="5"
+                <el-form-item label="本次上账金额/元:" prop="upAccount">
+                    <el-input v-model="admin.money" placeholder="请输入上账金额" type="text" :rows="5"
                         style="width: 250px"></el-input>
-                        <el-checkbox v-if="!isEdit" v-model="checked">负数</el-checkbox>
+                    <el-checkbox v-if="!isEdit" v-model="admin.checked">负数</el-checkbox>
                 </el-form-item>
                 <el-form-item label="上传凭证:">
-                    <el-upload action="https://jsonplaceholder.typicode.com/posts/" list-type="picture-card"
-                        :on-preview="handlePictureCardPreview" :on-remove="handleRemove">
+                    <el-upload action="https://jsonplaceholder.typicode.com/posts/" list-type="picture-card">
                         <i class="el-icon-plus"></i>
                     </el-upload>
                 </el-form-item>
@@ -143,35 +123,18 @@
                 <el-button type="primary" @click="handleDialogConfirm()" size="small">确 定</el-button>
             </span>
         </el-dialog>
-        <el-dialog title="分配角色" :visible.sync="allocDialogVisible" width="30%">
-            <el-select v-model="allocRoleIds" multiple placeholder="请选择" size="small" style="width: 80%">
-                <el-option v-for="item in allRoleList" :key="item.id" :label="item.name" :value="item.id">
-                </el-option>
-            </el-select>
-            <span slot="footer" class="dialog-footer">
-                <el-button @click="allocDialogVisible = false" size="small">取 消</el-button>
-                <el-button type="primary" @click="handleAllocDialogConfirm()" size="small">确 定</el-button>
-            </span>
-        </el-dialog>
     </div>
 </template>
 <script>
-import {
-    fetchList,
-    createAdmin,
-    updateAdmin,
-    updateStatus,
-    deleteAdmin,
-    getRoleByAdmin,
-    allocRole,
-} from "@/api/login";
-import { fetchAllRoleList } from "@/api/role";
+import { useConditionList, updateStatus, upTheAccount } from "@/api/channel";
 import { formatDate } from "@/utils/date";
 
 const defaultListQuery = {
     pageNum: 1,
     pageSize: 10,
-    keyword: null,
+    ecName: null,
+    startTime: '',
+    endTime: ''
 };
 const defaultAdmin = {
     id: null,
@@ -183,9 +146,10 @@ const defaultAdmin = {
     status: 1,
 };
 export default {
-    name: "adminList",
+    name: "useCondition",
     data() {
         return {
+            setQuery: {},
             date: '',
             isforbidden: false,
             forbiddenDialogVisible: false,
@@ -196,15 +160,25 @@ export default {
             dialogVisible: false,
             admin: Object.assign({}, defaultAdmin),
             isEdit: false,
-            allocDialogVisible: false,
             allocRoleIds: [],
             allRoleList: [],
             allocAdminId: null,
+            rules: { upAccount: [{ required: true, message: "请输入金额", trigger: "blur", }] }
         };
     },
+    watch: {
+        date(val) {
+            if (val) {
+                this.listQuery.startTime = Date.parse(val[0]);
+                this.listQuery.endTime = Date.parse(val[1]);
+            } else {
+                this.listQuery.startTime = "";
+                this.listQuery.endTime = "";
+            }
+        },
+    },
     created() {
         this.getList();
-        this.getAllRoleList();
     },
     filters: {
         formatDateTime(time) {
@@ -217,21 +191,50 @@ export default {
     },
     methods: {
         // 启用
-        enable() {
+        enable(index, row) {
             this.isforbidden = true
             this.forbiddenDialogVisible = true
+            this.setQuery = row
         },
         // 禁用
-        forbidden() {
+        forbiddenStatus(index, row) {
             this.isforbidden = false
             this.forbiddenDialogVisible = true
+            this.setQuery = row
+        },
+
+        // 确认禁用/启用
+        confirmForbidden() {
+            let isEnable = ''
+            if (this.isforbidden === true) {
+                isEnable = 1
+            } else {
+                isEnable = 2
+            }
+            updateStatus(this.setQuery.thirdPartyId, isEnable).then((res) => {
+                this.forbiddenDialogVisible = false
+                if (res.code == 200) {
+                    this.$message({
+                        message: "修改成功!",
+                        type: "success",
+                    });
+                    this.getList();
+                }
+            })
         },
 
         // 结算
-        SettleAccount() {
+        SettleAccount(index, row) {
             this.dialogVisible = true;
             this.isEdit = false;
-            this.admin = Object.assign({}, defaultAdmin);
+            this.admin = Object.assign({}, row);
+        },
+
+        // 上账
+        handleUpdate(index, row) {
+            this.dialogVisible = true;
+            this.isEdit = true;
+            this.admin = Object.assign({}, row);
         },
 
         handleResetSearch() {
@@ -250,67 +253,32 @@ export default {
             this.listQuery.pageNum = val;
             this.getList();
         },
-        handleStatusChange(index, row) {
-            this.$confirm("是否要修改该状态?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            })
-                .then(() => {
-                    updateStatus(row.id, { status: row.status }).then((response) => {
-                        this.$message({
-                            type: "success",
-                            message: "修改成功!",
-                        });
-                    });
-                })
-                .catch(() => {
-                    this.$message({
-                        type: "info",
-                        message: "取消修改",
-                    });
-                    this.getList();
-                });
-        },
-        handleDelete(index, row) {
-            this.$confirm("是否要删除该用户?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            }).then(() => {
-                deleteAdmin(row.id).then((response) => {
-                    this.$message({
-                        type: "success",
-                        message: "删除成功!",
-                    });
-                    this.getList();
-                });
-            });
-        },
-        handleUpdate(index, row) {
-            this.dialogVisible = true;
-            this.isEdit = true;
-            this.admin = Object.assign({}, row);
-        },
+
         handleDialogConfirm() {
             this.$confirm("是否要确认?", "提示", {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
                 type: "warning",
             }).then(() => {
+                let updateData = {
+                    money: this.admin.money,
+                    thirdPartyInfoId: this.admin.thirdPartyId,
+                    type: this.isEdit == true ? 1 : 2,
+                    voucherPic: ''
+                }
                 if (this.isEdit) {
-                    updateAdmin(this.admin.id, this.admin).then((response) => {
+                    upTheAccount({ ...updateData }).then((response) => {
                         this.$message({
-                            message: "修改成功!",
+                            message: "上账成功!",
                             type: "success",
                         });
                         this.dialogVisible = false;
                         this.getList();
                     });
                 } else {
-                    createAdmin(this.admin).then((response) => {
+                    upTheAccount({ ...updateData }).then((response) => {
                         this.$message({
-                            message: "添加成功!",
+                            message: "结算成功!",
                             type: "success",
                         });
                         this.dialogVisible = false;
@@ -319,54 +287,16 @@ export default {
                 }
             });
         },
-        handleAllocDialogConfirm() {
-            this.$confirm("是否要确认?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            }).then(() => {
-                let params = new URLSearchParams();
-                params.append("adminId", this.allocAdminId);
-                params.append("roleIds", this.allocRoleIds);
-                allocRole(params).then((response) => {
-                    this.$message({
-                        message: "分配成功!",
-                        type: "success",
-                    });
-                    this.allocDialogVisible = false;
-                });
-            });
-        },
-        handleSelectRole(index, row) {
-            this.allocAdminId = row.id;
-            this.allocDialogVisible = true;
-            this.getRoleListByAdmin(row.id);
-        },
         getList() {
             this.listLoading = true;
-            fetchList(this.listQuery).then((response) => {
+            useConditionList(this.listQuery).then((response) => {
                 this.listLoading = false;
                 this.list = response.data.list;
                 this.total = response.data.total;
             });
         },
-        getAllRoleList() {
-            fetchAllRoleList().then((response) => {
-                this.allRoleList = response.data;
-            });
-        },
-        getRoleListByAdmin(adminId) {
-            getRoleByAdmin(adminId).then((response) => {
-                let allocRoleList = response.data;
-                this.allocRoleIds = [];
-                if (allocRoleList != null && allocRoleList.length > 0) {
-                    for (let i = 0; i < allocRoleList.length; i++) {
-                        this.allocRoleIds.push(allocRoleList[i].id);
-                    }
-                }
-            });
-        },
     },
 };
 </script>
-<style></style>
+<style>
+</style>