From 038f919147c7a41a733687974a76e69f15abb292 Mon Sep 17 00:00:00 2001 From: lixuan Date: Thu, 23 Feb 2023 14:18:35 +0800 Subject: [PATCH 1/3] xiugai --- src/api/login.js | 5 +- src/api/order.js | 48 +++ src/api/refineryInfo.js | 31 ++ src/components/autocomplete/index.vue | 104 +++++ src/layout/components/Navbar.vue | 19 +- src/utils/axios.js | 7 + src/views/login/index.vue | 2 + src/views/order/components/billOfLading.vue | 449 ++++++++++++++++++++ src/views/order/index.vue | 436 +++++++++++++++++++ 9 files changed, 1095 insertions(+), 6 deletions(-) create mode 100644 src/api/order.js create mode 100644 src/api/refineryInfo.js create mode 100644 src/components/autocomplete/index.vue create mode 100644 src/views/order/components/billOfLading.vue create mode 100644 src/views/order/index.vue diff --git a/src/api/login.js b/src/api/login.js index 7786ac1..d601769 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -9,6 +9,9 @@ const getRefineryByCustomerId = (phone) => { `/oil-user/oilCustomerRefineryRelation/getRefineryByCustomerId/${phone}` ); }; +const loginOut = () => { + return request.get("/oil-identity/authorization/logout"); +}; //路由 const getCustomerRouters = () => { return request.get( @@ -16,4 +19,4 @@ const getCustomerRouters = () => { ); }; -export default { login, getRefineryByCustomerId, getCustomerRouters }; +export default { login, getRefineryByCustomerId, getCustomerRouters,loginOut }; diff --git a/src/api/order.js b/src/api/order.js new file mode 100644 index 0000000..5c9f211 --- /dev/null +++ b/src/api/order.js @@ -0,0 +1,48 @@ +import request from "utils/axios.js"; +// table +const getByPage = (params) => { + return request.postJson("/oil-refinery/xoilRefineryOrder/getByPage", params); +}; +//查看提货单信息 +const findDeliveryByOrderId = (id) => { + return request.get(`/oil-refinery/xoilRefineryDelivery/findDeliveryByOrderId/${id}`); +}; +//创建提货单 +const billSave = (params) => { + return request.postJson("/oil-refinery/xoilRefineryDelivery/save", params); +}; +//修改提货单 +const update = (params) => { + return request.putJson("/oil-refinery/xoilRefineryDelivery/update", params); +}; +//查看订单信息 +const findByOrderId = (id) => { + return request.get(`/oil-refinery/xoilRefineryDelivery/findByOrderId/${id}`); +}; +//修改提货单 +const deleteBill = (params) => { + return request.putJson("/oil-refinery/xoilRefineryDelivery/delete", params); +}; +//下单 +const orderSuccess = (params) => { + return request.postJson("/oil-refinery/xoilRefineryOrder/orderSuccess", params); +}; +//订单锁定 +const orderLock = (params) => { + return request.postJson("/oil-refinery/xoilRefineryOrder/orderLock", params); +}; + + + + + +export default { + getByPage, + findDeliveryByOrderId, + billSave, + findByOrderId, + update, + deleteBill, + orderSuccess, + orderLock +}; diff --git a/src/api/refineryInfo.js b/src/api/refineryInfo.js new file mode 100644 index 0000000..0bd5767 --- /dev/null +++ b/src/api/refineryInfo.js @@ -0,0 +1,31 @@ +import request from "utils/axios.js"; +// table +const getByPage = (params) => { + return request.postJson("/oil-refinery/xoilRefineryInfo/getByPage", params); +}; +// 新增 +const save = (params) => { + return request.postJson("/oil-refinery/xoilRefineryInfo/save", params); +}; +// 修改 +const update = (params) => { + return request.postJson("/oil-refinery/xoilRefineryInfo/update", params); +}; +// 删除 +const deleteRow = (params) => { + return request.postJson("/oil-refinery/xoilRefineryInfo/delete", params); +}; +//炼厂list +const findByEntity = (params = {}) => { + return request.postJson( + "/oil-refinery/xoilRefineryInfo/findByEntity", + params + ); +}; +export default { + getByPage, + save, + update, + deleteRow, + findByEntity, +}; diff --git a/src/components/autocomplete/index.vue b/src/components/autocomplete/index.vue new file mode 100644 index 0000000..1d3b1dd --- /dev/null +++ b/src/components/autocomplete/index.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 0ca5cf6..a33455a 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -23,7 +23,7 @@ Docs - Log Out + 注销登录 @@ -35,6 +35,7 @@ import { mapGetters } from 'vuex' import Breadcrumb from '@/components/Breadcrumb' import Hamburger from '@/components/Hamburger' +import serve from "api/login.js"; export default { components: { @@ -51,10 +52,18 @@ export default { toggleSideBar() { this.$store.dispatch('app/toggleSideBar') }, - async logout() { - await this.$store.dispatch('user/logout') - this.$router.push(`/login?redirect=${this.$route.fullPath}`) - } + // async logout() { + // await this.$store.dispatch('user/logout') + // this.$router.push(`/login?redirect=${this.$route.fullPath}`) + // } + logout() { + serve.loginOut().then((res) => { + if (res.code === 20000) { + localStorage.removeItem("token"); + this.$router.push("/login"); + } + }); + }, } } diff --git a/src/utils/axios.js b/src/utils/axios.js index b35ad86..3642e91 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -24,6 +24,13 @@ export default { data: data, }); }, + putJson(url, data) { + return axios({ + url: url, + method: "put", + data: data, + }); + }, postFromData(url, data) { return axios({ url: url, diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 69a5020..a1b5f59 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -159,6 +159,8 @@ export default { return; }); } + console.log + localStorage.setItem("companyIdData",this.loginForm.networkId); localStorage.setItem("token", res.data.accessToken); this.$router.replace("/"); }) diff --git a/src/views/order/components/billOfLading.vue b/src/views/order/components/billOfLading.vue new file mode 100644 index 0000000..a19915d --- /dev/null +++ b/src/views/order/components/billOfLading.vue @@ -0,0 +1,449 @@ + + + + + diff --git a/src/views/order/index.vue b/src/views/order/index.vue new file mode 100644 index 0000000..60f9bc0 --- /dev/null +++ b/src/views/order/index.vue @@ -0,0 +1,436 @@ + + + + + From 0d3a4868f18779a86de09232d5961d289ffc1721 Mon Sep 17 00:00:00 2001 From: lixuan Date: Mon, 27 Feb 2023 16:59:16 +0800 Subject: [PATCH 2/3] xiugai --- src/api/product.js | 23 ++- src/store/getters.js | 1 + src/store/modules/user.js | 2 + src/utils/index.js | 5 + src/views/login/index.vue | 2 +- src/views/order/components/billOfLading.vue | 60 +++--- src/views/order/index.vue | 51 ++++- src/views/product/components/create.vue | 214 ++++++++++++++++---- src/views/product/index.vue | 23 ++- 9 files changed, 295 insertions(+), 86 deletions(-) diff --git a/src/api/product.js b/src/api/product.js index 5ebdfc4..1a0dc11 100644 --- a/src/api/product.js +++ b/src/api/product.js @@ -7,7 +7,7 @@ const getByPage = (params) => { ); }; //炼厂list -const findByEntity = (params = {}) => { +const findByEntity = (params) => { return request.postJson( "/oil-refinery/xoilRefineryInfo/findByEntity", params @@ -17,8 +17,29 @@ const findByEntity = (params = {}) => { const update = (params) => { return request.postJson("/oil-refinery/oilRefineryProduct/update", params); }; +// 下单 +const orderSave = (params) => { + return request.postJson( + "/oil-refinery/xoilRefineryOrder/save", + params + ); +}; +//查看企业产品 +const getRefineryProductList = (params) => { + return request.postJson( + "/oil-refinery/oilRefineryProduct/getRefineryProductList", + params + ); +}; + // 搜索客户 + const getRefineryCompanyList = (params) => { + return request.postJson("/oil-user/oilCompanyInfo/getLikeByCompanyType", params); +}; export default { getByPage, findByEntity, + orderSave, + getRefineryProductList, + getRefineryCompanyList }; diff --git a/src/store/getters.js b/src/store/getters.js index 86733ce..b8a541f 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -7,6 +7,7 @@ const getters = { auth: (state) => state.user.auth, company_type: (state) => state.user.companyType, company_id: (state) => state.user.companyId, + company_name: (state) => state.user.userCompanyName, permission_routes: (state) => state.permission.routes, }; export default getters; diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 4e2475e..0e7ce91 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -5,6 +5,7 @@ const getDefaultState = () => { auth: null, companyType: 0, companyId: "", + userCompanyName:'' }; }; @@ -21,6 +22,7 @@ const mutations = { //chainParentMark 1:总公司 0:分公司 state.companyType = data.chainParentMark; state.companyId = data.userCompany; + state.userCompanyName = data.userCompanyName; }, }; diff --git a/src/utils/index.js b/src/utils/index.js index 09d2e74..d33d6ac 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -51,3 +51,8 @@ export function isLicensePlate(no) { ); return instance.test(no); } + +export function typeJudgment(object) { + let res = {}.__proto__.toString.call(object); + return res ? res : ""; +} diff --git a/src/views/login/index.vue b/src/views/login/index.vue index c217cf1..9ea2be5 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -154,7 +154,7 @@ export default { }); return; } - + console.log() localStorage.setItem("customerToken", res.data.accessToken); this.$router.replace("/"); }) diff --git a/src/views/order/components/billOfLading.vue b/src/views/order/components/billOfLading.vue index a19915d..2837988 100644 --- a/src/views/order/components/billOfLading.vue +++ b/src/views/order/components/billOfLading.vue @@ -83,7 +83,7 @@ -
我来修改/锁定
+
修改信息
@@ -95,7 +95,7 @@
删除提货单 - {{orderTagType(item.deliveryStatus).info}} + {{orderTagType(item.deliveryStatus).info}}
@@ -126,7 +126,7 @@ 取 消 确定 修改 - 修改并锁定 + { - if (valid) { + billAddSave(e,item){ if(!e){ - this.billAddData.orderId=this.controlWindows.addInfo.id - this.billAddData.productMeasurement=this.controlWindows.addInfo.productMeasurement - order.billSave(this.billAddData).then(res=>{ - if(res.code == 20000){ - this.billAddData.deliveryStatus = 'SUBMITED' - this.billData.list.push(this.billAddData) - this.billListMeth() - this.$message.success(res.msg) - this.dialogBillAdd = false - } - }) + this.$refs["form"].validate((valid) => { + if (valid) { + this.billAddData.orderId=this.controlWindows.addInfo.id + this.billAddData.productMeasurement=this.controlWindows.addInfo.productMeasurement + order.billSave(this.billAddData).then(res=>{ + if(res.code == 20000){ + this.billAddData.deliveryStatus = 'SUBMITED' + this.billData.list.push(this.billAddData) + this.billListMeth() + this.$message.success(res.msg) + this.dialogBillAdd = false + } + })}}) }else{ - delete this.billAddData.productMeasurement - this.billAddData.deliveryStatus = e==2?'PLATENUM_LOCKED':'' - order.update(this.billAddData).then(res=>{ - if(res.code == 20000){ - this.billListMeth() - this.$message.success(res.msg) - this.dialogBillAdd = false - } + this.$confirm('确定锁定提货单?', '提示', { type: 'error' }).then(() => { + this.billAddData = item?JSON.parse(JSON.stringify(item)):{} + this.billAddData.deliveryStatus = e==2?'PLATENUM_LOCKED':'' + order.update(this.billAddData).then(res=>{ + if(res.code == 20000){ + this.billListMeth() + this.$message.success(res.msg) + this.dialogBillAdd = false + } + }) }) } - } - }) }, //更新提货单数据 billListMeth(){ diff --git a/src/views/order/index.vue b/src/views/order/index.vue index 60f9bc0..3873730 100644 --- a/src/views/order/index.vue +++ b/src/views/order/index.vue @@ -1,8 +1,19 @@