Commit d85c7ded by 前端

添加loading

1 parent 8ca5f117
<template> <template>
<div class="scrm-main"> <div class="scrm-main" v-loading="loading">
<div v-show="step == 1"> <div v-show="step == 1">
<div class="account-header scrm-flex-between scrm-box-f"> <div class="account-header scrm-flex-between scrm-box-f">
<span>创建子商户/门店</span> <span>创建子商户/门店</span>
...@@ -110,6 +110,7 @@ export default { ...@@ -110,6 +110,7 @@ export default {
} }
} }
return { return {
loading: false,
editStatus: false, editStatus: false,
nextStatus: false, nextStatus: false,
accountTypesRule: false, accountTypesRule: false,
...@@ -232,10 +233,12 @@ export default { ...@@ -232,10 +233,12 @@ export default {
}, },
//下一步 //下一步
handleNext() { handleNext() {
this.loading = true
const pm1 = new Promise((resolve, reject) => { const pm1 = new Promise((resolve, reject) => {
this.$refs.baseInfoForm.$refs.baseForm.validate(valid => { this.$refs.baseInfoForm.$refs.baseForm.validate(valid => {
if (valid) resolve() if (valid) resolve()
else { else {
this.loading = false
setTimeout(() => { setTimeout(() => {
var isError = document.getElementsByClassName('is-error') var isError = document.getElementsByClassName('is-error')
isError[0].querySelector('input').focus() isError[0].querySelector('input').focus()
...@@ -248,6 +251,7 @@ export default { ...@@ -248,6 +251,7 @@ export default {
this.$refs.accountInfoForm.validate(valid => { this.$refs.accountInfoForm.validate(valid => {
if (valid) resolve() if (valid) resolve()
else { else {
this.loading = false
pm1.then(() => { pm1.then(() => {
document.querySelector('#app').scrollTop = 1000 document.querySelector('#app').scrollTop = 1000
}) })
...@@ -259,10 +263,12 @@ export default { ...@@ -259,10 +263,12 @@ export default {
}) })
}) })
if (this.accounttypeId.length == 0) { if (this.accounttypeId.length == 0) {
this.loading = false
this.accountTypesRule = true this.accountTypesRule = true
return return
} }
if (this.accountAddForm.merchantType == 1 && this.accountAddForm.merchantOrgcode && !util.checkIdCard(this.accountAddForm.merchantOrgcode)) { if (this.accountAddForm.merchantType == 1 && this.accountAddForm.merchantOrgcode && !util.checkIdCard(this.accountAddForm.merchantOrgcode)) {
this.loading = false
this.$message.error('请输入正确的身份证号码') this.$message.error('请输入正确的身份证号码')
document.querySelector('#app').scrollTop = 0 document.querySelector('#app').scrollTop = 0
setTimeout(() => { setTimeout(() => {
...@@ -284,6 +290,7 @@ export default { ...@@ -284,6 +290,7 @@ export default {
if (this.accountAddForm.residentPhone) { if (this.accountAddForm.residentPhone) {
const result = reg.test(this.accountAddForm.residentPhone) const result = reg.test(this.accountAddForm.residentPhone)
if (!result) { if (!result) {
this.loading = false
this.$message({ this.$message({
message: '请输入正确的驻店信息', message: '请输入正确的驻店信息',
type: 'warning' type: 'warning'
...@@ -322,6 +329,7 @@ export default { ...@@ -322,6 +329,7 @@ export default {
Promise.all([pm1, pm2]).then(() => { Promise.all([pm1, pm2]).then(() => {
this.$apis.store[merchant](params).then(res => { this.$apis.store[merchant](params).then(res => {
if (res) { if (res) {
this.loading = false
this.step = 2 this.step = 2
this.nextStatus = true this.nextStatus = true
if (typeof res == 'number') { if (typeof res == 'number') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!