diff --git a/canteen/components/wyb-table/wyb-table.vue b/canteen/components/wyb-table/wyb-table.vue index 41438a3..a6ae139 100644 --- a/canteen/components/wyb-table/wyb-table.vue +++ b/canteen/components/wyb-table/wyb-table.vue @@ -149,7 +149,7 @@ position: hIndex === 0 && firstLineFixed ? 'sticky' : 'static'}"> - {{ autoContentItem(cIndex, hIndex) }} + {{ autoContentItem(cIndex, hIndex) }} + @@ -92,6 +93,8 @@ } }, onLoad(options){ + // TODO 1、凭证上传流程变动:当采购单状态为已发货状态时,食堂可以上传凭证图片; + // TODO 2、食堂收货时,实到数、实收数默认填充采购数量; this.p_sn = options.p_sn || ''; // TODO 显示车辆等信息,显示table信息 this.getData(); diff --git a/canteen/pages/purchase/launch.vue b/canteen/pages/purchase/launch.vue index 21b86be..ac88cba 100644 --- a/canteen/pages/purchase/launch.vue +++ b/canteen/pages/purchase/launch.vue @@ -35,7 +35,7 @@ {{ value.supplier_name }} - 删除 + 删除 0; + uni.showModal({ + title: '温馨提示', + content: '删除供应商后所添加的物资将随之移除,确定继续吗?', + confirmColor: '#FF0000', + cancelColor: '#11D189', + success: result => { + if(result.confirm){ + // 移除render_material_list + let render_material_list = {...this.render_material_list}; + delete render_material_list[key]; + this.render_material_list = render_material_list; + // 移除material_list + delete this.material_list[key]; + // 校验还有没有供应商,没有则不能显示选择物资按钮 + this.show_material = Object.keys(this.material_list).length > 0; + } + } + }) }, // 保存并发单 save(_t){ diff --git a/supplier/common/api.js b/supplier/common/api.js index 922107c..97c2ed0 100644 --- a/supplier/common/api.js +++ b/supplier/common/api.js @@ -21,3 +21,4 @@ export const API_SUPPLIER_PURCHASEUPLOADVOUCHER = '/api/supplier/purchaseUploadV export const API_SUPPLIER_PURCHASESAVEVOUCHER = '/api/supplier/purchaseSaveVoucher'; // 保存凭证 export const API_SUPPLIER_QUOTATIONREUSEBYORDER = '/api/supplier/quotationReuseByOrder'; // 报价订单复用 根据【订单号】 export const API_SUPPLIER_QUOTATIONREUSEBYBATCH = '/api/supplier/quotationReuseByBatch'; // 报价订单复用 根据【批次号】 +export const API_SUPPLIER_QUOTATIONSAVE = '/api/supplier/quotationSave'; // 报价订单编辑时保存 diff --git a/supplier/components/wyb-table/wyb-table.vue b/supplier/components/wyb-table/wyb-table.vue index 41438a3..a6ae139 100644 --- a/supplier/components/wyb-table/wyb-table.vue +++ b/supplier/components/wyb-table/wyb-table.vue @@ -149,7 +149,7 @@ position: hIndex === 0 && firstLineFixed ? 'sticky' : 'static'}"> - {{ autoContentItem(cIndex, hIndex) }} + {{ autoContentItem(cIndex, hIndex) }} { - let list = res.data.spec || []; let contents = list.map(item => { return { @@ -140,20 +140,14 @@ quality_level: item?.material?.quality_level || '', number: item?.material?.m_sn || '', tax_price: {edit: true, value: ''}, - no_tax_price: {edit: true, value: ''} + non_tax_price: {edit: true, value: ''} } }) this.contents = contents; this.getCanteenList(); }) }, - // 编辑物资列表 - editMaterialList(){ - // this.$http(this.API.).then(res => { - // console.log("editMaterialList", res); - // }) - }, - // 复用报价订单号 + // 复用报价订单号 & 编辑共用 materialListByOrder(){ this.$http(this.API.API_SUPPLIER_QUOTATIONREUSEBYORDER, { q_sn: this.code @@ -167,10 +161,12 @@ material_id: item?.material?.id || 0, spec: item.name, spec_id: item.id, - unit: item?.material?.unit?.unit_name || '', brand: item?.material?.brand || '', quality_level: item?.material?.quality_level || '', - offer: {edit: true, value: ''} + number: item?.material?.m_sn || '', + tax_price: {edit: true, value: item?.quotation?.tax_price || ''}, + non_tax_price: {edit: true, value: item?.quotation?.non_tax_price || ''}, + quotation_id: item?.quotation?.id || 0 } }) this.contents = contents; @@ -191,10 +187,11 @@ material_id: item?.material?.id || 0, spec: item.name, spec_id: item.id, - unit: item?.material?.unit?.unit_name || '', brand: item?.material?.brand || '', quality_level: item?.material?.quality_level || '', - offer: {edit: true, value: ''} + number: item?.material?.m_sn || '', + tax_price: {edit: true, value: item?.quotation?.tax_price || ''}, + non_tax_price: {edit: true, value: item?.quotation?.non_tax_price || ''} } }) this.contents = contents; @@ -222,22 +219,51 @@ }, // 切换显示关联食堂modal switchRelation(){ + if(this.type == 1) return this.$msg('编辑不可更换关联食堂哦'); this.is_show = !this.is_show; }, // 选择食堂 selectItem(index){ this.relation_list[index].checked = !this.relation_list[index].checked; }, + // 报价订单编辑时保存 + editMaterial(_t){ + // 物资列表 + let list = []; + this.contents.map(item => { + list.push({ + id: item.quotation_id, + tax_price: item.tax_price.value, + non_tax_price: item.non_tax_price.value + }) + }); + // 操作状态,是保存还是直接发起 + let state = ['待发起', '待审核'][_t]; + this.$http(this.API.API_SUPPLIER_QUOTATIONSAVE, { + data: list, + state: state + }).then(res => { + this.$msg(res.data).then(result => { + this.$toBack(); + }) + }) + }, // 保存 save(_t){ + // 拦截是编辑的情况 + if(this.type == 1){ + this.editMaterial(_t); + return; + } // 物资列表 let list = []; this.contents.map(item => { - if(item.offer.value){ + if(item.tax_price.value && item.non_tax_price.value){ list.push({ m_id: item.material_id, m_spec_id: item.spec_id, - offer: item.offer.value + tax_price: item.tax_price.value, + non_tax_price: item.non_tax_price.value }) } }); @@ -261,8 +287,9 @@ state: state, canteen_ids: canteen_ids }).then(res => { - console.log("save", res); - this.$msg('操作成功'); + this.$msg(res.data).then(result => { + this.$toBack(); + }) }) } } diff --git a/supplier/pages/order/detail.vue b/supplier/pages/order/detail.vue index 3c2c284..fe52f58 100644 --- a/supplier/pages/order/detail.vue +++ b/supplier/pages/order/detail.vue @@ -11,23 +11,23 @@ 报价商 - {{ order.contact_name }} + {{ order.q_name }} - + 报价明细 - + - + - + - + @@ -45,20 +45,29 @@ components: { wybTable }, data(){ return { - type: 3, + type: 0, order: {}, headers: [{ - label: '菜品名称', + label: '物资名称', key: 'name' },{ label: '规格', key: 'spec' },{ - label: '税前价', - key: 'pre_tax_price' + label: '品牌', + key: 'brand' },{ - label: '税后价', - key: 'after_tax_price' + label: '品级', + key: 'quality_level' + },{ + label: '编号', + key: 'number' + },{ + label: '含税价', + key: 'tax_price' + },{ + label: '非含税价', + key: 'non_tax_price' }], contents: [], q_sn: '' // 订单号 @@ -68,9 +77,9 @@ stateClass(){ return function(val){ let class_name = { - '已通过': 'quoted-price', + '已通过': 'passed', '待发起': 'wait', - '待审核': 'passed', + '待审核': 'quoted-price', '未通过': 'refuse' } return class_name[val]; @@ -82,40 +91,52 @@ this.getDetail(); }, methods: { + stateType(val){ + let type = 0; + switch(val){ + case '待审核': type = 1; break; + case '待发起': type = 2; break; + case '已通过': type = 3; break; + case '未通过': type = 4; break; + } + this.type = type; + }, getDetail(){ this.$http(this.API.API_SUPPLIER_QUOTATIONDETAIL, { q_sn: this.q_sn }).then(res => { console.log("getDetail", res); + this.stateType(res.data.order.state); this.order = res.data.order || {}; - - let list = res.data.order.item || []; let contents = list.map(item => { let obj = { - name: item.material?.m_name, + name: item.material?.m_name || '', material_id: item.material?.id, - spec: item.spec?.name, + spec: item.spec?.name || '', spec_id: item.spec?.id, - pre_tax_price: item.tax_price, - after_tax_price: item.non_tax_price + brand: item?.material?.brand || '', + quality_level: item?.material?.quality_level || '', + number: item?.material?.m_sn || '', + tax_price: item.tax_price, + non_tax_price: item.non_tax_price } return obj; }); this.contents = contents; + }).catch(err => { + this.$toBack(); }) }, - // 发起报价 - initiateQuotation(){ - // todo 是传入全部信息还是改变订单状态 - }, - // 撤销订单 - revokeOrder(){ + // 改变订单状态 + orderStateChange(state){ this.$http(this.API.API_SUPPLIER_QUOTATIONUPDATE, { q_sn: this.q_sn, - state: '待发起' + state: state }).then(res => { console.log("revokeOrder", res); + this.$msg('操作成功'); + this.getDetail(); // 更新当前页面数据 }) } } diff --git a/supplier/pages/order/index.vue b/supplier/pages/order/index.vue index f249860..1851705 100644 --- a/supplier/pages/order/index.vue +++ b/supplier/pages/order/index.vue @@ -35,35 +35,30 @@