diff --git a/common/api.js b/common/api.js index 74d6dd8..d0656a7 100644 --- a/common/api.js +++ b/common/api.js @@ -7,7 +7,19 @@ export const PRODURL = ''; // 正式服请求地址 /* 供应商相关接口 */ export const API_SUPPLIER_INDEX = '/api/supplier/index'; // 落地页 export const API_SUPPLIER_LOGIN = '/api/supplier/login'; // 登录 +export const API_SUPPLIER_CANTEENLIST = '/api/supplier/canteenList'; // 关联食堂列表 export const API_SUPPLIER_MATERIALLIST = '/api/supplier/materialList'; // 物资列表 export const API_SUPPLIER_QUOTATIONAPPLY = '/api/supplier/quotationApply'; // 申请报价 export const API_SUPPLIER_QUOTATIONORDERLIST = '/api/supplier/quotationOrderList'; // 申请报价-订单列表 -export const API_SUPPLIER_PURCHASEORDERLIST = '/api/supplier/purchaseOrderList'; // 供货订单列表 \ No newline at end of file +export const API_SUPPLIER_PURCHASEORDERLIST = '/api/supplier/purchaseOrderList'; // 供货订单列表 + +/* 食堂相关接口 */ +export const API_CANTEEN_LOGIN = '/api/canteen/login'; // 登录 +export const API_CANTEEN_INDEX = '/api/canteen/index'; // 落地页 +export const API_CANTEEN_PURCHASEAPPLY = '/api/canteen/purchaseApply'; // 发起采购 +export const API_CANTEEN_MATERIALLIST = '/api/canteen/materialList'; // 物资列表 +export const API_CANTEEN_PURCHASEORDERLIST = '/api/canteen/purchaseOrderList'; // 供货订单列表 +export const API_CANTEEN_WAREHOUSEOUT = '/api/canteen/warehouseOut'; // 出库申请 +export const API_CANTEEN_WAREHOUSEOUTLIST = '/api/canteen/warehouseOutList'; // 出库申请列表 +// export const API_CANTEEN_ = '/api/'; // +// export const API_CANTEEN_ = '/api/'; // \ No newline at end of file diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 3414abb..8570390 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -14,14 +14,17 @@ const install = (Vue, vm) => { loadingTime: 800 // 延迟800毫秒时显示加载框 }); - // 请求前拦截, 现在不做拦截 + // 请求前拦截 Vue.prototype.$u.http.interceptor.request = config => { // console.log("config", config, config.url) - // TODO 缺少食堂端config.url判断 - if(!config.data.token && config.url != '/api/supplier/login'){ - return false; + let release_apis = [ + '/api/supplier/login', + '/api/canteen/login' + ]; + if(!config.data.token && !release_apis.includes(config.url)){ + return false; // 拦截,拦截没有token的页面,但不包括登录页的api }else{ - return true; + return true; // 放行 } }; diff --git a/common/shared.js b/common/shared.js index 043dfaf..4dcfeff 100644 --- a/common/shared.js +++ b/common/shared.js @@ -24,4 +24,28 @@ export function isRight(obj) { export function isValueType(value) { let str = Object.prototype.toString.call(value); return str.match(/\[object (.*?)\]/)[1].toLowerCase(); -} \ No newline at end of file +} + +// 解析时间戳,参数非必传,不传参时默认显示当前最新日期+时间; +// 第一个参数为当前日期时间戳,第二个日期分隔符,第三个不传参或传all显示日期+时间,传date显示日期,time显示时间 +export function recordTime(time = new Date(), separator = "-", swf = 'all'){ + let year = time.getFullYear(); + let month = time.getMonth() + 1; + let day = time.getDate(); + let hour = time.getHours(); + let min = time.getMinutes(); + let ppn = time.getSeconds(); + if(swf === "time"){ + return [hour, min, ppn].map(cover).join(":"); + }else if(swf === "date"){ + return [year, month, day].map(cover).join(String(separator)); + }else{ + return [year, month, day].map(cover).join(String(separator)) +" "+ [hour, min, ppn].map(cover).join(":"); + } +} + +// 位数不足2,前面补0 +var cover = function(par) { + par = par.toString()[1] ? par : "0" + par; + return par; +}; \ No newline at end of file diff --git a/pages/canteen/delivery/apply.vue b/pages/canteen/delivery/apply.vue index 58f5776..beba1ee 100644 --- a/pages/canteen/delivery/apply.vue +++ b/pages/canteen/delivery/apply.vue @@ -3,7 +3,7 @@ 出库清单 - + @@ -14,12 +14,12 @@ 物资明细 - + - - + + @@ -41,81 +41,57 @@ key: 'spec' },{ label: '税前价', - key: 'preTax' + key: 'pre_tax_price' },{ label: '税后价', - key: 'afterTax' + key: 'after_tax_price' }], - contents: [{ - name: '黄瓜', - spec: '一打/500g', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - },{ - name: '黄豆', - spec: '5kg', - preTax: {edit: true, value: ''}, - afterTax: {edit: true, value: ''} - }] + contents: [] } }, onLoad(){ - + this.getMaterialList(); }, methods: { + getMaterialList(){ + this.$http(this.API.API_CANTEEN_MATERIALLIST, { + // category_id: 1 // 分类id 不传则显示默认分类 + }).then(res => { + let list = res.data.material || []; + let contents = list.map(item => { + return { + name: item.material.m_name, + spec: item.name, + pre_tax_price: {edit: true, value: item.tax_standard_price}, + after_tax_price: {edit: true, value: item.non_tax_standard_price}, + spec_id: item.id, + material_id: item.material.id + } + }) + this.contents = contents; + }) + }, onInputChange(event){ console.log("检测到table input被更改", event); this.contents[event.contentIndex][event.key].value = event.detailValue; + }, + save(_t){ + // todo + console.log("dddddd", this.contents) + let list = this.contents.map(item => { + return { + m_id: item.material_id, + m_spec_id: item.spec_id, + tax_price: item.pre_tax_price.value, + non_tax_price: item.after_tax_price.value + } + }); + this.$http(this.API.API_CANTEEN_WAREHOUSEOUT, { + data: list + }).then(res => { + console.log("save", res); + this.$msg('操作成功'); + }) } } } diff --git a/pages/canteen/delivery/order.vue b/pages/canteen/delivery/order.vue index cbbfbf0..1160bd2 100644 --- a/pages/canteen/delivery/order.vue +++ b/pages/canteen/delivery/order.vue @@ -7,14 +7,15 @@ :current="current" @change="swiperChange"> - + 申请人 - 李清玉 + {{ item.o_name }} 申请时间 - 2021-07-23 17:24:23 + + {{ item.o_sn }} 商品种类 @@ -22,12 +23,12 @@ 订单状态 - 等待审核 + {{ item.state }} - {{ tabItem.loading_text }} - + {{ tabItem.loading_text }} + @@ -68,8 +69,15 @@ }, onLoad(){ this.windowHeight = uni.getSystemInfoSync().windowHeight; + this.getData(); }, methods: { + getData(){ + this.$http(this.API.API_CANTEEN_WAREHOUSEOUTLIST).then(res => { + console.log("getData", res); + this.tab_list[this.current].list = res.data.list || []; + }); + }, tabsChange(current){ this.current = current; }, diff --git a/pages/canteen/index/index.vue b/pages/canteen/index/index.vue index 6a4c1e5..fcb547b 100644 --- a/pages/canteen/index/index.vue +++ b/pages/canteen/index/index.vue @@ -1,50 +1,26 @@ @@ -53,14 +29,41 @@ export default { data(){ return { - + canteen: {}, + block_list: [] } }, onLoad(){ - + this.getHomeData(); + }, + onReady(){ + // #ifndef MP + var a = document.getElementsByClassName('uni-page-head-hd')[0]; + a.style.display = 'none'; + // #endif }, methods: { - + getHomeData(){ + this.$http(this.API.API_CANTEEN_INDEX).then(res => { + console.log("getHomeData", res); + this.block_list = res.data.block; + this.canteen = res.data.canteen; + }) + }, + // 退出登录 + loginOut(){ + uni.showModal({ + title: '温馨提示', + content: '确定退出登录吗?', + confirmColor: '#11D189', + success: result => { + if(result.confirm){ + uni.removeStorageSync('canteen_token'); + this.$redirectToLogin('您已退出登录, 即将跳转...'); + } + } + }) + } } } @@ -111,8 +114,11 @@ } .exit{ padding: 0 32rpx; - bottom: 50rpx; + // bottom: 50rpx; + padding-top: 10rpx; + padding-bottom: 50rpx; box-sizing: border-box; + background-color: #F6F6F6; button{ background-color: #f0f0f0; color: #777777; diff --git a/pages/canteen/login/index.vue b/pages/canteen/login/index.vue index 5a8de65..40b4ffc 100644 --- a/pages/canteen/login/index.vue +++ b/pages/canteen/login/index.vue @@ -8,13 +8,13 @@ 登录账号 - + 登录密码 - + @@ -26,18 +26,30 @@