Commit dc28124c by 前端

Merge branch 'xuyl_v2.8.0' into 'v2.8.0'

给发送请求添加loading

See merge request !34
2 parents 4fee9379 5345081c
...@@ -315,33 +315,26 @@ export default { ...@@ -315,33 +315,26 @@ export default {
merchantId: this.merchantId, merchantId: this.merchantId,
file: this.fileBaseUrl, file: this.fileBaseUrl,
} }
customerApi.addCustomerList(params).then( const loading = this.$loading({
(res) => {
let loading = this.$loading({
lock: true, lock: true,
text: 'Loading', text: 'Loading',
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)', background: 'rgba(0, 0, 0, 0.7)',
}) })
if (res.code == '0') { customerApi.addCustomerList(params).then(
(res) => {
loading.close() loading.close()
if (res.code == '0') {
this.dialogVisible = true this.dialogVisible = true
this.uploadStatus = 'success' this.uploadStatus = 'success'
this.uploadSuccessMsg = res.data this.uploadSuccessMsg = res.data
} else { } else {
loading.close()
this.dialogVisible = true this.dialogVisible = true
this.uploadStatus = 'fail' this.uploadStatus = 'fail'
this.uploadErrorMsg = res.message this.uploadErrorMsg = res.message
} }
}, },
(err) => { (err) => {
let loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
loading.close() loading.close()
this.dialogVisible = true this.dialogVisible = true
this.uploadStatus = 'fail' this.uploadStatus = 'fail'
......
...@@ -147,7 +147,7 @@ export default { ...@@ -147,7 +147,7 @@ export default {
}, },
{ {
label: '批次号', label: '批次号',
prop: 'batchNo' prop: 'batchNo',
}, },
{ {
label: '状态', label: '状态',
...@@ -211,8 +211,15 @@ export default { ...@@ -211,8 +211,15 @@ export default {
async comfirmDialog(type) { async comfirmDialog(type) {
if (type == 'cogradient') { if (type == 'cogradient') {
// 合并 // 合并
const loading = this.$loading({
lock: true,
text: '同步中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
await customerApi.synchroCustomerList({ id: this.optionsId }).then( await customerApi.synchroCustomerList({ id: this.optionsId }).then(
(res) => { (res) => {
loading.close()
if (res.code == '0') { if (res.code == '0') {
this.$message.success('同步成功') this.$message.success('同步成功')
} else { } else {
...@@ -220,6 +227,7 @@ export default { ...@@ -220,6 +227,7 @@ export default {
} }
}, },
(err) => { (err) => {
loading.close()
this.$message.error(err) this.$message.error(err)
} }
) )
...@@ -228,8 +236,15 @@ export default { ...@@ -228,8 +236,15 @@ export default {
} }
// 删除 // 删除
if (type == 'delete') { if (type == 'delete') {
const loadingDel = this.$loading({
lock: true,
text: '删除中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
customerApi.deleteCustomerList({ id: this.optionsId }).then( customerApi.deleteCustomerList({ id: this.optionsId }).then(
(res) => { (res) => {
loadingDel.close()
if (res.code == '0') { if (res.code == '0') {
this.$message.success('删除成功') this.$message.success('删除成功')
this.$refs.merchantTable.refreshTable() this.$refs.merchantTable.refreshTable()
...@@ -238,6 +253,7 @@ export default { ...@@ -238,6 +253,7 @@ export default {
} }
}, },
(err) => { (err) => {
loadingDel.close()
this.$message.error(err) this.$message.error(err)
} }
) )
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!