| | |
| | | const route = useRoute() |
| | | const xGrid = ref() |
| | | let cellArea = ref() |
| | | const shapeList = ref(['普形','异形']) |
| | | const shapeList = ref([ |
| | | {name:'普形',value:1}, {name:'异形',value: 2} |
| | | ]) |
| | | |
| | | // 定义表头上传数据 |
| | | const titleUploadData = ref({ |
| | |
| | | let otherMoney = ref(null) |
| | | |
| | | const gridOptions = reactive({ |
| | | loading:false, |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | //virtualScroll: true, // 开启虚拟滚动功能 |
| | | id: 'OrderList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | scrollY:{ enabled: true,gt:15 },//开启虚拟滚动 |
| | | scrollX:{ enabled: true,gt:30 },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | menuConfig: { |
| | | body: { |
| | |
| | | |
| | | //初始化判断是否有id传入 |
| | | onMounted(()=>{ |
| | | |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value,gridOptions) |
| | | const str = route.query.orderId || history.state.orderId |
| | |
| | | orderDetails.forEach(item => { |
| | | item.otherColumns = JSON.parse(item.otherColumns) |
| | | }) |
| | | |
| | | //加载副表数据 |
| | | otherMoney.value =res.data.orderOtherMoneyList |
| | | //加载副表数据 |
| | | xGrid.value.reloadData(orderDetails) |
| | | }else{ |
| | | ElMessage.error(res.msg) |
| | |
| | | }) |
| | | }) |
| | | |
| | | //作废订单 |
| | | const cancelOrder = () => { |
| | | request.post(`/order/cancelOrder/${titleUploadData.value.orderId}`).then((res) =>{ |
| | | if (res.code== 200){ |
| | |
| | | list.forEach((item)=>{ |
| | | countMoney += parseFloat(item.grossAmount) |
| | | }) |
| | | otherMoney.value.forEach(item => { |
| | | countMoney+=item.quantity*item.price |
| | | }) |
| | | // otherMoney.value.forEach(item => { |
| | | // countMoney+=item.quantity*item.price |
| | | // }) |
| | | return parseFloat((countMoney).toFixed(2)) |
| | | } |
| | | //导入功能 |
| | |
| | | }else if(column.property === 'computeArea'){ |
| | | row.computeGrossArea=parseFloat((row.computeArea*row.quantity).toFixed(2)) |
| | | row.grossAmount=parseFloat((row.price * row.computeGrossArea).toFixed(2)) |
| | | }else if(column.property.indexOf('otherColumns.M')>-1){ |
| | | let quantity = 0 |
| | | xGrid.value.getTableData().fullData.forEach(item => { |
| | | quantity += item.quantity*(getNestedProperty(item,column.property)*1) |
| | | }) |
| | | if(!isNaN(quantity)){ |
| | | otherMoney.value.forEach(item => { |
| | | if(item.column===column.property.split('.')[1]){ |
| | | item.quantity = quantity |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | // else if(column.property.indexOf('otherColumns.M')>-1){ |
| | | // let quantity = 0 |
| | | // xGrid.value.getTableData().fullData.forEach(item => { |
| | | // let orderQuantity = isNaN(item.quantity) ? 0 : item.quantity |
| | | // let value = isNaN((getNestedProperty(item,column.property)*1)) ? 0 : (getNestedProperty(item,column.property)*1) |
| | | // quantity += orderQuantity*value |
| | | // }) |
| | | // if(!isNaN(quantity)){ |
| | | // otherMoney.value.forEach(item => { |
| | | // if(item.column===column.property.split('.')[1]){ |
| | | // item.quantity = quantity |
| | | // } |
| | | // }) |
| | | // } |
| | | // } |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | |
| | | |
| | |
| | | </template> |
| | | <template #shape_edit="{ row }"> |
| | | <vxe-select v-model="row.shape" transfer> |
| | | <vxe-option v-for="item in shapeList" :key="item" :value="item" :label="item" /> |
| | | <vxe-option v-for="item in shapeList" :key="item" :value="item.value" :label="item.name" /> |
| | | </vxe-select> |
| | | </template> |
| | | |