diff --git a/App.vue b/App.vue index 3d711a3..20cf837 100644 --- a/App.vue +++ b/App.vue @@ -6,6 +6,8 @@ screenHeight: 0, // 屏幕高度 customBarH: 0, // 标题导航栏高度 windowHeight: 0, // 窗口可用高度,窗口总高度 - 状态栏的高度 + supplier_id: 0, // 供应商id + canteen_id: 0, // 食堂id }, onLaunch: function() { this.disableConsole(); diff --git a/common/api.js b/common/api.js index 8375748..f8f8b53 100644 --- a/common/api.js +++ b/common/api.js @@ -1,7 +1,8 @@ // appId: 正式 null | 测试 null export const DEV = "dev"; // dev 测试 | prod 正式 export const VERSION = '1.0.0'; // 版本号 -export const DEVURL = 'http://192.168.3.29'; // 测试服请求地址 +export const DEVURL = 'http://192.168.3.78'; // 测试服请求地址 +// export const DEVURL = 'http://192.168.3.5'; // 测试服请求地址 export const PRODURL = ''; // 正式服请求地址 /* 供应商相关接口 */ @@ -13,6 +14,13 @@ export const API_SUPPLIER_QUOTATIONAPPLY = '/api/supplier/quotationApply'; // export const API_SUPPLIER_QUOTATIONORDERLIST = '/api/supplier/quotationOrderList'; // 申请报价-订单列表 export const API_SUPPLIER_PURCHASEORDERLIST = '/api/supplier/purchaseOrderList'; // 供货订单列表 export const API_SUPPLIER_QUOTATIONDETAIL = '/api/supplier/quotationDetail'; // 报价订单详情 +export const API_SUPPLIER_TEMPORARYQUOTATION = '/api/supplier/temporaryQuotation'; // 报价订单 临时保存 +export const API_SUPPLIER_QUOTATIONUPDATE = '/api/supplier/quotationUpdate'; // 改变报价订单状态 +export const API_SUPPLIER_PURCHASEORDERACCEPT = '/api/supplier/purchaseOrderAccept'; // 供应商接单 +export const API_SUPPLIER_PURCHASEDETAIL = '/api/supplier/purchaseDetail'; // 供货订单详情 +export const API_SUPPLIER_PURCHASEORDERSENDOUT = '/api/supplier/purchaseOrderSendout'; // 供应商确认发货 +export const API_SUPPLIER_PURCHASEUPLOADVOUCHER = '/api/supplier/purchaseUploadVoucher'; // 上传凭证 +export const API_SUPPLIER_PURCHASESAVEVOUCHER = '/api/supplier/purchaseSaveVoucher'; // 保存凭证 /* 食堂相关接口 */ export const API_CANTEEN_LOGIN = '/api/canteen/login'; // 登录 @@ -22,5 +30,5 @@ 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 +export const API_CANTEEN_PURCHASEDETAIL = '/api/canteen/purchaseDetail'; // 采购单详情 +export const API_CANTEEN_SUPPLIERLIST = '/api/canteen/supplierList'; // 供应商列表 \ No newline at end of file diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 8570390..dbebadf 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -21,7 +21,7 @@ const install = (Vue, vm) => { '/api/supplier/login', '/api/canteen/login' ]; - if(!config.data.token && !release_apis.includes(config.url)){ + if(!config.header.token && !release_apis.includes(config.url)){ return false; // 拦截,拦截没有token的页面,但不包括登录页的api }else{ return true; // 放行 diff --git a/common/http.js b/common/http.js index b6b1902..ad92939 100644 --- a/common/http.js +++ b/common/http.js @@ -65,13 +65,13 @@ function $http(url, data = {}, options = {}){ // 判断传入用户token if(that.$getPageType() == 'supply'){ let user_token = uni.getStorageSync('supply_token'); - if(user_token && !data.token){ - data.token = user_token; + if(user_token && !options.token){ + options.token = user_token; } }else if(that.$getPageType() == 'canteen'){ let user_token = uni.getStorageSync('canteen_token'); - if(user_token && !data.token){ - data.token = user_token; + if(user_token && !options.token){ + options.token = user_token; } } @@ -94,7 +94,7 @@ function $http(url, data = {}, options = {}){ } // 发起请求 - that.$u.post(url, data).then(res => { + that.$u.post(url, data, options).then(res => { resolve(res); }).catch(err => { reject(err); diff --git a/common/mixin.js b/common/mixin.js index 4f059e1..d5146e8 100644 --- a/common/mixin.js +++ b/common/mixin.js @@ -108,9 +108,9 @@ export default{ } }, 100); }, - $toBack(){ + $toBack(page = 1){ let pages = getCurrentPages(); // 当前页 - let beforePage = pages[pages.length - 2]; // 上个页面 + let beforePage = pages[pages.length - (page + 1)]; // 上个页面 if(beforePage && beforePage.route){ uni.navigateBack(); }else{ diff --git a/common/styles/common.css b/common/styles/common.css index b4e1b41..6a7ad9d 100644 --- a/common/styles/common.css +++ b/common/styles/common.css @@ -58,6 +58,12 @@ justify-content: right; } +.lf-row-flex-end{ + display: flex; + align-items: center; + justify-content: flex-end; +} + .lf-flex-column { display: flex; flex-direction: column; diff --git a/common/uploadFile.js b/common/uploadFile.js new file mode 100644 index 0000000..15a7505 --- /dev/null +++ b/common/uploadFile.js @@ -0,0 +1,71 @@ +/* + *上传文件 + *@param - filePath :图片的本地资源路径 + *@param - dir:表示要传到哪个目录下 + *@param - successc:成功回调 + *@param - failc:失败回调 + */ +const uploadFile = (filePath, successc, failc, that) => { + if (!filePath || filePath.length < 9) { + uni.showModal({ + title: '图片错误', + content: '请重试', + showCancel: false, + }) + return; + } + // 上传的服务器地址 + let url = that.API.DEVURL; + if (that.API.DEV == 'prod') { + url = that.API.PRODURL; + } + const url_a = that.API.API_SUPPLIER_PURCHASEUPLOADVOUCHER; + + // 上传图片的目录 + var nowTime = formatTime(new Date()); + // const dir = 'wxmini/images/' + nowTime + '/'; + const dir = 'h5/images/' + nowTime + '/'; + // 获取上传的文件类型 fileType + let fileTypeIndex = filePath.lastIndexOf('.'); + let fileType = filePath.substring(fileTypeIndex); + uni.uploadFile({ + url: url + url_a,//开发者服务器 url + filePath: filePath,//要上传文件资源的路径 + name: 'image', + header: { + token: uni.getStorageSync('supply_token') // 目前写死供应端 + }, + success: function (res) { + console.log('上传文件...', res) + if (res.statusCode != 200 || !res.data) { + failc(new Error('上传错误:' + JSON.stringify(res))) + return; + } + let res_data = JSON.parse(res.data); + successc && successc(res_data.data); + }, + fail: function (err) { + failc(err); + }, + }) +} + +// 获取当前日期(年-月-日),并不足十位补零 +function formatTime(date) { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + return [year, month, day].map(formatNumber).join('-') + // + ' ' + [hour, minute, second].map(formatNumber).join(':') +} +const formatNumber = n => { + n = n.toString() + return n[1] ? n : '0' + n +} + +module.exports = { + uploadFile +}; \ No newline at end of file diff --git a/components/lf-stepbar/lf-stepbar.vue b/components/lf-stepbar/lf-stepbar.vue new file mode 100644 index 0000000..289ae18 --- /dev/null +++ b/components/lf-stepbar/lf-stepbar.vue @@ -0,0 +1,129 @@ + + + + + diff --git a/main.js b/main.js index 1ac1a50..3733b29 100644 --- a/main.js +++ b/main.js @@ -27,6 +27,9 @@ Vue.component('lf-nocontent', lfNocontent); // 页面间隙修饰 import selfLine from '@/components/self-line/self-line'; Vue.component('self-line', selfLine); +// 将步骤条组件注入全局 +import lfStepbar from '@/components/lf-stepbar/lf-stepbar'; +Vue.component('lf-stepbar', lfStepbar); const app = new Vue({ ...App diff --git a/pages.json b/pages.json index 1bd3f44..b833b2a 100644 --- a/pages.json +++ b/pages.json @@ -90,11 +90,17 @@ } }, { - "path": "pages/canteen/classification/index", + "path": "pages/canteen/classification/supplier", "style": { "navigationBarTitleText": "添加供应商" } }, + { + "path": "pages/canteen/classification/material", + "style": { + "navigationBarTitleText": "添加物资" + } + }, { "path": "pages/canteen/delivery/apply", "style": { diff --git a/pages/canteen/classification/index.vue b/pages/canteen/classification/index.vue deleted file mode 100644 index 07806c4..0000000 --- a/pages/canteen/classification/index.vue +++ /dev/null @@ -1,119 +0,0 @@ - - - - - diff --git a/pages/canteen/classification/material.vue b/pages/canteen/classification/material.vue new file mode 100644 index 0000000..9e9f0b8 --- /dev/null +++ b/pages/canteen/classification/material.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/pages/canteen/classification/supplier.vue b/pages/canteen/classification/supplier.vue new file mode 100644 index 0000000..728f734 --- /dev/null +++ b/pages/canteen/classification/supplier.vue @@ -0,0 +1,239 @@ + + + + + diff --git a/pages/canteen/delivery/apply.vue b/pages/canteen/delivery/apply.vue index beba1ee..cf3a48c 100644 --- a/pages/canteen/delivery/apply.vue +++ b/pages/canteen/delivery/apply.vue @@ -3,7 +3,8 @@ 出库清单 - + + diff --git a/pages/canteen/index/index.vue b/pages/canteen/index/index.vue index fcb547b..c9cd443 100644 --- a/pages/canteen/index/index.vue +++ b/pages/canteen/index/index.vue @@ -48,6 +48,7 @@ console.log("getHomeData", res); this.block_list = res.data.block; this.canteen = res.data.canteen; + getApp().globalData.canteen_id = res.data.canteen.id; }) }, // 退出登录 diff --git a/pages/canteen/login/index.vue b/pages/canteen/login/index.vue index 40b4ffc..4dfcb1b 100644 --- a/pages/canteen/login/index.vue +++ b/pages/canteen/login/index.vue @@ -74,7 +74,7 @@ }).then(res => { console.log("login", res); uni.setStorageSync('canteen_token', res.data.token); - this.$url('/pages/canteen/index/index'); + this.$url('/pages/canteen/index/index', {tyep: 'redirect'}); }) } } diff --git a/pages/canteen/purchase/detail.vue b/pages/canteen/purchase/detail.vue index 148c4e4..70ce537 100644 --- a/pages/canteen/purchase/detail.vue +++ b/pages/canteen/purchase/detail.vue @@ -2,7 +2,7 @@ - 采购单 492461046128742764 + 采购单 {{ order.p_sn }} @@ -28,7 +28,7 @@ 联系电话 - 13200000000 + {{ order.contact_phone }} 证明材料 @@ -40,7 +40,7 @@ 物资明细 - + @@ -90,55 +90,46 @@ ], headers: [{ key: 'name', - label: '姓名' + label: '菜名' },{ - key: 'age', - label: '年龄' + key: 'spec', + label: '规格' },{ - key: 'sex', - label: '性别' + key: 'pre_tax_price', + label: '税前价格' },{ - key: 'height', - label: '身高' - },{ - key: 'info', - label: '描述' - },{ - key: 'operation', - label: '操作' + key: 'after_tax_price', + label: '税后价格' }], - contents: [{ - name: '张三', - age: '18', - sex: '男', - height: '192cm', - info: '无敌叫是', - operation: {button: true, key: 'delete', value: '删除'} - }, { - name: '李四', - age: '18', - sex: '男', - height: '192cm', - info: '无敌叫是' - }, { - name: '赵五', - age: '18', - sex: '男', - height: '192cm', - info: '无敌叫是' - },{ - name: '王六', - age: '18', - sex: '男', - height: '192cm', - info: '无敌叫是' - }] + contents: [], + order: {} } }, - onLoad(){ - + onLoad(options){ + this.getData(options.p_sn); }, methods: { + getData(p_sn){ + this.$http(this.API.API_CANTEEN_PURCHASEDETAIL, { + p_sn: p_sn + // p_sn: '802316269455228606' + }).then(res => { + console.log("xxx",res) + this.order = res.data.order; + let list = res.data.order.sheet || []; + let contents = list.map(item => { + return { + name: item.material.m_name, + spec: item.spec.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.spec.id, + material_id: item.material.id + } + }) + this.contents = contents; + }) + }, onButtonClick(event){ uni.showModal({ title: '温馨提示', diff --git a/pages/canteen/purchase/launch.vue b/pages/canteen/purchase/launch.vue index cc24ae2..ea93329 100644 --- a/pages/canteen/purchase/launch.vue +++ b/pages/canteen/purchase/launch.vue @@ -4,7 +4,7 @@ 供应商 - + @@ -31,8 +31,15 @@ - 物资明细 - + 物资明细 + + + + 我是供应商 + 删除 + + + @@ -66,13 +73,22 @@ key: 'after_tax_price' }], contents: [], - date: this.$shared.recordTime(new Date(), '-', 'date') + date: this.$shared.recordTime(new Date(), '-', 'date'), // 选择时间 + material_list: {} // 供应商,物资列表 } }, onLoad(){ - this.getMaterialList(); + + // 监听MaterialList被操作 + uni.$on('addMaterialList', res => { + this.material_list = res; + }) + }, + onShow(){ + console.log("material_list", this.material_list) }, methods: { + // 改接口废弃 getMaterialList(){ this.$http(this.API.API_CANTEEN_MATERIALLIST, { // category_id: 1 // 分类id 不传则显示默认分类 @@ -91,16 +107,23 @@ this.contents = contents; }) }, + // table-input值被改变 todo onInputChange(event){ console.log("检测到table input被更改", event); - this.contents[event.contentIndex][event.key].value = event.detailValue; + // this.contents[event.contentIndex][event.key].value = event.detailValue; }, + // 时间选择 pickerChange(event){ this.date = event.detail.value; }, + // 保存并发单 save(){ // todo console.log("dddddd", this.contents) + + + return; + let list = this.contents.map(item => { return { m_id: item.material_id, diff --git a/pages/canteen/purchase/order.vue b/pages/canteen/purchase/order.vue index 067aa69..6729835 100644 --- a/pages/canteen/purchase/order.vue +++ b/pages/canteen/purchase/order.vue @@ -7,7 +7,7 @@ :current="current" @change="swiperChange"> - + 采购方 {{ item.contact_name }} diff --git a/pages/supply/gonghuo/detail.vue b/pages/supply/gonghuo/detail.vue index 18a1cac..3c6e3d9 100644 --- a/pages/supply/gonghuo/detail.vue +++ b/pages/supply/gonghuo/detail.vue @@ -2,32 +2,43 @@ - 采购单 492461046128742764 + 采购单 {{ order.p_sn }} - - + + - 广西美味生活有限公司 - 广西南宁青秀区民族大道118号可爱大厦A座0930室 + {{ order.canteen.canteen_name }} + {{ order.canteen.address }} - - + + 物资明细 - + - - + + + + + + + + + 已完成 + + + 已退单 + @@ -55,89 +66,63 @@