merchant_detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <div class="app-container">
  3. <div>
  4. <el-form class="my-form" ref="mainForm" :model="mainForm" label-width="100px" label-position="right">
  5. <el-form-item label="商户账号" prop="account">
  6. <el-input v-model="mainForm.account" disabled></el-input>
  7. </el-form-item>
  8. <el-form-item label="账户昵称" prop="nickName">
  9. <el-input v-model="mainForm.nickName" disabled></el-input>
  10. </el-form-item>
  11. <el-form-item label="负责人" prop="chargePerson">
  12. <el-input v-model="mainForm.chargePerson" disabled></el-input>
  13. </el-form-item>
  14. <el-form-item label="联系电话" prop="phone">
  15. <el-input v-model="mainForm.phone" disabled></el-input>
  16. </el-form-item>
  17. <el-form-item label="金蝶主体账号" prop="kingdeeId">
  18. <el-input v-model="mainForm.kingdeeId" disabled></el-input>
  19. </el-form-item>
  20. <el-form-item label="金蝶主体名称" prop="kingdeeName">
  21. <el-input v-model="mainForm.kingdeeName" disabled></el-input>
  22. </el-form-item>
  23. <el-form-item label="电子邮箱" prop="email">
  24. <el-input v-model="mainForm.email" disabled></el-input>
  25. </el-form-item>
  26. <el-form-item label="地址" prop="address">
  27. <el-input v-model="mainForm.address" disabled></el-input>
  28. </el-form-item>
  29. <el-form-item label="登录密码" prop="password">
  30. <el-input v-model="mainForm.password" type="password" disabled></el-input>
  31. <el-button class="reset" @click="handleReset()">重置密码</el-button>
  32. </el-form-item>
  33. <!-- <el-form-item class="tr">
  34. <el-button type="primary" @click="submitmainForm">保存</el-button>
  35. </el-form-item> -->
  36. </el-form>
  37. </div>
  38. <div class="page-footer">
  39. <div class="footer" :class="classObj">
  40. <!-- <el-button type="primary" @click="submitMainForm" :loading="formLoading">{{ formLoading ? '保存中 ...' : '保 存' }}</el-button> -->
  41. <el-popconfirm
  42. title="确定关闭吗?"
  43. @onConfirm="goBack"
  44. style="margin-left: 10px;"
  45. >
  46. <el-button slot="reference">关 闭</el-button>
  47. </el-popconfirm>
  48. </div>
  49. </div>
  50. <!-- 重置密码 -->
  51. <el-dialog title="重置密码" :visible.sync="resetFormVisible" :show-close="false" width="40%" :close-on-click-modal="false">
  52. <el-form ref="resetForm" :model="resetForm" :rules="resetFormRules" label-position="left" label-width="100px">
  53. <el-form-item label="输入新密码" prop="newPassword">
  54. <el-input v-model="resetForm.newPassword" ref="password1" autocomplete="off" placeholder="请输入新密码" :type="passwordType1"></el-input>
  55. <span class="show-pwd" @click="showPwd(1)">
  56. <svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
  57. </span>
  58. </el-form-item>
  59. <el-form-item label="确认密码" prop="confirmPassword">
  60. <el-input v-model="resetForm.confirmPassword" ref="password2" autocomplete="off" placeholder="请再次输入新密码" :type="passwordType2"></el-input>
  61. <span class="show-pwd" @click="showPwd(2)">
  62. <svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
  63. </span>
  64. </el-form-item>
  65. </el-form>
  66. <div slot="footer" class="dialog-footer">
  67. <el-button @click="cancelResetForm">取 消</el-button>
  68. <el-button type="primary" @click="submitResetForm">确 定</el-button>
  69. </div>
  70. </el-dialog>
  71. </div>
  72. </template>
  73. <script>
  74. import { getToken } from '@/utils/auth'
  75. import { getDetail, resetPassword, editAccount } from "@/api/merchant";
  76. export default {
  77. data() {
  78. var validatePass = (rule, value, callback) => {
  79. if (value === '') {
  80. callback(new Error('请输入登录密码'));
  81. } else if (value.length < 12) {
  82. callback(new Error('密码长度至少12位'));
  83. } else if (/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/.test(value) == false) {
  84. callback(new Error('密码必须包含数字和字母'));
  85. } else {
  86. if (this.resetForm.confirmPassword !== '') {
  87. this.$refs.resetForm.validateField('confirmPassword');
  88. }
  89. callback();
  90. }
  91. };
  92. var validatePass2 = (rule, value, callback) => {
  93. if (value === '') {
  94. callback(new Error('请再次输入密码'));
  95. } else if (value !== this.resetForm.newPassword) {
  96. callback(new Error('两次输入密码不一致'));
  97. } else {
  98. callback();
  99. }
  100. };
  101. return {
  102. baseURL: process.env.VUE_APP_BASE_API,
  103. myHeaders: {'x-token': getToken()},
  104. id: null,
  105. companyWechatId: null,
  106. step: 'first',
  107. mainForm: {
  108. account: '', // 账号
  109. nickName: '', // 用户名
  110. chargePerson: '', // 负责人
  111. phone: '', // 联系电话
  112. kingdeeId: '',
  113. kingdeeName: '',
  114. email: '', // 电子邮箱
  115. address: '', // 地址
  116. newPassword: '', // 新密码
  117. confirmPassword: '', // 确认密码
  118. },
  119. passwordType1: 'password',
  120. passwordType2: 'password',
  121. resetFormVisible: false,
  122. resetForm: {
  123. newPassword: '', // 新密码
  124. confirmPassword: '', // 确认密码
  125. },
  126. resetFormRules: {
  127. newPassword: [
  128. { required: true, validator: validatePass, trigger: 'blur' }
  129. ],
  130. confirmPassword: [
  131. { required: true, validator: validatePass2, trigger: 'blur' }
  132. ],
  133. },
  134. formLoading: false,
  135. }
  136. },
  137. computed: {
  138. sidebar() {
  139. return this.$store.state.app.sidebar
  140. },
  141. classObj() {
  142. return {
  143. hideSidebar: !this.sidebar.opened,
  144. openSidebar: this.sidebar.opened
  145. }
  146. },
  147. },
  148. created() {
  149. const { id } = this.$route.query;
  150. this.id = id;
  151. this.getDetail();
  152. },
  153. methods: {
  154. goBack() {
  155. this.$router.go(-1);
  156. },
  157. // 获取详情
  158. getDetail() {
  159. getDetail({adminUserId: this.id}).then(res => {
  160. this.mainForm.account = res.data.userName;
  161. this.mainForm.nickName = res.data.nickName;
  162. this.mainForm.chargePerson = res.data.linkName;
  163. this.mainForm.phone = res.data.linkPhone;
  164. this.mainForm.kingdeeId = res.data.useOrgNumber;
  165. this.mainForm.kingdeeName = res.data.useOrgName;
  166. this.mainForm.email = res.data.email;
  167. this.mainForm.address = res.data.address;
  168. this.mainForm.password = '************';
  169. })
  170. },
  171. // 重置密码
  172. handleReset(id) {
  173. this.resetId = id;
  174. this.resetFormVisible = true;
  175. },
  176. // 取消重置密码
  177. cancelResetForm(){
  178. this.resetFormVisible = false;
  179. this.passwordType1 = 'password';
  180. this.passwordType2 = 'password';
  181. this.$refs.resetForm.resetFields();
  182. },
  183. // 提交重置密码
  184. submitResetForm() {
  185. this.$refs.resetForm.validate((valid) => {
  186. if (valid) {
  187. let params = {
  188. password: this.resetForm.newPassword,
  189. adminUserId: this.id
  190. }
  191. resetPassword(params).then(res => {
  192. this.cancelResetForm();
  193. this.getDetail();
  194. this.$successMsg();
  195. })
  196. }
  197. })
  198. },
  199. // 显示隐藏密码
  200. showPwd(num) {
  201. if(num == 1) {
  202. if (this.passwordType1 === 'password') {
  203. this.passwordType1 = ''
  204. } else {
  205. this.passwordType1 = 'password'
  206. }
  207. this.$nextTick(() => {
  208. this.$refs.password1.focus()
  209. })
  210. }
  211. if(num == 2) {
  212. if (this.passwordType2 === 'password') {
  213. this.passwordType2 = ''
  214. } else {
  215. this.passwordType2 = 'password'
  216. }
  217. this.$nextTick(() => {
  218. this.$refs.password2.focus()
  219. })
  220. }
  221. },
  222. submitMainForm() {
  223. this.$refs.mainForm.validate((valid) => {
  224. if (valid) {
  225. this.formLoading = true;
  226. let params = {
  227. adminUserId: this.id,
  228. corpId: this.mainForm.enterpriseId,
  229. secret2: this.mainForm.listSecret,
  230. secret3: this.mainForm.listSyncSecret,
  231. agentId1: this.mainForm.appAgentId,
  232. secret1: this.mainForm.appSecret,
  233. appId: this.mainForm.appId,
  234. mchId: this.mainForm.merchantId,
  235. mchKey: this.mainForm.merchantKey,
  236. subAppId: this.mainForm.childAppId,
  237. subSecret: this.mainForm.childKey,
  238. subMchId: this.mainForm.childMerchantId,
  239. template: this.mainForm.templateId,
  240. companyWechatId: this.companyWechatId
  241. }
  242. editAccount(params).then(res => {
  243. this.$successMsg('保存成功');
  244. setTimeout(() => {
  245. this.goBack();
  246. }, 1500)
  247. }).finally(res => {
  248. this.formLoading = false;
  249. })
  250. }
  251. })
  252. }
  253. }
  254. }
  255. </script>
  256. <style lang="scss" scoped>
  257. .setting_title {
  258. padding-left: 0;
  259. }
  260. .tips {
  261. font-size: 14px;
  262. }
  263. .my-card {
  264. margin-top: 20px;
  265. .box {
  266. background: rgb(235, 240, 249);
  267. padding: 10px;
  268. font-size: 14px;
  269. margin: 20px 0;
  270. line-height: 18px;
  271. ::v-deep .el-link {
  272. vertical-align: unset;
  273. }
  274. }
  275. }
  276. .my-form {
  277. width: 450px;
  278. margin-top: 20px;
  279. }
  280. .show-pwd {
  281. position: absolute;
  282. right: 15px;
  283. top: 0;
  284. font-size: 16px;
  285. cursor: pointer;
  286. user-select: none;
  287. }
  288. .question {
  289. position: absolute;
  290. right: -30px;
  291. top: 0;
  292. font-size: 20px;
  293. cursor: pointer;
  294. user-select: none;
  295. }
  296. .reset {
  297. position: absolute;
  298. right: -110px;
  299. top: 0;
  300. }
  301. .my-form2 {
  302. ::v-deep input {
  303. width: 400px;
  304. }
  305. }
  306. .tips {
  307. margin-top: 10px;
  308. span {
  309. display: inline-block;
  310. width: 300px;
  311. text-align: center;
  312. line-height: 32px;
  313. background: #ffefef;
  314. font-size: 14px;
  315. color: #f66460;
  316. }
  317. }
  318. .images {
  319. display: flex;
  320. flex-wrap: wrap;
  321. .main-img {
  322. display: flex;
  323. flex-direction: column;
  324. justify-content: center;
  325. align-items: center;
  326. width: 120px;
  327. margin-right: 20px;
  328. .img {
  329. border: 1px dashed #eaeaea;
  330. border-radius: 5px;
  331. overflow: hidden;
  332. position: relative;
  333. .el-image {
  334. display: block;
  335. }
  336. .mask {
  337. position: absolute;
  338. left: 0;
  339. top: 0;
  340. width: 120px;
  341. height: 120px;
  342. background: rgba($color: #000000, $alpha: 0.3);
  343. display: flex;
  344. align-items: center;
  345. justify-content: center;
  346. i {
  347. font-size: 20px;
  348. color: #ffffff;
  349. cursor: pointer;
  350. margin: 0 8px;
  351. }
  352. }
  353. }
  354. .text {
  355. font-size: 14px;
  356. color: #666666;
  357. }
  358. }
  359. .add {
  360. width: 120px;
  361. height: 120px;
  362. border: 1px dashed #eaeaea;
  363. border-radius: 5px;
  364. cursor: pointer;
  365. display: flex;
  366. align-items: center;
  367. justify-content: center;
  368. i {
  369. font-size: 30px;
  370. color: #999;
  371. }
  372. }
  373. .tmp-img {
  374. position: relative;
  375. .tmp {
  376. position: absolute;
  377. left: 0;
  378. top: 0;
  379. line-height: 20px;
  380. padding: 0 8px;
  381. background: #f66460;
  382. border-radius: 0 0 10px 0;
  383. font-size: 12px;
  384. color: #ffffff;
  385. }
  386. }
  387. }
  388. </style>