Commit f33ef8ab by caoyanzhi

update: 切换默认商户

parent f7386d05
......@@ -10,7 +10,7 @@
<el-dropdown-item v-for="el in storeList" :key="el.enterpriseId" :class="['store-item', { actived: el.enterpriseId == activedStoreId }]" :command="el.enterpriseId">
<div>
<div class="store-name">{{ el.brandName }}</div>
<div class="default-store-tag" v-if="el.enterpriseId == defaultStoreId">默认商户</div>
<div class="default-store-tag" v-if="el.defaultFlag == 1">默认商户</div>
</div>
<i class="el-icon-check checked" v-if="el.enterpriseId == activedStoreId"></i>
</el-dropdown-item>
......@@ -35,7 +35,6 @@
</template>
<script>
// 更改默认商户 接口联调
import { getRequest } from '@/api/api.js';
import errorMsg from '@/common/js/error.js';
import expiredDialog from '@/components/company/expired-dialog.vue';
......@@ -51,7 +50,6 @@ export default {
},
storeList: [],
activedStoreId: '',
defaultStoreId: '',
isExpired: false
};
},
......@@ -85,10 +83,9 @@ export default {
this.$emit('changeStore', true);
getRequest('/haoban-manage3-web/enterprise-is-over', { enterpriseId })
.then(res => {
let resData = res.data;
const { errorCode, result } = res.data || {};
if (errorCode != 1) {
errorMsg.errorMsg(resData);
errorMsg.errorMsg(res.data);
return;
}
this.isExpired = result;
......@@ -104,9 +101,22 @@ export default {
// onClosed() {},
onSave() {
this.changeStore.loading = true;
setTimeout(() => {
this.changeStore.loading = false;
}, 1000);
getRequest('/haoban-manage3-web/set-default-gicenterprise', { enterpriseId: this.changeStore.storeId })
.then(res => {
const { errorCode } = res.data || {};
if (errorCode != 1) {
errorMsg.errorMsg(res.data);
return;
}
this.getStoreList();
this.changeStore.show = false;
this.$message.succes('设置成功');
})
.finally(() => {
setTimeout(() => {
this.changeStore.loading = false;
}, 100);
});
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment