123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <template>
- <div class="app-container">
- <div v-show="step == 1">
- <div class="setting_title">开通账号</div>
- <el-divider></el-divider>
- <div class="tips">
- 说明:开通商户账号是指开通商城后台管理系统的总登录账号。
- </div>
- <el-card shadow="never" class="my-card">
- <el-form
- class="my-form"
- ref="mainForm"
- :model="mainForm"
- :rules="mainFormRules"
- label-width="120px"
- label-position="right"
- >
- <el-form-item label="商户账号" prop="account">
- <el-input
- v-model="mainForm.account"
- autocomplete="off"
- placeholder="请输入商户账号"
- ></el-input>
- <el-popover
- class="question"
- placement="right-start"
- title="账号设置"
- width="260"
- trigger="hover"
- content="账号设置需按数字、字母组合设置至少12位账号"
- >
- <svg-icon icon-class="question" slot="reference" />
- </el-popover>
- </el-form-item>
- <el-form-item label="账户昵称" prop="nickName">
- <el-input
- v-model="mainForm.nickName"
- autocomplete="off"
- placeholder="请输入账户昵称"
- ></el-input>
- </el-form-item>
- <el-form-item label="负责人" prop="chargePerson">
- <el-input
- v-model="mainForm.chargePerson"
- autocomplete="off"
- placeholder="请输入负责人"
- ></el-input>
- </el-form-item>
- <el-form-item label="联系电话" prop="phone">
- <el-input
- v-model="mainForm.phone"
- autocomplete="off"
- placeholder="请输入联系电话"
- ></el-input>
- </el-form-item>
- <el-form-item label="金蝶主体账号" prop="kingdeeId">
- <el-input
- v-model="mainForm.kingdeeId"
- autocomplete="off"
- placeholder="请输入金蝶主体账号"
- ></el-input>
- </el-form-item>
- <el-form-item label="金蝶主体名称" prop="kingdeeName">
- <el-input
- v-model="mainForm.kingdeeName"
- autocomplete="off"
- placeholder="请输入金蝶主体名称"
- ></el-input>
- </el-form-item>
- <el-form-item label="电子邮箱" prop="email">
- <el-input
- v-model="mainForm.email"
- autocomplete="off"
- placeholder="请输入电子邮箱"
- ></el-input>
- </el-form-item>
- <el-form-item label="地址" prop="address">
- <el-input
- v-model="mainForm.address"
- placeholder="请输入地址"
- ></el-input>
- </el-form-item>
- <el-form-item label="登录密码" prop="newPassword">
- <el-input
- v-model="mainForm.newPassword"
- ref="password1"
- auto-complete="new-password"
- placeholder="请输入登录密码"
- :type="passwordType1"
- ></el-input>
- <span class="show-pwd" @click="showPwd(1)">
- <svg-icon
- :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'"
- />
- </span>
- <el-popover
- class="question"
- placement="right-start"
- title="密码设置"
- width="260"
- trigger="hover"
- content="密码设置需按数字、字母组合设置至少12位密码"
- >
- <svg-icon icon-class="question" slot="reference" />
- </el-popover>
- </el-form-item>
- <el-form-item label="确认密码" prop="confirmPassword">
- <el-input
- v-model="mainForm.confirmPassword"
- ref="password2"
- auto-complete="confirm-password"
- placeholder="请再次输入密码"
- :type="passwordType2"
- ></el-input>
- <span class="show-pwd" @click="showPwd(2)">
- <svg-icon
- :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'"
- />
- </span>
- <el-popover
- class="question"
- placement="right-start"
- title="密码设置"
- width="260"
- trigger="hover"
- content="确认密码需要和登录密码保持一致"
- >
- <svg-icon icon-class="question" slot="reference" />
- </el-popover>
- </el-form-item>
- </el-form>
- </el-card>
- </div>
- <div class="page-footer">
- <div class="footer" :class="classObj">
- <el-button
- type="primary"
- @click="clickSubmitForm"
- :loading="formLoading"
- >{{ formLoading ? "提交中 ..." : "提 交" }}</el-button
- >
- <el-popconfirm
- title="确定关闭吗?"
- @onConfirm="goBack"
- style="margin-left: 10px"
- >
- <el-button slot="reference">关 闭</el-button>
- </el-popconfirm>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { getToken } from "@/utils/auth";
- import { addAccount } from "@/api/merchant";
- export default {
- data() {
- var validateAccount = (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 {
- callback();
- }
- };
- var validatePass3 = (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.mainForm.confirmPassword !== "") {
- this.$refs.mainForm.validateField("confirmPassword");
- }
- callback();
- }
- };
- var validatePass4 = (rule, value, callback) => {
- if (value === "") {
- callback(new Error("请再次输入密码"));
- } else if (value !== this.mainForm.newPassword) {
- callback(new Error("两次输入密码不一致"));
- } else {
- callback();
- }
- };
- return {
- baseURL: process.env.VUE_APP_BASE_API,
- myHeaders: { "x-token": getToken() },
- step: 1,
- mainForm: {
- account: "", // 账号
- nickName: "", // 用户名
- appName: "", // 小程序名称
- chargePerson: "", // 负责人
- phone: "", // 联系电话
- kingdeeId: "",
- kingdeeName: "",
- email: "", // 电子邮箱
- address: "", // 地址
- newPassword: "", // 登录密码
- confirmPassword: "", // 确认密码
- },
- mainFormRules: {
- account: [
- { required: true, validator: validateAccount, trigger: "blur" },
- ],
- nickName: [
- { required: true, message: "请输入用户名", trigger: "blur" },
- ],
- appName: [{ required: true, message: "请输入用户名", trigger: "blur" }],
- chargePerson: [
- { required: true, message: "请输入负责人", trigger: "blur" },
- ],
- phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
- kingdeeId: [
- { required: true, message: "请输入金蝶主体账号", trigger: "blur" },
- ],
- kingdeeName: [
- { required: true, message: "请输入金蝶主体密码", trigger: "blur" },
- ],
- newPassword: [
- { required: true, validator: validatePass3, trigger: "blur" },
- ],
- confirmPassword: [
- { required: true, validator: validatePass4, trigger: "blur" },
- ],
- },
- passwordType1: "password",
- passwordType2: "password",
- formLoading: false,
- };
- },
- computed: {
- sidebar() {
- return this.$store.state.app.sidebar;
- },
- classObj() {
- return {
- hideSidebar: !this.sidebar.opened,
- openSidebar: this.sidebar.opened,
- };
- },
- },
- methods: {
- goBack() {
- this.$router.go(-1);
- },
- // 显示隐藏密码
- 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();
- });
- }
- },
- // 点击 提交表单
- clickSubmitForm() {
- this.$refs.mainForm.validate((valid) => {
- if (valid) {
- this.submitForm();
- }
- });
- },
- // 提交表单
- submitForm() {
- this.formLoading = true;
- let params = {
- adminCompanyName: this.mainForm.nickName,
- useOrgNumber: this.mainForm.kingdeeId,
- useOrgName: this.mainForm.kingdeeName,
- adminUser: {
- userName: this.mainForm.account,
- adminCompanyName: this.mainForm.nickName,
- linkName: this.mainForm.chargePerson,
- linkPhone: this.mainForm.phone,
- email: this.mainForm.email,
- address: this.mainForm.address,
- password: this.mainForm.confirmPassword,
- },
- };
- addAccount(params)
- .then((res) => {
- this.$successMsg("开通成功");
- setTimeout(() => {
- this.$router.push({
- path: "/merchant/merchant_list",
- query: {},
- });
- }, 1500);
- })
- .finally((res) => {
- this.formLoading = false;
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .setting_title {
- padding-left: 0;
- }
- .tips {
- font-size: 14px;
- }
- .my-card {
- margin-top: 20px;
- .box {
- background: rgb(235, 240, 249);
- padding: 10px;
- font-size: 14px;
- margin: 20px 0;
- line-height: 18px;
- ::v-deep .el-link {
- vertical-align: unset;
- }
- }
- }
- .my-form {
- width: 450px;
- margin: 0 auto;
- }
- .show-pwd {
- position: absolute;
- right: 15px;
- top: 0;
- font-size: 16px;
- cursor: pointer;
- user-select: none;
- }
- .question {
- position: absolute;
- right: -30px;
- top: 0;
- font-size: 20px;
- cursor: pointer;
- user-select: none;
- }
- </style>
|