xiaodai2017 2 年之前
父節點
當前提交
c2f3b97e05

+ 11 - 14
src/apis/goodsCost/index.js

@@ -1,30 +1,31 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "abutment/";
 export default {
   // 添加
-  add: (data, params) => http(api + "goodupcreate", data, "post", params),
+  add: (data, params) => http(api + "createGood", data, "post", params),
   // 添加
   online_add: (data, params) => http(api + "gooduponline", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "gooduplist", data, "post", params),
-  // 获取全部规格值
+  list: (data, params) => http(api + "getGoodList", data, "post", params),
+  // ...获取全部规格值
   valueall: (data, params) => http(api + "valueall", data, "post", params),
-  // 规格值添加
+  // ...规格值添加
   valueadd: (data, params) => http(api + "valuecreate", data, "post", params),
   // 详情
-  detail: (data, params) => http(api + "goodupinfo", data, "post", params),
+  detail: (data, params) => http(api + "getGoodDetail", data, "post", params),
   // 基础信息更改
-  update: (data, params) => http(api + "goodupeditinfo", data, "post", params),
+  update: (data, params) => http(api + "updateGoodBasicsInfo", data, "post", params),
   // 成本更改
-  updateP: (data, params) => http(api + "goodupeditfee", data, "post", params),
-  // 商品数据修改(全部)
+  updateP: (data, params) => http(api + "updateGoodPriceInfo", data, "post", params),
+
+  //... 商品数据修改(全部)
   edit_update: (data, params) => http(api + "goodupedit", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "goodupdelall", data, "post", params),
   // 更新状态
   status: (data, params) => http(api + "goodexam", data, "post", params),
-  // 获取分类详情
+  // ...获取分类详情
   catinfo: (data, params) => http(api + "catinfo", data, "post", params),
   // 删除
   copy: (data, params) => http(api + "goodupcopy", data, "post", params),
@@ -33,8 +34,4 @@ export default {
 
    //同一个spuCode下所有的商品都下线
    goodupoffline: (data, params) => http(api + "goodupoffline", data, "post", params),
-   // 异常原因列表
-  resultlist: (data, params) => http(api + "resultlist", data, "post", params),
- // 异常原因列表
- checkIsUpdate: (data, params) => http(api + "checkIsUpdate", data, "post", params),
 };

+ 5 - 5
src/apis/purchaseOrder/index.js

@@ -1,19 +1,19 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "abutment/";
 export default {
   // 添加
   add: (data, params) => http(api + "add", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "cgdlist", data, "post", params),
+  list: (data, params) => http(api + "getOrderList", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "delete", data, "post", params),
   // 详情
-  detail: (data, params) => http(api + "cgdinfo", data, "post", params),
+  detail: (data, params) => http(api + "getOrderInfo", data, "post", params),
   // 更新
   update: (data, params) => http(api + "cgdedit", data, "post", params),
-  // 修改状态
-  status: (data, params) => http(api + "cgdstatus", data, "post", params),
+  // 批量供应商确认
+  status: (data, params) => http(api + "changeOrderStatus", data, "post", params),
   // 新建入库单
   orderinadd: (data, params) => http(api + "orderinadd", data, "post", params),
   // 新建入库单详情

+ 6 - 30
src/apis/sellOutOrder/index.js

@@ -1,37 +1,13 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "abutment/";
 export default {
-  // 添加
-  add: (data, params) => http(api + "aftercreate", data, "post", params),
-  // 删除
-  delete: (data, params) => http(api + "delete", data, "post", params),
   // 分页查询
-  list: (data, params) => http(api + "xsaleout", data, "post", params),
-  // 详情
-  detail: (data, params) => http(api + "saleoutinfo", data, "post", params),
-  // 更新
-  update: (data, params) => http(api + "update", data, "post", params),
-  // 修改状态
-  status: (data, params) => http(api + "salestatus", data, "post", params),
+  list: (data, params) => http(api + "saleOutList", data, "post", params),
   // 库管发货
-  saleoutsend: (data, params) => http(api + "saleoutsend", data, "post", params),
-  // 
-  salecustomer: (data, params) => http(api + "salecustomer", data, "post", params),
-  // 异常原因接口
-  reasonList: (data, params) => http(api + "resultlist", data, "post", params),
-  // 物流填写
-  setdelivery: (data, params) => http(api + "setdelivery", data, "post", params),
-  // 售后申请详情
-  afterinfo: (data, params) => http(api + "afterinfo", data, "post", params),
-  // 取消售后申请
-  aftercancel: (data, params) => http(api + "aftercancel", data, "post", params),
-  // 售后单审核状态
-  afterstatus: (data, params) => http(api + "afterstatus", data, "post", params),
-  // 确认收货
-  saleoutreceipt: (data, params) => http(api + "saleoutreceipt", data, "post", params),
+  saleoutsend: (data, params) => http(api + "outSend", data, "post", params),
+
   // 库管批量发货
-  saleoutbatch: (data, params) => http(api + "saleoutbatch", data, "post", params),
-  // 售后订单
-  createSaleAndCgdByAfter: (data, params) => http(api + "createSaleAndCgdByAfter", data, "post", params),
+  saleoutbatch: (data, params) =>
+    http(api + "outSendBatchByImport", data, "post", params),
 };

+ 1 - 1
src/apis/user/index.js

@@ -3,7 +3,7 @@ import urlConfig from "@/apis/url-config";
 // 登录
 export function login(data) {
   return http({
-    url: `${urlConfig.userURL}Api/login`,
+    url: `${urlConfig.baseURL}/abutment/login`,
     method: "post",
     data,
   });

+ 0 - 222
src/store/modules/user copy.js

@@ -1,222 +0,0 @@
-import {
-  login,
-  logout,
-  userinfo,
-  dingdingdetail,
-  usergetinfo,
-  roleProcessInfo,
-} from "@/apis/user";
-import configRouter from "@/router/data";
-import {
-  getToken,
-  setToken,
-  removeToken,
-  getMenu,
-  setMenu,
-  removeMenu,
-  getBtn,
-} from "@/utils/auth";
-const state = {
-  token: getToken(),
-  name: "",
-  avatar: require("@/assets/img/avatar.gif"),
-  introduction: "",
-  roles: ["admin"],
-  btnList: getBtn(),
-  navList: getMenu(),
-};
-const mutations = {
-  SET_TOKEN: (state, token) => {
-    state.token = token;
-  },
-  SET_MENU: (state, menu) => {
-    state.menu = menu;
-  },
-  SET_HAS: (state, has) => {
-    state.has = has;
-  },
-  SET_INTRODUCTION: (state, introduction) => {
-    state.introduction = introduction;
-  },
-  SET_NAME: (state, name) => {
-    state.name = name;
-  },
-  SET_AVATAR: (state, avatar) => {
-    state.avatar = avatar;
-  },
-  SET_ROLES: (state, roles) => {
-    state.roles = roles;
-  },
-  navListFn(state, val) {
-    if (!val) {
-      val = [];
-    }
-    state.navList = val;
-    setMenu(val);
-  },
-};
-
-const actions = {
-  // user login
-  login({ commit }, userInfo) {
-    const { username, password } = userInfo;
-    return new Promise((resolve, reject) => {
-      login({ username: username.trim(), password: password })
-        .then((response) => {
-          const { data } = response;
-          if (response.code === 0) {
-            commit("SET_TOKEN", data.token);
-            setToken(data.token);
-          }
-          resolve(response);
-        })
-        .catch((error) => {
-          reject(error);
-        });
-    });
-  },
-
-  dingUserInfor({ commit }, code) {
-    return new Promise(async (resolve, reject) => {
-      dingdingdetail(code)
-        .then((response) => {
-          const { data } = response;
-          if (response.code === 0) {
-            commit("SET_TOKEN", data.token);
-            setToken(data.token);
-            resolve("success");
-          } else {
-            resolve("error");
-          }
-        })
-        .catch((error) => {
-          reject(error);
-        });
-    });
-  },
-  async getMenuList({ commit, that }) {
-    return new Promise(async (resolve, reject) => {
-      if (!getToken()) {
-        resolve("noToken");
-      } else {
-        const { mcode, mdata, mmsg } = await getRoleMenuList();
-        console.log(mdata);
-        if (mcode >= 100 && mcode <= 104) {
-          resolve("noToken");
-        } else if (mcode !== 0) {
-          resolve({ code: mcode, data: {}, massage: mmsg });
-        } else {
-          const { arrag } = mdata;
-          // 生成页面权限
-          commit("navListFn", arrag);
-          // 生成路由
-          initRouter(arrag, that);
-          // state.commit("loginInfoCommit", res.data);
-          resolve("success");
-        }
-      }
-    });
-  },
-
-  // user logout
-  logout({ commit, state, dispatch }) {
-    return new Promise((resolve, reject) => {
-      commit("SET_TOKEN", "");
-      commit("SET_ROLES", []);
-      removeToken();
-      commit("SET_MENU", "");
-      commit("SET_HAS", "");
-
-      removeMenu();
-      // reset visited views and cached views
-      // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
-      dispatch("tagsView/delAllViews", null, { root: true });
-      resolve();
-    });
-  },
-
-  // remove token
-  resetToken({ commit }) {
-    return new Promise((resolve) => {
-      commit("SET_TOKEN", "");
-      commit("SET_ROLES", []);
-      removeToken();
-      resolve();
-    });
-  },
-};
-
-async function getRoleMenuList() {
-  let arrag = [
-    {
-      path: "/order",
-      name: "/order",
-      meta: {
-        title: "业务管理",
-        icon: 'el-icon-s-shop',
-      },
-      children: [],
-    },
-  ];
-  configRouter.forEach((v1) => {
-    const item = {
-      path: v1.menu_route,
-      name: v1.menu_route,
-      hidden: parseInt(v1.is_display + "") === 0,
-      alwaysShow: v1.alwaysShow,
-      meta: {
-        title: v1.menu_name,
-        icon: v1.menu_img,
-        noCache: v1.noCache,
-        breadcrumb: v1.breadcrumb,
-      },
-      url: v1.menu_url,
-    };
-    arrag[0].children.push(item);
-    // arrag.push(pItem);
-  });
-  return {
-    mcode: 0,
-    mdata: {
-      arrag,
-    },
-    mmsg: "",
-  };
-}
-
-function initRouter(arr) {
-  const IndexRoute = [];
-
-  arr.map((v1) => {
-    v1.component = (resolve) => require([`@/layout/index.vue`], resolve);
-    if (v1.children && v1.children.length > 0) {
-      v1.redirect = `${v1.path}/${v1.children[0].name}`;
-      // v1.noCache= true;
-      v1.children.map((v1) => {
-        v1.component = (resolve) => require([`@/views/${v1.url}.vue`], resolve);
-        return v1;
-      });
-    }
-    return v1;
-  });
-  IndexRoute.push(...arr);
-  IndexRoute.push({
-    path: "404",
-    component: () => import("@/views/error-page/404"),
-    hidden: false,
-    noCache: true,
-  });
-
-  IndexRoute.push({
-    path: "*",
-    redirect: "/404",
-  });
-  window.vm.$router.addRoutes(IndexRoute);
-}
-
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 60 - 29
src/store/modules/user.js

@@ -1,10 +1,5 @@
 import {
   login,
-  logout,
-  userinfo,
-  dingdingdetail,
-  usergetinfo,
-  roleProcessInfo,
 } from "@/apis/user";
 import configRouter from "@/router/data";
 import {
@@ -15,6 +10,15 @@ import {
   setMenu,
   removeMenu,
   getBtn,
+  get_company_list,
+  set_company_list,
+  remove_company_list,
+  get_business_company,
+  set_business_company,
+  remove_business_company,
+  get_business_companyNo,
+  set_business_companyNo,
+  remove_business_companyNo,
 } from "@/utils/auth";
 const state = {
   token: getToken(),
@@ -24,6 +28,9 @@ const state = {
   roles: ["admin"],
   btnList: getBtn(),
   navList: getMenu(),
+  company_list: get_company_list() || [],
+  business_company: get_business_company() || "",
+  business_companyNo: get_business_companyNo() || "",
 };
 const mutations = {
   SET_TOKEN: (state, token) => {
@@ -54,39 +61,56 @@ const mutations = {
     state.navList = val;
     setMenu(val);
   },
+  business_company(state, val) {
+    state.business_company = val;
+    set_business_company(val);
+  },
+  business_companyNo(state, val) {
+    state.business_companyNo = val;
+    set_business_companyNo(val);
+  },
+  company_list(state, val) {
+    state.company_list = val;
+    set_company_list(val);
+  },
 };
 
 const actions = {
   // user login
   login({ commit }, userInfo) {
-    const { username, password } = userInfo;
+    const { mobile, password } = userInfo;
     return new Promise((resolve, reject) => {
-      login({ username: username.trim(), password: password })
+      login({ mobile: mobile.trim(), password: password })
         .then((response) => {
-          const { data } = response;
-          if (response.code === 0) {
-            commit("SET_TOKEN", data.token);
-            setToken(data.token);
-          }
-          resolve(response);
-        })
-        .catch((error) => {
-          reject(error);
-        });
-    });
-  },
+          const { code, data, message } = response;
 
-  dingUserInfor({ commit }, code) {
-    return new Promise(async (resolve, reject) => {
-      dingdingdetail(code)
-        .then((response) => {
-          const { data } = response;
-          if (response.code === 0) {
-            commit("SET_TOKEN", data.token);
-            setToken(data.token);
-            resolve("success");
+          if (code === 0) {
+            const { token, supplier_list } = data ?? {};
+            if (supplier_lis && supplier_lis.length > 0) {
+              commit("SET_TOKEN", token);
+
+              // 保存默认业务公司名称
+              commit("company_list", supplier_list);
+              // 保存默认业务公司名称
+              commit("business_company", business_company);
+              // 保存默认业务公司编号
+              commit("business_companyNo", business_companyNo);
+              setToken(token);
+              resolve({
+                code: 0,
+                message: message,
+              });
+            } else {
+              resolve({
+                code: 1,
+                message: "该账户未绑定公司,不允许登录!",
+              });
+            }
           } else {
-            resolve("error");
+            resolve({
+              code: 2,
+              message: message,
+            });
           }
         })
         .catch((error) => {
@@ -94,6 +118,7 @@ const actions = {
         });
     });
   },
+
   async getMenuList({ commit, that }) {
     return new Promise(async (resolve, reject) => {
       if (!getToken()) {
@@ -128,6 +153,12 @@ const actions = {
       commit("SET_HAS", "");
 
       removeMenu();
+      remove_business_company();
+      commit("business_company", "");
+      commit("business_companyNo", "");
+      remove_business_companyNo();
+      commit("company_list", []);
+      remove_company_list();
       // reset visited views and cached views
       // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
       dispatch("tagsView/delAllViews", null, { root: true });

+ 24 - 9
src/utils/auth.js

@@ -1,14 +1,15 @@
 import Cookies from "js-cookie";
 
-const TokenKey = "Purchase-Console-Token";
-const MenuKey = "Purchase-Console-Menu";
-const BtnKey = "Purchase-Console-MenuBtn";
-const NoticeKey = "Purchase-Console-Notice";
-const mainMenuKey = "Purchase-Console-MainMenu";
-const businessCompanyKey = "Purchase-Console-businessCompany";
-const businessCompanyNoKey = "Purchase-Console-businessCompanyNo";
-const privateFieldKey = "Purchase-Console-privateField";
-const actionDataKey = "Purchase-Console-actionData";
+const TokenKey = "Purchase-Client-Console-Token";
+const MenuKey = "Purchase-Client-Console-Menu";
+const BtnKey = "Purchase-Client-Console-MenuBtn";
+const NoticeKey = "Purchase-Client-Console-Notice";
+const mainMenuKey = "Purchase-Client-Console-MainMenu";
+const businessCompanyKey = "Purchase-Client-Console-businessCompany";
+const businessCompanyNoKey = "Purchase-Client-Console-businessCompanyNo";
+const privateFieldKey = "Purchase-Client-Console-privateField";
+const actionDataKey = "Purchase-Client-Console-actionData";
+const companyListKey="Purchase-Client-Console-companyList";
 export function getToken() {
   return Cookies.get(TokenKey);
 }
@@ -97,6 +98,20 @@ export function remove_business_companyNo() {
   return Cookies.remove(businessCompanyNoKey);
 }
 
+export function get_company_list() {
+  return Cookies.get(companyListKey);
+}
+
+export function set_company_list(has) {
+  return Cookies.set(companyListKey, has);
+}
+
+export function remove_company_list() {
+  return Cookies.remove(companyListKey);
+}
+
+
+
 export function get_private_field() {
   return Cookies.get(privateFieldKey);
 }

+ 18 - 17
src/views/login/index.vue

@@ -20,15 +20,15 @@
           </h3>
         </div>
 
-        <el-form-item prop="username">
+        <el-form-item prop="mobile">
           <span class="svg-container">
             <i class="el-icon-user"></i>
           </span>
           <el-input
-            ref="username"
-            v-model="loginForm.username"
+            ref="mobile"
+            v-model="loginForm.mobile"
             placeholder="手机号"
-            name="username"
+            name="mobile"
             type="text"
             tabindex="1"
             maxlength="11"
@@ -110,7 +110,7 @@ export default {
   name: "Login",
   mixins: [resToken],
   data() {
-    const validateUsername = (rule, value, callback) => {
+    const validatemobile = (rule, value, callback) => {
       if (value === "") {
         callback(new Error("手机号不能为空!"));
       } else {
@@ -142,11 +142,11 @@ export default {
       ver: "",
       show: false,
       loginForm: {
-        username: "",
+        mobile: "",
         password: "",
       },
       loginRules: {
-        username: [{ required: true, trigger: "blur", validator: validateUsername }],
+        mobile: [{ required: true, trigger: "blur", validator: validatemobile }],
         password: [{ required: true, trigger: "blur", validator: validatePassword }],
       },
       passwordType: "password",
@@ -171,14 +171,14 @@ export default {
   },
   mounted() {
     // console.log(process.env.NODE_ENV);
-    // if (process.env.NODE_ENV === "development") {
-    //   this.loginForm = {
-    //     username: "17744520491",
-    //     password: "mlp123",
-    //   };
-    // }
-    if (this.loginForm.username === "") {
-      this.$refs.username.focus();
+    if (process.env.NODE_ENV === "development") {
+      this.loginForm = {
+        mobile: "17777777777",
+        password: "uu2222",
+      };
+    }
+    if (this.loginForm.mobile === "") {
+      this.$refs.mobile.focus();
     } else if (this.loginForm.password === "") {
       this.$refs.password.focus();
     }
@@ -215,14 +215,15 @@ export default {
           this.$store
             .dispatch("user/login", this.loginForm)
             .then((res) => {
-              if (res.code === 0) {
+              const { code, message } = res;
+              if (code === 0) {
                 // this.$router.push({
                 //   path: this.redirect || "/",
                 //   query: this.otherQuery,
                 // });
                 this.getMenu();
               } else {
-                this.$message.warning(res.message);
+                this.$message.warning(message);
                 this.loading = false;
               }
             })