|
|
@@ -8,36 +8,40 @@ import { getUserByPhone, getDetail } from "@/api/modules/homeEntry";
|
|
|
*/
|
|
|
export async function usePermission(tip?: string) {
|
|
|
let type = true;
|
|
|
- if (!localGet("createdId") && !localGet("geeker-user").userInfo.storeId) {
|
|
|
- let params = {
|
|
|
- phone: localGet("iphone") || localGet("geeker-user").userInfo.phone
|
|
|
- };
|
|
|
- const res: any = await getUserByPhone(params);
|
|
|
- if (res.data && res.data.storeId) {
|
|
|
- localSet("createdId", res.data.storeId);
|
|
|
- const resD: any = await getDetail({
|
|
|
- id: res.data.storeId
|
|
|
- });
|
|
|
- if (resD.data && resD.data.commissionRate) {
|
|
|
- localSet("commissionRate", resD.data.commissionRate);
|
|
|
- }
|
|
|
- if (resD.data && resD.data.businessSection) {
|
|
|
- localSet("businessSection", resD.data.businessSection);
|
|
|
- }
|
|
|
- } else {
|
|
|
- type = false;
|
|
|
- if (tip) {
|
|
|
- ElMessage.warning(`请完成商家入驻后再进行${tip}`);
|
|
|
- }
|
|
|
- return type;
|
|
|
+ // if (localGet("createdId") || localGet("geeker-user").userInfo.storeId) {
|
|
|
+ // // return type;
|
|
|
+ // // }
|
|
|
+ let params = {
|
|
|
+ phone: localGet("iphone") || localGet("geeker-user").userInfo.phone
|
|
|
+ };
|
|
|
+ const res: any = await getUserByPhone(params);
|
|
|
+ if (res.data && res.data.storeId) {
|
|
|
+ localSet("createdId", res.data.storeId);
|
|
|
+ const resD: any = await getDetail({
|
|
|
+ id: res.data.storeId
|
|
|
+ });
|
|
|
+ if (resD.data && resD.data.storeApplicationStatus != 1) {
|
|
|
+ return false;
|
|
|
}
|
|
|
- if (!localGet("businessSection") && !localGet("geeker-user").userInfo.businessSection) {
|
|
|
- type = false;
|
|
|
- if (tip) {
|
|
|
- ElMessage.warning(`请完成商家入驻后重新登录再进行${tip}`);
|
|
|
- }
|
|
|
- return type;
|
|
|
+ if (resD.data && resD.data.commissionRate) {
|
|
|
+ localSet("commissionRate", resD.data.commissionRate);
|
|
|
}
|
|
|
+ if (resD.data && resD.data.businessSection) {
|
|
|
+ localSet("businessSection", resD.data.businessSection);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ type = false;
|
|
|
+ if (tip) {
|
|
|
+ ElMessage.warning(`请完成商家入驻后再进行${tip}`);
|
|
|
+ }
|
|
|
+ return type;
|
|
|
+ }
|
|
|
+ if (!localGet("businessSection") && !localGet("geeker-user").userInfo.businessSection) {
|
|
|
+ type = false;
|
|
|
+ if (tip) {
|
|
|
+ ElMessage.warning(`请完成商家入驻后重新登录再进行${tip}`);
|
|
|
+ }
|
|
|
+ return type;
|
|
|
}
|
|
|
return type;
|
|
|
}
|