Explorar el Código

Merge branch 'feature/Feature-merchant' into develop

莫绍宝 hace 3 años
padre
commit
93f86a0858
Se han modificado 3 ficheros con 292 adiciones y 22 borrados
  1. 0 14
      src/permission.js
  2. 6 1
      src/views/merchant/merchant_detail.vue
  3. 286 7
      src/views/merchant/merchant_list.vue

+ 0 - 14
src/permission.js

@@ -154,20 +154,6 @@ function buildRootRoute(route) {
       }
     )
   }
-  if (code == 'merchant') {
-    let children = route.children;
-    route.children.push(
-      {
-        'code': "merchant_detail",
-        'moduleName': "商户详情",
-        'type': 2,
-        'url': '/merchant_detail',
-        'children': children,
-        'hidden': true
-      }
-    )
-    item.alwaysShow = false;
-  }
   if (code == 'msg') {
     let children = route.children;
     route.children = [];

+ 6 - 1
src/views/merchant/merchant_detail.vue

@@ -1,5 +1,6 @@
 <template>
-  <div class="app-container">
+
+   <div class="app-container">
     <div>
       <el-form class="my-form" ref="mainForm" :model="mainForm" label-width="100px" label-position="right">
         <el-form-item label="商户账号" prop="account">
@@ -72,6 +73,9 @@
     </el-dialog>
 
   </div>
+  
+
+ 
 </template>
 
 <script>
@@ -79,6 +83,7 @@ import { getToken } from '@/utils/auth'
 import { getDetail, resetPassword, editAccount } from "@/api/merchant";
 
 export default {
+ 
   data() {
     var validatePass = (rule, value, callback) => {
       if (value === '') {

+ 286 - 7
src/views/merchant/merchant_list.vue

@@ -104,6 +104,78 @@
         </el-pagination>
       </div>
     </div>
+    
+    <!-- 详情弹窗 -->
+    <el-dialog
+      title="详情"
+      :visible.sync="detailDiaLog"
+      width="30%"
+      :show-close="false"
+      :close-on-click-modal="false"
+      >
+     <div>
+      <el-form class="my-form" ref="mainForm" :model="mainForm" label-width="100px" label-position="right">
+        <el-form-item label="商户账号" prop="account">
+          <el-input v-model="mainForm.account" disabled  class="formWidth"></el-input>
+        </el-form-item>
+        <el-form-item label="账户昵称" prop="nickName">
+          <el-input v-model="mainForm.nickName" disabled class="formWidth" ></el-input>
+        </el-form-item>
+        <el-form-item label="负责人" prop="chargePerson">
+          <el-input v-model="mainForm.chargePerson" disabled class="formWidth"></el-input>
+        </el-form-item>
+        <el-form-item label="联系电话" prop="phone">
+          <el-input v-model="mainForm.phone" disabled class="formWidth"></el-input>
+        </el-form-item>
+        <el-form-item label="金蝶主体账号" prop="kingdeeId">
+          <el-input v-model="mainForm.kingdeeId" disabled class="formWidth"></el-input>
+        </el-form-item>
+        <el-form-item label="金蝶主体名称" prop="kingdeeName">
+          <el-input v-model="mainForm.kingdeeName" disabled class="formWidth"></el-input>
+        </el-form-item>
+        <el-form-item label="电子邮箱" prop="email">
+          <el-input v-model="mainForm.email" disabled class="formWidth"></el-input>
+        </el-form-item>
+        <el-form-item label="地址" prop="address">
+          <el-input v-model="mainForm.address" disabled class="formWidth"></el-input>
+        </el-form-item>
+        <el-form-item label="登录密码" prop="password">
+          <el-input v-model="mainForm.password" type="password" disabled class="formWidth"></el-input>
+          <el-button class="reset" @click="handleReset()">重置密码</el-button>
+        </el-form-item>
+        <!-- <el-form-item class="tr">
+          <el-button type="primary" @click="submitmainForm">保存</el-button>
+        </el-form-item> -->
+      </el-form>
+      
+    
+    <!-- 重置密码 -->
+    <el-dialog append-to-body title="重置密码" :visible.sync="resetFormVisible" :show-close="false" width="30%" :close-on-click-modal="false">
+      <el-form ref="resetForm" :model="resetForm" :rules="resetFormRules" label-position="left" label-width="100px">
+        <el-form-item label="输入新密码" prop="newPassword">
+          <el-input v-model="resetForm.newPassword" ref="password1" autocomplete="off" class="formWidth" placeholder="请输入新密码" :type="passwordType1"></el-input>
+          <span class="show-pwd" @click="showPwd(1)">
+            <svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
+          </span>
+        </el-form-item>
+        <el-form-item label="确认密码" prop="confirmPassword">
+          <el-input v-model="resetForm.confirmPassword" ref="password2" autocomplete="off" class="formWidth" placeholder="请再次输入新密码" :type="passwordType2"></el-input>
+          <span class="show-pwd" @click="showPwd(2)">
+            <svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
+          </span>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelResetForm">取 消</el-button>
+        <el-button type="primary" @click="submitResetForm">确 定</el-button>
+      </div>
+    </el-dialog>
+    </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="detailDiaLog = false" >取 消</el-button>
+        <el-button type="primary" @click="detailDiaLog = false">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -111,10 +183,77 @@
 import { COMMON_SELECT } from '@/utils/select_data'
 import {getList, changeAccountStatus} from "@/api/merchant";
 import {downloadFiles} from '@/utils/util'
+import { getToken } from '@/utils/auth'
+import { getDetail, resetPassword, editAccount } from "@/api/merchant";
 
 export default {
+  // components:{MERCHANT_DETAIL},
+  
   data() {
+    var validatePass = (rule, value, callback) => {
+      if (value === '') {
+        callback(new Error('请输入登录密码'));
+      } else if (value.length < 12) {
+        callback(new Error('密码长度至少12位'));
+      } else if (/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/.test(value) == false) {
+        callback(new Error('密码必须包含数字和字母'));
+      } else {
+        if (this.resetForm.confirmPassword !== '') {
+          this.$refs.resetForm.validateField('confirmPassword');
+        }
+        callback();
+      }
+    };
+    var validatePass2 = (rule, value, callback) => {
+      if (value === '') {
+        callback(new Error('请再次输入密码'));
+      } else if (value !== this.resetForm.newPassword) {
+        callback(new Error('两次输入密码不一致'));
+      } else {
+        callback();
+      }
+    };
     return {
+      baseURL: process.env.VUE_APP_BASE_API,
+      myHeaders: {'x-token': getToken()},
+      id: null,
+      companyWechatId: null,
+      step: 'first',
+      mainForm: {
+        account: '', // 账号
+        nickName: '', // 用户名
+        chargePerson: '', // 负责人
+        phone: '', // 联系电话
+        kingdeeId: '',
+        kingdeeName: '',          
+        email: '', // 电子邮箱
+        address: '', // 地址
+        newPassword: '', // 新密码
+        confirmPassword: '', // 确认密码
+      },
+
+      passwordType1: 'password',
+      passwordType2: 'password',
+
+      
+      resetFormVisible: false,
+      resetForm: {
+        newPassword: '', // 新密码
+        confirmPassword: '', // 确认密码
+      },
+      resetFormRules: {
+        newPassword: [
+          { required: true, validator: validatePass, trigger: 'blur' }
+        ],
+        confirmPassword: [
+          { required: true, validator: validatePass2, trigger: 'blur' }
+        ],
+      },
+
+      formLoading: false,
+    
+
+      detailDiaLog:false,//详情弹窗
       isOpen: false, // 是否展开条件筛选
       currentPage: 1, // 当前页码
       pageSize: 10, // 每页数量
@@ -136,8 +275,129 @@ export default {
   },
   created() {
     this.getList();
+    const { id } = this.$route.query;
+    this.id = id;
+    this.getDetail();
+  },
+   computed: {
+    sidebar() {
+      return this.$store.state.app.sidebar
+    },
+    classObj() {
+      return {
+        hideSidebar: !this.sidebar.opened,
+        openSidebar: this.sidebar.opened
+      }
+    },
   },
   methods: {
+   goBack() {
+      this.$router.go(-1);
+    },
+
+    // 获取详情
+    // getDetail() {
+      // console.log(id);
+      // getDetail({adminUserId: this.id}).then(res => {
+      //   this.mainForm.account = res.data.userName;
+      //   this.mainForm.nickName = res.data.nickName;
+      //   this.mainForm.chargePerson = res.data.linkName;
+      //   this.mainForm.phone = res.data.linkPhone;
+      //   this.mainForm.kingdeeId = res.data.useOrgNumber;
+      //   this.mainForm.kingdeeName = res.data.useOrgName;
+      //   this.mainForm.email = res.data.email;
+      //   this.mainForm.address = res.data.address;
+      //   this.mainForm.password = '************';
+      // })
+    // },
+
+    // 重置密码
+    handleReset(id) {
+      this.resetId = id;
+      this.resetFormVisible = true;
+    },
+
+    // 取消重置密码
+    cancelResetForm(){
+      this.resetFormVisible = false;
+      this.passwordType1 = 'password';
+      this.passwordType2 = 'password';
+      this.$refs.resetForm.resetFields();
+    },
+
+    // 提交重置密码
+    submitResetForm() {
+      this.$refs.resetForm.validate((valid) => {
+        if (valid) {
+          let params = {
+            password: this.resetForm.newPassword,
+            adminUserId: this.id
+          }
+          resetPassword(params).then(res => {
+            this.cancelResetForm();
+            this.getDetail();
+            this.$successMsg();
+          })
+        }
+      })
+    },
+
+    // 显示隐藏密码
+    showPwd(num) {
+      if(num == 1) {
+        if (this.passwordType1 === 'password') {
+          this.passwordType1 = ''
+        } else {
+          this.passwordType1 = 'password'
+        }
+        this.$nextTick(() => {
+          this.$refs.password1.focus()
+        })
+      }
+      if(num == 2) {
+        if (this.passwordType2 === 'password') {
+          this.passwordType2 = ''
+        } else {
+          this.passwordType2 = 'password'
+        }
+        this.$nextTick(() => {
+          this.$refs.password2.focus()
+        })
+      }
+    },
+
+    submitMainForm() {
+      this.$refs.mainForm.validate((valid) => {
+        if (valid) {
+          this.formLoading = true;
+
+          let params = {
+            adminUserId: this.id,
+            corpId: this.mainForm.enterpriseId,
+            secret2: this.mainForm.listSecret,
+            secret3: this.mainForm.listSyncSecret,
+            agentId1: this.mainForm.appAgentId,
+            secret1: this.mainForm.appSecret,
+            appId: this.mainForm.appId,
+            mchId: this.mainForm.merchantId,
+            mchKey: this.mainForm.merchantKey,
+            subAppId: this.mainForm.childAppId,
+            subSecret: this.mainForm.childKey,
+            subMchId: this.mainForm.childMerchantId,
+            template: this.mainForm.templateId,
+            companyWechatId: this.companyWechatId
+          }
+          editAccount(params).then(res => {
+            this.$successMsg('保存成功');
+            setTimeout(() => {
+              this.goBack();
+            }, 1500)
+          }).finally(res => {
+            this.formLoading = false;
+          })
+        }
+      })
+    },
     // 查询按钮权限
     checkBtnRole(value) {
       // let btnRole = this.$route.meta.roles;
@@ -206,13 +466,28 @@ export default {
       })
     },
 
-    toDetail(id) {
-      this.$router.push({
-        path: '/merchant/merchant_detail',
-        query: {
-          id
-        }
+    async toDetail(id) {
+      // this.$router.push({
+      //   path: '/merchant/merchant_detail',
+      //   query: {
+      //     id
+      //   }
+      // })
+      console.log(id);
+      this.detailDiaLog=true
+      getDetail({adminUserId: id}).then(res => {
+        this.mainForm.account = res.data.userName;
+        this.mainForm.nickName = res.data.nickName;
+        this.mainForm.chargePerson = res.data.linkName;
+        this.mainForm.phone = res.data.linkPhone;
+        this.mainForm.kingdeeId = res.data.useOrgNumber;
+        this.mainForm.kingdeeName = res.data.useOrgName;
+        this.mainForm.email = res.data.email;
+        this.mainForm.address = res.data.address;
+        this.mainForm.password = '************';
       })
+   
+
     },
 
     // 操作 - 更改状态(type: 禁用0,启用1)
@@ -239,6 +514,10 @@ export default {
 }
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
 
+ .formWidth {
+  width: 70%;
+  margin-right: 20px;
+}
 </style>