Browse Source

新增 代理列表;代理子账户列表,添加

wzh 3 years ago
parent
commit
797bad7829
4 changed files with 425 additions and 0 deletions
  1. 15 0
      src/apis/fetch.js
  2. 16 0
      src/router/index.js
  3. 160 0
      src/views/index/AgencyList.vue
  4. 234 0
      src/views/index/AgencySubAccountList.vue

+ 15 - 0
src/apis/fetch.js

@@ -244,4 +244,19 @@ export default {
   addNewPort(data) {
     return $http("/voyage/backstage/addNewPort", data);
   },
+
+  // 代理列表
+  getAgencyList(data) {
+    return $http("/proxy/list", data);
+  },
+
+  // 代理子账户列表
+  getAgencySubAccountList(data) {
+    return $http("/proxy/account/list", data);
+  },
+
+  // 添加代理子账户
+  addAgencySubAccount(data) {
+    return $http("/proxy/account/add", data);
+  },
 };

+ 16 - 0
src/router/index.js

@@ -129,6 +129,22 @@ const router = createRouter({
       },
       component: () => import("../views/index/Versions.vue"),
     },
+    {
+      path: "/agencyList",
+      name: "agencyList",
+      meta: {
+        title: "代理列表",
+      },
+      component: () => import("../views/index/AgencyList.vue"),
+    },
+    {
+      path: "/agencySubAccountList",
+      name: "agencySubAccountList",
+      meta: {
+        title: "代理子账户列表",
+      },
+      component: () => import("../views/index/AgencySubAccountList.vue"),
+    },
     {
       path: "/blockchain",
       name: "blockchain",

+ 160 - 0
src/views/index/AgencyList.vue

@@ -0,0 +1,160 @@
+<template>
+  <div class="full-container-p24">
+    <div style="display: flex; justify-content: space-between">
+      <div style="display: flex">
+        <el-input
+          placeholder="请输入代理/手机号"
+          prefix-icon="el-icon-search"
+          v-model="term"
+          clearable
+          style="height: 32px; width: 330px; line-height: 32px"
+        ></el-input>
+        <div class="seach-btn" @click="getAgencyList">查询</div>
+      </div>
+    </div>
+    <div style="margin-top: 24px">
+      <el-table :data="tableData" stripe style="width: 100%">
+        <el-table-column
+          type="index"
+          label="序号"
+          min-width="80"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="userName"
+          label="代理名称"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="phone"
+          label="手机号"
+          min-width="160"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="createTime"
+          label="入驻时间"
+          min-width="200"
+          align="center"
+        ></el-table-column>
+        <el-table-column label="操作" min-width="80" align="center">
+          <template v-slot="scope">
+            <el-button
+              @click="agencySubAccountList(scope.row.id, tableData)"
+              type="text"
+              size="small"
+            >
+              查看详情
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div style="width: 100%; text-align: right; margin-top: 43px">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          :total="total"
+          @current-change="pageChange"
+        ></el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+import { ref, h, reactive, toRefs, onMounted } from "vue";
+import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
+import store from "../../store";
+import router from "../../router";
+import md5 from "md5";
+import api from "../../apis/fetch";
+
+export default {
+  setup() {
+    let currentPage = ref(1);
+    let term = ref("");
+    let tableData = ref([]);
+    let total = ref(0);
+    async function getAgencyList() {
+      tableData.value = [];
+      let res = await api.getAgencyList({
+        currentPage: currentPage.value,
+        size: 10,
+        term: term.value,
+      });
+      if (res.data.status == 0) {
+        tableData.value = res.data.result;
+        total.value = res.data.total;
+      }
+    }
+
+    async function agencySubAccountList(id) {
+      router.push({
+        path: "/agencySubAccountList",
+        query: {
+          id,
+        },
+      });
+    }
+    function pageChange(e) {
+      currentPage.value = e;
+      getAgencyList();
+    }
+    getAgencyList();
+    onMounted(() => {});
+    return {
+      currentPage,
+      term,
+      tableData,
+      total,
+      getAgencyList,
+      agencySubAccountList,
+      pageChange,
+    };
+  },
+};
+</script>
+<style scoped>
+.seach-btn {
+  display: inline-block;
+  width: 60px;
+  height: 38px;
+  background: #0094fe;
+  border-radius: 2px;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  text-align: center;
+  line-height: 38px;
+  margin-left: 10px;
+  cursor: pointer;
+}
+
+.cargo-owner-add {
+  width: 80px;
+  height: 32px;
+  border-radius: 2px;
+  border: 1px solid #0094fe;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+  line-height: 32px;
+  text-align: center;
+  cursor: pointer;
+}
+
+:deep().el-dialog {
+  width: 560px;
+  padding: 20px 50px;
+  border-radius: 6px;
+}
+
+:deep() .el-dialog__title {
+  font-size: 18px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+}
+</style>

+ 234 - 0
src/views/index/AgencySubAccountList.vue

@@ -0,0 +1,234 @@
+<template>
+  <div class="full-container-p24">
+    <div style="display: flex; justify-content: space-between">
+      <div style="display: flex">
+        <el-input
+          placeholder="请输入代理子账户/手机号"
+          prefix-icon="el-icon-search"
+          v-model="term"
+          clearable
+          style="height: 32px; width: 330px; line-height: 32px"
+        ></el-input>
+        <div class="seach-btn" @click="getAgencySubAccountList">查询</div>
+      </div>
+      <div class="cargo-owner-add" @click="dialogFormVisible = true">
+        添加代理子账户
+      </div>
+      <el-dialog
+        title="添加代理子账户"
+        v-model="dialogFormVisible"
+        @closed="resetForm"
+      >
+        <template v-slot:default>
+          <el-form
+            :model="ruleForm"
+            :rules="rules"
+            ref="form"
+            label-width="110px"
+            label-position="left"
+          >
+            <el-form-item prop="name" label="姓名">
+              <el-input style="width: 280px" v-model="ruleForm.name"></el-input>
+            </el-form-item>
+            <el-form-item prop="phone" label="手机号">
+              <el-input
+                style="width: 280px"
+                v-model="ruleForm.phone"
+              ></el-input>
+            </el-form-item>
+          </el-form>
+        </template>
+        <template v-slot:footer>
+          <div class="dialog-footer">
+            <el-button @click="resetForm">取 消</el-button>
+            <el-button type="primary" @click="addAgencySubAccount(ruleForm)">
+              确 定
+            </el-button>
+          </div>
+        </template>
+      </el-dialog>
+    </div>
+    <div style="margin-top: 24px">
+      <el-table :data="tableData" stripe style="width: 100%">
+        <el-table-column
+          type="index"
+          label="序号"
+          min-width="80"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="userName"
+          label="代理子账户名称"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="phone"
+          label="手机号"
+          min-width="160"
+          align="center"
+        ></el-table-column>
+      </el-table>
+      <div style="width: 100%; text-align: right; margin-top: 43px">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          :total="total"
+          @current-change="pageChange"
+        ></el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+import { ref, h, reactive, toRefs, onMounted } from "vue";
+import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
+import store from "../../store";
+import router from "../../router";
+import md5 from "md5";
+import api from "../../apis/fetch";
+import { useRoute } from "vue-router";
+
+export default {
+  setup() {
+    const route = useRoute();
+    let dialogFormVisible = ref(false);
+    let form = ref(null);
+    let ruleForm = reactive({
+      ruleForm: {
+        name: "",
+        phone: "",
+      },
+    });
+    async function resetForm() {
+      dialogFormVisible.value = false;
+      form.value.resetFields();
+    }
+    const rules = reactive({
+      rules: {
+        name: [
+          { required: true, message: "请填写代理子账户名称", trigger: "blur" },
+        ],
+        phone: [
+          { required: true, message: "请填写手机号", trigger: "blur" },
+          { min: 11, max: 11, message: "请正确填写手机号", trigger: "blur" },
+        ],
+      },
+    });
+    async function addAgencySubAccount() {
+      form.value.validate(async (valid) => {
+        if (valid) {
+          let { name, phone } = ruleForm.ruleForm;
+          let res = await api.addAgencySubAccount({
+            proxyId: route.query.id,
+            name,
+            phone,
+          });
+          console.log(res);
+          if (res.data.status == 0) {
+            ElNotification.success({
+              title: "添加成功",
+              duration: 0,
+              message: `${name}:${res.data.msg}`,
+              type: "success",
+            });
+            resetForm();
+            getAgencySubAccountList();
+          } else {
+            ElNotification.error({
+              title: "失败",
+              duration: 3000,
+              message: res.data.msg,
+            });
+          }
+        } else {
+          return false;
+        }
+      });
+    }
+    let currentPage = ref(1);
+    let term = ref("");
+    let tableData = ref([]);
+    let total = ref(0);
+    async function getAgencySubAccountList() {
+      tableData.value = [];
+      let res = await api.getAgencySubAccountList({
+        currentPage: currentPage.value,
+        size: 10,
+        term: term.value,
+        proxyId: route.query.id,
+      });
+      if (res.data.status == 0) {
+        tableData.value = res.data.result;
+        total.value = res.data.total;
+      }
+    }
+
+    function pageChange(e) {
+      currentPage.value = e;
+      getAgencySubAccountList();
+    }
+    getAgencySubAccountList();
+    onMounted(() => {});
+    return {
+      currentPage,
+      term,
+      tableData,
+      total,
+      getAgencySubAccountList,
+      pageChange,
+      dialogFormVisible,
+      ...toRefs(ruleForm),
+      resetForm,
+      addAgencySubAccount,
+      dialogFormVisible,
+      form,
+      ...toRefs(rules),
+    };
+  },
+};
+</script>
+<style scoped>
+.seach-btn {
+  display: inline-block;
+  width: 60px;
+  height: 38px;
+  background: #0094fe;
+  border-radius: 2px;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  text-align: center;
+  line-height: 38px;
+  margin-left: 10px;
+  cursor: pointer;
+}
+
+.cargo-owner-add {
+  width: 140px;
+  height: 32px;
+  border-radius: 2px;
+  border: 1px solid #0094fe;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+  line-height: 32px;
+  text-align: center;
+  cursor: pointer;
+}
+
+:deep().el-dialog {
+  width: 560px;
+  padding: 20px 50px;
+  border-radius: 6px;
+}
+
+:deep() .el-dialog__title {
+  font-size: 18px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+}
+</style>